This project uses the following tools:
Make sure you have these set up in your system before proceeding.
Install asdf plugins to manage Erlang and Elixir versions:
$ asdf plugin add erlang
$ asdf plugin add elixir
Then, install Erlang and Elixir versions used in the project:
$ asdf install
You need to set up some required environment variables:
DATABASE_URL
(database connection string)
You'll find a template for such variables in .envrc.template
.
💡 We use and recommend direnv, there's a
.envrc
template available:# Duplicate the template as `.envrc` $ cp .envrc.template .envrc
Uncomment the variables and customize it as you need.
If your environment variables looks good, you should be able to set everything up quickly with:
$ make setup
You can run the server in dev mode with:
$ make run
Optionally, you can run it within an IEx session to interact with the system through an Elixir CLI with:
$ make repl.run
In either case, the server must be available in http://localhost:4000.
There's a seeding script available. It created 1K users with 50 cameras each (50K cameras in total).
Run it with:
$ mix run priv/repo/seeds.exs
This project provides a Makefile
with a common make
-based CLI interface:
- Project chores
make setup
make build
make run
- Code quality
make lint
make fmt
make test
make test.watch
- Database
make db.setup
make db.create
make db.migrate
make db.seed
make db.drop
make db.reset
- REPL
make repl
make repl.run
Run tests with:
$ make test
Run tests continuously during development with:
$ make test.watch
💡 You'll need entr set up to use this Make task.
© 2024 Joel Jucá. All rights reserved