-
Notifications
You must be signed in to change notification settings - Fork 11
Local Development
This guide covers setting up a local development environment for Eagle applications.
- Node.js 24.x (LTS) - Download
- Yarn (via Corepack) - Comes with Node.js
- Git - Download
-
Docker - Required for eagle-api MongoDB (
yarn db:up); also used for container testing - OpenShift CLI (optional) - For cluster access
node --version # Should show v24.x.x
corepack enable # Enable Yarn via Corepack
yarn --version # Should show 4.x.x
git --version # Any recent version# Clone repository
git clone https://github.com/bcgov/eagle-public.git
cd eagle-public
# Install dependencies
corepack enable
yarn install
# Start development server
yarn startApplication available at: http://localhost:4200
# Clone repository
git clone https://github.com/bcgov/eagle-admin.git
cd eagle-admin
# Install dependencies
corepack enable
yarn install
# Start development server
yarn startApplication available at: http://localhost:4200
Note: You can only run one Angular dev server on port 4200 at a time. To run both, configure different ports.
Node Version: eagle-admin uses Node.js 22.x (same as eagle-api), not Node 24.x.
# Clone repository
git clone https://github.com/bcgov/eagle-api.git
cd eagle-api
# Install dependencies
corepack enable
yarn install
# Configure environment variables
cp .env.example .env
# .env.example defaults work out of the box with yarn db:up
# Start MongoDB (Docker required)
yarn db:up
# Restore data (first time only — volume persists across restarts)
yarn db:restore < epic-prod-dump.archive
# Start the API
yarn startApplication available at: http://localhost:3000/api
Prerequisites for eagle-api:
- Node.js 24.x
-
Docker — for
yarn db:up
Database scripts:
| Command | Description |
|---|---|
yarn db:up |
Start MongoDB 8.0 container (Docker) |
yarn db:down |
Stop MongoDB container |
yarn db:logs |
Tail MongoDB logs |
yarn db:restore |
Restore data from stdin (mongodump archive) |
Data persists in the eagle-api_mongodb-data Docker volume across restarts.
Database migrations (after restoring data or adding new migrations):
# Check which migrations are pending
node ./node_modules/migrate-mongo/bin/migrate-mongo.js status
# Apply pending migrations
sh run_migration.shNo credentials are needed against the local Docker MongoDB. For running migrations against remote environments, see Helm Charts — Database Migrations.
| Command | Description |
|---|---|
yarn start |
Start API server |
yarn start-watch |
Start with auto-restart on changes |
yarn db:up |
Start MongoDB (Docker) |
yarn db:down |
Stop MongoDB |
yarn db:logs |
Tail MongoDB logs |
yarn db:restore |
Restore data from stdin (mongodump archive) |
yarn test |
Run unit tests |
yarn test:smoke |
Run smoke tests against running API |
| Command | Description |
|---|---|
yarn start |
Start dev server with hot reload |
yarn build |
Build production bundle |
yarn test |
Run unit tests |
yarn lint |
Run ESLint |
The Angular dev server proxies API requests to the backend. proxy.conf.js reads
API_LOCATION from env.js automatically — only edit env.js.
env.js defaults to http://localhost:3000. Start eagle-api locally:
cd eagle-api
yarn install && cp .env.example .env
yarn startNo proxy changes needed — proxy.conf.js reads API_LOCATION from env.js.
Point API_LOCATION in src/env.js to the dev environment and enable configEndpoint
so config (banner, environment label, etc.) is fetched from the remote /api/config:
window.__env.configEndpoint = true;
window.__env.API_LOCATION = 'https://eagle-dev.apps.silver.devops.gov.bc.ca';Restart the dev server. The proxy picks up the new target automatically.
For UI-only development, configure configEndpoint = false in src/env.js and provide mock configuration.
The src/env.js file is the single source of truth for local dev configuration.
proxy.conf.js reads API_LOCATION from it to generate dev-server proxy rules.
(function (window) {
window.__env = window.__env || {};
// false = local dev (use env.js values), true = deployed (fetch /api/config)
window.__env.configEndpoint = false;
// proxy.conf.js reads this to route /api and /analytics
// To use the dev environment: change to 'https://eagle-dev.apps.silver.devops.gov.bc.ca'
// and set configEndpoint = true above so config is fetched from /api/config
window.__env.API_LOCATION = 'http://localhost:3000';
window.__env.API_PATH = '/api';
// Analytics (routed through eagle-api, which proxies to penguin-analytics)
window.__env.ANALYTICS_API_URL = '/analytics';
}(this));To change the API target, edit API_LOCATION and restart the dev server. No other file to touch.
For testing production behavior, set:
configEndpoint = true- Values come from
/api/configat runtime
# Watch mode (re-runs on file changes)
yarn test
# CI mode (single run, exits)
yarn test-ci
# With coverage
yarn test --coverage# Run ESLint
yarn lint
# Fix auto-fixable issues
yarn lint --fixTest the Docker build process:
# Build image
docker build -t eagle-public:local .
# Run container
docker run -p 8080:8080 eagle-public:local
# Access at http://localhost:8080├── src/
│ ├── app/ # Angular application
│ │ ├── components/ # Reusable components
│ │ ├── services/ # API services
│ │ ├── models/ # TypeScript interfaces
│ │ └── ...
│ ├── assets/ # Static assets
│ ├── env.js # Runtime configuration
│ ├── index.html # Entry HTML
│ └── main.ts # Angular bootstrap
├── helm/ # Helm charts
├── .github/workflows/ # CI/CD pipelines
├── Dockerfile # Container build
├── angular.json # Angular CLI config
├── package.json # Dependencies
├── tsconfig.json # TypeScript config
└── vitest.config.ts # Test configuration
Recommended extensions:
- Angular Language Service
- ESLint
- Prettier
- GitLens
settings.json:
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"eslint.validate": ["typescript", "html"]
}- Enable Angular plugin
- Configure ESLint integration
- Set Node interpreter to v24.x
ng generate component components/my-componentng generate service services/my-service# Update all dependencies
yarn up
# Update specific package
yarn up @angular/core
# Interactive upgrade
yarn upgrade-interactive- Open Chrome DevTools (F12)
- Go to Sources tab
- Find your TypeScript files under
webpack:// - Set breakpoints
launch.json:
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Debug Eagle",
"url": "http://localhost:4200",
"webRoot": "${workspaceFolder}"
}
]
}Contact a code owner (@tom0827, @Ckoelewyn, @tolkamps1, @danieltruong) to be added as a collaborator.
- Request access via Platform Services
- Get added to the
6cdc9eproject set - Login:
oc login --token=<token> --server=https://api.silver.devops.gov.bc.ca:6443
- Architecture Overview - How the system works
- Deployment Pipeline - How to deploy changes
- Troubleshooting - Common issues
Eagle Documentation
Operations
Architecture
Configuration
Help
Repositories
Environments