CaptainFact.io
Install & Run
Prerequisites
You need to install Elixir. We recommand using asdf-vm.
Check their documentation on how to install it, then run asdf install
from
root captain-fact-api
folder.
Start DB
Create / launch a PostgreSQL instance on your local machine. If you have Docker installed, you can use the pre-Seed PostgreSQL Docker image:
docker run -d --name cf_dev_db -p 5432:5432 captainfact/dev-db:latest
Start API
mix deps.get
--> Get dependenciesmix ecto.create
--> Create DBmix ecto.migrate
--> Migrate DBiex -S mix
--> Start project
Following services will be started:
- localhost:4000 - REST API
- localhost:4001 - REST API (HTTPS)
- localhost:4002 - GraphQL API
- localhost:4003 - GraphQL API (HTTPS)
- localhost:4004 - Atom feed
You can also see all e-mail sent, by going to http://localhost:4000/\_dev/mail
Other useful commands
mix test
--> Run testsmix test.watch
--> Run test watchermix format
--> Format codemix ecto.gen.migration [migration_name]
--> Generate migration
Project architecture
This application is organized as an umbrella project which allows us to divide CaptainFact API into small apps.
.
βββ apps
βΒ Β βββ cf => Core functions as a library. **Not deployed**
βΒ Β βββ cf_atom_feed => Atom feed.
βΒ Β βββ cf_graphql => GraphQL API (public).
βΒ Β βββ cf_jobs => Jobs.
βΒ Β βββ cf_rest_api => REST/WS API (private).
βΒ Β βββ db => DB repository and schemas **Not deployed**
βΒ Β βββ lib
βΒ Β βΒ Β βββ db
βΒ Β βΒ Β βββ db_schema => Contains all the schemas (Video, Speaker, Commentβ¦etc)
βΒ Β βΒ Β βββ db_type => Special types (SpeakerPictureβ¦etc.)
βΒ Β βΒ Β βββ db_utils => Some utility functions
βΒ Β βββ priv
βΒ Β Β Β βββ repo/migrations => All DB migrations files
βββ README.md => You're reading it right now. Are you?
βββ rel => Release configs & tools
βΒ Β βββ commands => Commands that will be available to run on the release (seed DBβ¦etc.)
βΒ Β βββ hooks => Some hooks for automatically run commands when release run.
βΒ Β βββ runtime_config => Runtime configurations for all apps.
βΒ Β βββ config.exs => Release configuration.