This is a consolidated monorepo containing three previously separate applications:
- nrts-prc-admin - Angular admin frontend application
- nrts-prc-public - Angular public frontend application
- nrts-prc-api - Express.js backend API
The applications have been integrated into the following structure:
- backend/ - Express.js API server (formerly nrts-prc-api)
- frontend/admin/ - Angular admin application (formerly nrts-prc-admin)
- frontend/public/ - Angular public application (formerly nrts-prc-public)
- migrations/ - Database migration scripts
- charts/ - Helm charts for Kubernetes deployment
.
βββ backend/ # Express.js API backend
β βββ api/ # API controllers, helpers, swagger
β βββ migrations/ # DB migrations
β βββ seed/ # Database seed data
β βββ data_migration/ # Data migration scripts
β βββ app.js # Express app entry point
β βββ database.json # Database configuration
β βββ package.json # Backend dependencies
β βββ Dockerfile # Backend Docker image
β
βββ frontend/ # Angular frontend applications
β βββ admin/ # Admin portal
β β βββ src/ # Admin Angular source code
β β βββ e2e/ # End-to-end tests
β β βββ angular.json # Angular CLI config
β β βββ package.json # Admin dependencies
β β βββ tsconfig.json # TypeScript config
β β
β βββ public/ # Public portal
β β βββ src/ # Public Angular source code
β β βββ e2e/ # End-to-end tests
β β βββ angular.json # Angular CLI config
β β βββ package.json # Public dependencies
β β βββ tsconfig.json # TypeScript config
β β
β βββ Dockerfile # Frontend Docker build
β βββ .dockerignore # Docker ignore patterns
β
βββ migrations/ # SQL migrations (if using PostgreSQL later)
β βββ sql/ # SQL migration files
β
βββ charts/ # Kubernetes deployment
β βββ app/ # Main application Helm chart
β βββ crunchy/ # PostgreSQL chart (optional)
β
βββ docker-compose.yml # Local development environment
βββ .github/ # GitHub Actions workflows
β βββ workflows/ # CI/CD pipeline definitions
β
βββ README.md # This file
Current: MongoDB
- Database:
nrts-dev(configurable) - Default User:
admin - Default Password:
nrts-dev - Port:
27017
- Docker Desktop or Docker Engine
- Docker Compose
# Clone and navigate to the repo
git clone <repository-url>
cd nr-acrfd-comments
# Start all services (MongoDB, backend, frontend)
docker-compose up
# Access the applications:
# - Admin Frontend: http://localhost:4200/admin
# - Public Frontend: http://localhost:3000
# - API Docs: http://localhost:3000/api/docs
# - MongoDB: mongodb://localhost:27017- database - MongoDB container
- backend - Express.js API (port 3000)
- frontend-admin - Admin Angular app (port 4200)
- frontend-public - Public Angular app (port 3000)
cd backend
# Install dependencies
npm install
# Set environment variables
export MONGODB_SERVICE_HOST=localhost
export MONGODB_USERNAME=admin
export MONGODB_PASSWORD=nrts-dev
export MONGODB_DATABASE=nrts-dev
# Start backend server
npm start
# Run tests
npm run tests
# Run linting
npm run lint
# Fix linting issues
npm run lint-fixBackend Endpoints:
- API Base:
http://localhost:3000/api - Swagger Docs:
http://localhost:3000/api/docs
cd frontend/admin
# Install dependencies
npm install
# Start development server
npm start
# Build for production
npm run build
# Run tests
npm run tests
# Lint code
npm run lintAdmin App:
- Dev Server:
http://localhost:4200 - Deploy URL:
/admin/
cd frontend/public
# Install dependencies
npm install
# Start development server
npm start
# Build for production
npm run build
# Run tests
npm run tests
# Lint code
npm run lintPublic App:
- Dev Server:
http://localhost:3000 - Deploy URL:
/
cd backend
npm run tests # Run with file watcher
npm run tests-ci # Run once with coverage
npm run tests-debug # Debug modecd frontend/admin
npm run tests # Angular test suite
cd frontend/public
npm run tests # Angular test suite# Build all images
docker build -t nrts-backend:latest backend/
docker build -t nrts-frontend:latest frontend/
# Or use docker-compose
docker-compose buildHelm charts are located in the charts/ directory:
# Deploy using Helm
helm install nrts charts/app \
-n nrts-dev \
--values charts/app/values.yaml
# Upgrade deployment
helm upgrade nrts charts/app \
-n nrts-dev \
--values charts/app/values.yamlGitHub Actions workflows are configured in .github/workflows/:
- pr-open.yml - Triggered on PR open/update: builds, tests, deploys to PR environment
- pr-close.yml - Cleans up PR environment
- pr-validate.yml - Validates PR (checks commits, titles, etc.)
- merge.yml - Triggered on merge to main: deploys to TEST/PROD
- analysis.yml - Security and code quality scanning
- scheduled.yml - Nightly tests and reports
| Workflow | Trigger | Action |
|---|---|---|
| PR Build & Test | Pull Request | Build images, run tests, deploy to pr-<number> environment |
| Merge to Main | Merge to master |
Deploy to TEST environment |
| Manual Deploy | Workflow dispatch | Deploy to PROD environment |
- Create a feature branch:
git checkout -b feature/your-feature - Make changes to backend, frontend, or both
- Push branch and create a Pull Request
- GitHub Actions will:
- Build Docker images
- Run tests
- Deploy to ephemeral PR environment
- Run security scans
- After approval and merge, deploy to TEST/PROD
MONGODB_SERVICE_HOST=localhost
MONGODB_USERNAME=admin
MONGODB_PASSWORD=nrts-dev
MONGODB_DATABASE=nrts-dev
API_HOSTNAME=localhost:3000
NODE_ENV=development
UPLOAD_DIRECTORY=./uploads/BACKEND_URL=http://localhost:3000The backend expects MongoDB connection via:
MONGODB_SERVICE_HOST(default: localhost)MONGODB_USERNAME(default: admin)MONGODB_PASSWORD(default: nrts-dev)MONGODB_DATABASE(default: nrts-dev)
Or legacy env vars:
DB_1_PORT_27017_TCP_ADDR
API documentation is available at:
http://localhost:3000/api/docs
Swagger/OpenAPI spec: backend/api/swagger/swagger.yaml
- Runtime: Node.js 10+
- Framework: Express.js
- Database: MongoDB
- Testing: Jest
- Linting: ESLint, Prettier
- API Docs: Swagger/OpenAPI
- Framework: Angular 6
- UI Library: Angular Material, Bootstrap
- Testing: Jasmine/Karma
- Linting: TSLint, Prettier
- Framework: Angular 6
- UI Library: Bootstrap, Leaflet
- Testing: Jasmine/Karma
- Linting: TSLint, Prettier
- Containerization: Docker
- Orchestration: Kubernetes/OpenShift
- Package Manager: Helm
- CI/CD: GitHub Actions
This monorepo consolidates code from:
- https://github.com/bcgov/nrts-prc-admin
- https://github.com/bcgov/nrts-prc-public
- https://github.com/bcgov/nrts-prc-api
Apache License 2.0 - See LICENSE file
See CONTRIBUTING.md for guidelines