|
1 | | - |
2 | | - |
3 | 1 | # Listify |
4 | 2 |
|
5 | | -To start your Phoenix server: |
| 3 | +This repository contains the implementation of a simple shopping list. It has both a UI built with LiveView and a REST API. |
| 4 | + |
| 5 | +## Dependencies |
| 6 | + |
| 7 | +To run the project and its tests, the following dependencies are required: |
| 8 | +* Elixir 1.10 |
| 9 | +* Postgres 11+ |
| 10 | + |
| 11 | +## Running the project |
| 12 | + |
| 13 | +To run the project, first export the following environment variables regarding your database configuration: |
| 14 | +* `DATABASE_USERNAME` - Defaults to `postgres` |
| 15 | +* `DATABASE_PASSWORD` - Defaults to `postgres` |
| 16 | +* `DATABASE_NAME` - Defaults to `listify_dev` |
| 17 | +* `DATABASE_POOL_SIZE` - Defaults to `10` |
| 18 | + |
| 19 | +Then, navigate to the cloned repository and run the following commands: |
| 20 | +```shell |
| 21 | +mix deps.get |
| 22 | +mix ecto.setup |
| 23 | +mix phx.server |
| 24 | +``` |
| 25 | + |
| 26 | +The project will be available on `localhost:4000`. The list is under the route `/items`. |
| 27 | + |
| 28 | +## Running unit tests |
| 29 | + |
| 30 | +The library used to build unit tests was `ExUnit`. In assistance to it, `ExMachina` was used to build factories. |
6 | 31 |
|
7 | | - * Setup the project with `mix setup` |
8 | | - * Start Phoenix endpoint with `mix phx.server` |
| 32 | +To run the tests, first export the database credentials and name (here the default name changed to `listify_test`) and then use the command `mix test`. |
9 | 33 |
|
10 | | -Now you can visit [`localhost:4000`](http://localhost:4000) from your browser. |
| 34 | +## Static code analysis |
11 | 35 |
|
12 | | -Ready to run in production? Please [check our deployment guides](https://hexdocs.pm/phoenix/deployment.html). |
| 36 | +Two tools were set in the project: `Credo`, which is focused on code consistency and refactor opportunities, and `Dialyzer`, which is focused on identifying software discrepancies, such as definite type errors, code that has become dead or unreachable because of programming error. To run them, use the commands |
| 37 | +```shell |
| 38 | +mix credo |
| 39 | +mix dialyzer |
| 40 | +``` |
13 | 41 |
|
14 | | -## Learn more |
| 42 | +## Architecture |
15 | 43 |
|
16 | | - * Official website: https://www.phoenixframework.org/ |
17 | | - * Guides: https://hexdocs.pm/phoenix/overview.html |
18 | | - * Docs: https://hexdocs.pm/phoenix |
19 | | - * Forum: https://elixirforum.com/c/phoenix-forum |
20 | | - * Source: https://github.com/phoenixframework/phoenix |
| 44 | +In order to avoid code duplication in the full stack application and in the API, the concept of [use cases](http://www.plainionist.net/Implementing-Clean-Architecture-UseCases/) was implemented. The use cases are the intermediate between the business rules and the presenters, which are the controllers and the LiveView modules. |
0 commit comments