- Node.js
- npm
- Docker OR PostgreSQL 16
To run the entire application using Docker Compose, run the following commands:
git clone [email protected]:bcgov/nr-rec-resources.git
cd nr-rec-resources
docker-compose up
Navigate to http://localhost:3000
in your web browser to view the application.
Before starting development on this project, run npm install
in the base
directory to install eslint and plugins to ensure linting is working correctly.
To run this on your local machine, you will need a working installation of PostgreSQL 16.
Create an .env
file in the backend
directory using the example in
backend/.env.example
as a template.
cd nr-rec-resources
make create_db
make migrate
make load_fixtures
or to drop, recreate, run migrations and reseed the database, ensure no connections are open to the database then run:
make reset_db
Ensure you have the .env
file in the backend
directory from the previous
step.
cd backend
npm install
npx prisma generate
npm run dev
Create an .env
file in the frontend
directory using the example in
frontend/.env.example
as a template.
cd frontend
npm install
npm run dev
Navigate to http://localhost:3000
in your web browser to view the application.
Install Java Development Kit (JDK) 17:
brew install openjdk@17
Run the following command from the project root folder to generate the
TypeScript client library from your OpenAPI specification and run prettier-fix
to format the files:
npm run install-client-sdk
This command will:
- Generate TypeScript client code using Axios
- Use the OpenAPI spec from your local NestJS server which should be running on port 8000
- Output the generated code to
src/service/recreation-resource
directory
When you make changes to the database schema, you will need to regenerate the Prisma schema and client. Ensure your database is running and run the following commands:
cd backend
npx prisma db pull # Pull the latest schema from the database
npx prisma generate # Generate the Prisma client
The updated Prisma schema can be viewed in backend/prisma/schema.prisma
Pre-commit is set up to run checks for linting, formatting, and secrets.
- Install pre-commit
- With pre-commit installed run
pre-commit install
in the root directory of the project - Pre-commit should now run on your staged files every time you make a commit
If you need to skip the pre-commit hooks for a specific commit, you can use the
--no-verify
flag. Some developers may use this when they are making a commit
that they know will fail the pre-commit checks, but they still want to commit
the changes. This is a perfectly acceptable workflow, though there is a
pre-commit check in CI so it may be necessary to run pre-commit on all files
before putting a PR up for review if this is skipped.
git commit -m "Your commit message" --no-verify
Sometimes it may be necessary to run pre-commit
on the entire project due to a
mistake or a configuration change.
pre-commit run --all-files
Commits follow the conventions defined in the Conventional Commits specification.
Schedule job runs every saturday and keep schema documentation upto date in github pages.