ElixirBoilerplate
October 12, 2023 ยท View on GitHub
| Section | Description |
|---|---|
| ๐ฏ Objectives and context | Project introduction and context |
| ๐ง Dependencies | Technical dependencies and how to install them |
| ๐ Kickstart | Details on how to kickstart development on the project |
| ๐ Code & architecture | Details on the application modules and technical specifications |
| ๐ญ Possible improvements | Possible code refactors, improvements and ideas |
| ๐ Troubleshooting | Recurring problems and proven solutions |
| ๐ Deploy | Deployment details for various enviroments |
๐ฏ Objectives and context
โฆ
Browser support
| Browser | OS | Constraint |
|---|---|---|
| โฆ | โฆ | โฆ |
๐ง Dependencies
Every runtime dependencies are defined in the .tool-versions file. These external dependencies are also required:
- PostgreSQL (
~> 12.0)
๐ Kickstart
Environment variables
All required environment variables are documented in .env.dev.
When running mix or make commands, it is important that these variables are present in the environment. There are several ways to achieve this. Using nv is recommended since it works out of the box with .env.* files.
Initial setup
- Create both
.env.dev.localand.env.test.localfrom empty values in.env.devand.env.test - Install Mix and NPM dependencies with
make dependencies - Generate values for mandatory secrets in
.env.devwithmix phx.gen.secret
Then, with variables from .env.dev and .env.dev.local present in the environment:
- Create and migrate the database with
mix ecto.setup - Start the Phoenix server with
make run
make commands
A Makefile is present at the root and expose common tasks. The list of these commands is available with make help.
Database
To avoid running PostgreSQL locally on your machine, a docker-compose.yml file is included to be able start a PostgreSQL server in a Docker container with docker-compose up postgresql.
Tests
Tests can be ran with make test and test coverage can be calculated with make check-code-coverage.
Linting
Several linting and formatting tools can be ran to ensure coding style consistency:
make lint-elixirensures Elixir code follows our guidelines and best practicesmake lint-scriptsensures JavaScript code follows our guidelines and best practicesmake lint-stylesensures SCSS code follows our guidelines and best practicesmake check-formatensures all code is properly formattedmake formatformats files using Prettier andmix format
Continuous integration
The .github/workflows/ci.yaml workflow ensures that the codebase is in good shape on each pull request and branch push.
๐ Code & architecture
โฆ
๐ญ Possible improvements
| Description | Priority | Complexity | Ideas |
|---|---|---|---|
| โฆ | โฆ | โฆ | โฆ |
๐ Troubleshooting
System readiness
The project exposes a GET /ping route that sends an HTTP 200 OK response as soon as the server is ready to accept requests. The response also contains the project version for debugging purpose.
System health
The project exposes a GET /health route that serves the ElixirBoilerplateHealth module. This module contains checks to make sure the application and its external dependencies are healthy.
| Name | Description |
|---|---|
NOOP | This check is always healthy |
Metrics
The project exposes a Telemetry UI dashboard through the GET /metrics route. Metrics are configured here.
๐ Deploy
Versions & branches
Each deployment is made from a Git tag. The codebase version is managed with incr.
Container
A Docker image running an OTP release can be created with make build, tested with docker-compose up application and pushed to a registry with make push.