A RESTful API to manage your routine
Currently on experimental phase
Rabbits API is a RESTful API built to be integrated by Rabbits Mobile app.
- Node:
- Run
yarn
to install dependencies.
- Run
- Environment variables:
- Copy
env.example
to a new.env
file; - Fill/replace
.env
with the required credentials.
- Copy
- Docker:
- Create a
docker-compose.override.yml
if you want to change something ofdocker-compose.yml
; - Run
yarn docker:build
to build the API into a new docker image; - Run
yarn docker:up
to set up all containers.
- Create a
- Migrations:
- Run
yarn migration:up
to generate postgresql database structure; - If you want to create a new migration, you can do so by running
NAME=MigrationName yarn migration:create
; - IF you want to rollback the last executed migration, run
yarn migration:down
.
- Run
- Run
yarn start:dev
.
- Run
yarn test:unit
to execute tests; - Run
yarn test:unit:cov
to execute tests and generate coverage reports:- Coverage reports will be available under
test/coverage
folder.
- Coverage reports will be available under
- Run
yarn fix
to fix linting issues; - Run
yarn lint
to check for linting issues. If some of them was not solved byyarn fix
, you will see related files and description on terminal, so you can manually solve them.
- Run
yarn build
.
- Setup the following GitHub secrets:
- SSH_HOST:
- It is your server host. e.g.:
122.0.0.1
.
- It is your server host. e.g.:
- SSH_USER:
- It is your server user. e.g.:
root
.
- It is your server user. e.g.:
- SSH_PORT:
- It is your server ssh port. Usually it is
22
.
- It is your server ssh port. Usually it is
- SSH_KEY:
- You can generate a new ssh key-pair on linux by running
ssh-keygen
; - Once generated, copy the public key to your server's
authorized_keys
file, which is usually located at.ssh/authorized_keys
; - The private key, on the other hand, is the value of the secret.
- You can generate a new ssh key-pair on linux by running
- SSH_HOST:
- Every push to the
develop
branch will trigger a GitHub CI workflow. This workflow is available under the.github/workflows
folder. Once ran, the code will be deployed on the server.
If you want to contribute, please check contributing.