Skip to content

Latest commit

Β 

History

221 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

πŸš€ NRTS PRC - Consolidated Monorepo

MIT License Lifecycle

πŸ“‹ Project Overview

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

πŸ—οΈ Monorepo Structure

.
β”œβ”€β”€ 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

πŸ—„οΈ Database

Current: MongoDB

  • Database: nrts-dev (configurable)
  • Default User: admin
  • Default Password: nrts-dev
  • Port: 27017

πŸƒβ€β™‚οΈ Quick Start with Docker Compose

Prerequisites

  • Docker Desktop or Docker Engine
  • Docker Compose

Running Locally

# 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

Docker Compose Services

  • database - MongoDB container
  • backend - Express.js API (port 3000)
  • frontend-admin - Admin Angular app (port 4200)
  • frontend-public - Public Angular app (port 3000)

πŸ”¨ Development Setup

Backend Development

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-fix

Backend Endpoints:

  • API Base: http://localhost:3000/api
  • Swagger Docs: http://localhost:3000/api/docs

Frontend - Admin App

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 lint

Admin App:

  • Dev Server: http://localhost:4200
  • Deploy URL: /admin/

Frontend - Public App

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 lint

Public App:

  • Dev Server: http://localhost:3000
  • Deploy URL: /

πŸ§ͺ Testing

Backend Tests

cd backend
npm run tests           # Run with file watcher
npm run tests-ci        # Run once with coverage
npm run tests-debug     # Debug mode

Frontend Tests

cd frontend/admin
npm run tests          # Angular test suite

cd frontend/public
npm run tests          # Angular test suite

πŸš€ Build & Deployment

Docker Build

# Build all images
docker build -t nrts-backend:latest backend/
docker build -t nrts-frontend:latest frontend/

# Or use docker-compose
docker-compose build

Kubernetes/OpenShift Deployment

Helm 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.yaml

πŸ”„ CI/CD Pipeline

GitHub 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 Triggers

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

πŸ“ Git Workflow

  1. Create a feature branch: git checkout -b feature/your-feature
  2. Make changes to backend, frontend, or both
  3. Push branch and create a Pull Request
  4. GitHub Actions will:
    • Build Docker images
    • Run tests
    • Deploy to ephemeral PR environment
    • Run security scans
  5. After approval and merge, deploy to TEST/PROD

πŸ”§ Configuration

Environment Variables

Backend

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/

Frontend

BACKEND_URL=http://localhost:3000

Database Connection

The 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

API documentation is available at:

http://localhost:3000/api/docs

Swagger/OpenAPI spec: backend/api/swagger/swagger.yaml

πŸ› οΈ Tools & Technologies

Backend

  • Runtime: Node.js 10+
  • Framework: Express.js
  • Database: MongoDB
  • Testing: Jest
  • Linting: ESLint, Prettier
  • API Docs: Swagger/OpenAPI

Frontend (Admin)

  • Framework: Angular 6
  • UI Library: Angular Material, Bootstrap
  • Testing: Jasmine/Karma
  • Linting: TSLint, Prettier

Frontend (Public)

  • Framework: Angular 6
  • UI Library: Bootstrap, Leaflet
  • Testing: Jasmine/Karma
  • Linting: TSLint, Prettier

DevOps

  • Containerization: Docker
  • Orchestration: Kubernetes/OpenShift
  • Package Manager: Helm
  • CI/CD: GitHub Actions

πŸ“– Original Repositories

This monorepo consolidates code from:

πŸ“„ License

Apache License 2.0 - See LICENSE file

🀝 Contributing

See CONTRIBUTING.md for guidelines

βš–οΈ Code of Conduct

See CODE_OF_CONDUCT.md

About

No description, website, or topics provided.

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages