The backend for nexd is build using nest.js.
Please install the node modules:
npm install
You can use a postgres (postgis extension) installation on your local machine using docker:
npm run docker:postgis
The important environment files for local development are .env.development.local
and .env.postgis.local
.
To start the development:
npm start
With an automatic reload:
npm run start:dev
The environment variables from the .env.production
file are being used.
Some secrets of course require to be hidden. These are:
ADMIN_SECRET
: A secret to be used in the header x-admin-secret
header to access the PUT /articles
endpoint. Just a workaround until full user accounts are in place.
API_ROOT_URL
: URL of the API installation (e.g. https://nexd-backend-staging.herokuapp.com )
DATABASE_URL
: The database connection string. If this is set, the other settings (username, password,... ) of the database are not used.
JWT_SECRET
: The jwt secret.
Currently, a staging of the develop
branch is deployed to AWS and to heroku.
On heroku, the URL is: https://nexd-backend-staging.herokuapp.com/
With the swagger being available at: https://nexd-backend-staging.herokuapp.com/api/v1/docs
For the sake of simplicity, a single docker container is build using the github actions.
Currently, this container is pushed directly to heroku. Later on, it is supposed to be pushed to the github container registry as well.
Postgres is used. Locally is already a postgis command available. The postgis extension will be used for geo data.
Create your typeorm cli ormconfig.json
file:
npm run typeorm:createconfig
This is not yet fully checked, so please have a look into the ormconfig.json
. Relative paths seemed to work more reliable.
To create a migration:
npm run typeorm migration:generate -- -n "<migration name>"
userResourceOrAdminsecret.guard.ts
)