The finance app needs the elixir language to be installed. You can install it manually or via the asdf package manager, using the fixed version from the .tool-versions files
- Ubuntu/Debian SO
- asdf
latest - Elixir
1.14.3 - Erlang
25.2.1 - Node
16.13.1 - Docker
24.0.2(optional): used to run dockerized images of the backend
Elixir, Erlang and Node can also be installed using asdf. Personal installation notes.
asdf plugin-update --all
asdf plugin-add erlang
asdf plugin-add elixir
asdf plugin-add nodejs
asdf installVersions inside .tool-versions will be installed.
- VSCodium, free alternative for VSCode.
- VSCode
- ElixirLS brings debugging, static analysis, formatting and code highlight support.
- Elixir Linter (Credo) suggests code formatting, refactoring oportunities and promotes code consistency.
- ESLint provides code consistency and beso practices for Javascript.
- markdownlint brings consistency for writing documentation using markdown.
NOTE: this tool help us detect issues that are eventually checked via git hooks or CI.
This project uses elixir_git_hooks t prevent common issues during the CI.
Git hooks implementation can be found in config/dev.exs.
This hooks are automatically installed when the project compiles: mix compile. They can also be manually installed or run from a terminal:
- Installation:
mix git_hooks.install - Run a specific hook:
mix git_hooks.run pre_commit - Run all hooks:
mix git_hooks.run all
Copy .env.example to the project root and rename it .env. Then assign the following values:
cp .env.example .envPHX_HOST: a hsot IP. Example:127.0.0.1(local),192.168.0.xxx(lan),0.0.0.0(lan). This is mostly using in staging or production environments.
DB_USERNAME: username for a root user in the development postgres database.DB_PASSWORD: password for a root user in the development postgres database.
SENDGRID_API_KEY: Sendgrid API key.
FINNHUB_API_KEY: The Finnhub API key.
CAFECITO_USERNAME: The Cafecito app username.
UPLOADS_PATH: the assigned path for uploads.
This project uses Makefile to interact with the Elixir server, the postgres service, database and a variety of mix tools.
Displays helpful information about each command.
make help
# Shortcut
makeInstalls a complete development environment. This is useful when changing branches or testing PRs with new dependencies.
make setupInstalls dependencies only.
make setup.depsSimulates a complete envrionment re-installation. This is useful when stepping into client or server dependencies conflicts, migration issues or PR revisions that are not backwards compatible to current versions.
make resetConvenience for dropping the development database only.
make reset.ectoConvenience for dropping the testing database only.
make reset.ecto.testStarts an Elixir server with an interactive shell sesion.
make serverRuns all tests.
make testRuns only tests tagged with
wip(About tags and tests).
make test.wipRuns all tests, outputs coverage and generates an html report.
make test.coverRuns and watches all tests or those tagged with
wip
make test.watch
make test.wip.watchBecause some of this commands are executed in the lint.yml workflow we recommend to run make check before applying changes to avoid conflicts in the CI. However, git hooks should notify errors and prevent commiting conflicting code when properly installed.
Formats code and analyzes code consistency, best practices and suggest refactoring opportunities.
make lintSimilar to
make lintbut runs strictly: checks the code is properly formatted.
make check.lintRuns all available checks. Useful to test a branch before commiting.
make checkThere are a group of commands that let developers test a production like distribution of the application, using docker. Copy the .env.prod.example to an .env.prod file and fill in the missing values before trying the commands below.
Run the docker release command to build and run a new, fresh container.
make docker.releaseUse docker rerun to stop any running container. This is useful to test a new .env.prod configuration without having to rebuild the whole project.
make docker.rerunCheck the logs of the container that's currently running
make docker.logsOnce the environment file and the project is properly set up, a development server can be started using the make server command.
- Visit
localhost:4000from your browser to access the application main page. - Visit
localhost:4000/dev/dashboardfrom your browser to access a development dashboard with information about your app.