From 80039d1a7fe4207f2e6da0fe09333cd30c6551c7 Mon Sep 17 00:00:00 2001 From: marcellmueller Date: Thu, 28 Nov 2024 11:49:54 -0800 Subject: [PATCH] chore: update readme --- Makefile | 8 +++--- README.md | 57 ++++++++++++++++++++++++++++++++++++++++++ backend/package.json | 4 +-- frontend/src/index.tsx | 1 + 4 files changed, 64 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index dd7153e4..6f7026bb 100644 --- a/Makefile +++ b/Makefile @@ -20,10 +20,10 @@ drop_db: grep -q 0 || \ $(PSQL) -d postgres -c "DROP DATABASE $(DB_NAME)"; -.PHONY: migrations -migrations: ## create the migrations -migrations: - ## TODO:: use flyway for migrations +.PHONY: migrate +migrate: ## create the migrations +migrate: + ## TODO:: this is a very basic setup, we should use flyway for migrations for file in ./migrations/sql/*.sql; do \ printf "Applying migration: ${DB_NAME}/$$(basename $$file)\n"; \ $(PSQL) -d $(DB_NAME) -f $$file; \ diff --git a/README.md b/README.md index 5cce130d..f9aa1e67 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,63 @@ Backend (JavaScript/TypeScript) - (License)[LICENSE.md] - (Security)[SECURITY.md] +## Local Development + +### Prerequisites + +- Node.js +- npm +- Docker OR PostgreSQL 15 + +### Docker Compose + +To run the entire application using Docker Compose, run the following commands: + +```bash +git clone git@github.com: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. + +### Installation + +To run this on your local machine, you will need a working installation of PostgreSQL 15. + +### Database + +Create an `.env` file in the `backend` directory using the example in `backend/.env.example` as a template. + +```bash +cd nr-rec-resources +make create_db +make migrate +``` + +### Backend + +Ensure you have the `.env` file in the `backend` directory from the previous step. + +```bash +cd backend +npm install +npm run dev +``` + +### Frontend + +Create an `.env` file in the `frontend` directory using the example in `frontend/.env.example` as a template. + +```bash +cd frontend +npm install +npm run dev +``` + +Navigate to `http://localhost:3000` in your web browser to view the application. + + ## Style Guide Commits follow the conventions defined in the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification. diff --git a/backend/package.json b/backend/package.json index f760708f..4bfd035d 100644 --- a/backend/package.json +++ b/backend/package.json @@ -8,9 +8,9 @@ "build": "prisma generate && nest build", "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", "deploy": "npm ci --ignore-scripts --no-update-notifier && npm run build", + "dev": "nest start --watch", + "dev:debug": "nest start --debug --watch", "start": "nest start", - "start:dev": "nest start --watch", - "start:debug": "nest start --debug --watch", "start:prod": "node dist/main", "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix", "lint:staged": "./node_modules/.bin/lint-staged", diff --git a/frontend/src/index.tsx b/frontend/src/index.tsx index d3598dce..09aa039c 100644 --- a/frontend/src/index.tsx +++ b/frontend/src/index.tsx @@ -14,6 +14,7 @@ root.render(