{"id":44375935,"url":"https://github.com/bcgov/eagle-api","last_synced_at":"2026-05-15T01:29:00.922Z","repository":{"id":47234092,"uuid":"162646476","full_name":"bcgov/eagle-api","owner":"bcgov","description":"EPIC revision 2019","archived":false,"fork":false,"pushed_at":"2026-05-12T02:36:39.000Z","size":93214,"stargazers_count":5,"open_issues_count":2,"forks_count":24,"subscribers_count":10,"default_branch":"develop","last_synced_at":"2026-05-12T02:39:12.074Z","etag":null,"topics":["api","eao","mongoose","nodejs","openshift","rc-falcon-general"],"latest_commit_sha":null,"homepage":"https://projects.eao.gov.bc.ca/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bcgov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2018-12-21T00:46:01.000Z","updated_at":"2026-05-12T02:29:13.000Z","dependencies_parsed_at":"2024-02-22T22:26:11.618Z","dependency_job_id":"f4b9fd6c-6b21-41df-b6db-0517b2ef4af9","html_url":"https://github.com/bcgov/eagle-api","commit_stats":{"total_commits":1046,"total_committers":36,"mean_commits":"29.055555555555557","dds":0.6959847036328872,"last_synced_commit":"b6a39e6f4ec537b686e341cacfd53a6af47302fb"},"previous_names":[],"tags_count":54,"template":false,"template_full_name":null,"purl":"pkg:github/bcgov/eagle-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcgov%2Feagle-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcgov%2Feagle-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcgov%2Feagle-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcgov%2Feagle-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bcgov","download_url":"https://codeload.github.com/bcgov/eagle-api/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcgov%2Feagle-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33049954,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"online","status_checked_at":"2026-05-14T02:00:06.663Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","eao","mongoose","nodejs","openshift","rc-falcon-general"],"created_at":"2026-02-11T21:06:32.527Z","updated_at":"2026-05-15T01:29:00.873Z","avatar_url":"https://github.com/bcgov.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bcgov / eagle-api\n\n[![Lifecycle:Stable](https://img.shields.io/badge/Lifecycle-Stable-97ca00)](https://github.com/bcgov/repomountie/blob/master/doc/lifecycle-badges.md)\n\nAPI for acting as a central authenticated data service for all EPIC front-ends\n\n## Documentation\n\nAll documentation has been consolidated in the [Eagle Documentation Wiki](https://github.com/bcgov/eagle-dev-guides/wiki):\n\n* **[API Architecture](https://github.com/bcgov/eagle-dev-guides/wiki/API-Architecture)** - Service map, routing patterns, and request flow\n* **[Configuration Management](https://github.com/bcgov/eagle-dev-guides/wiki/Configuration-Management)** - ConfigService pattern and environment variables\n* **[Analytics Architecture](https://github.com/bcgov/eagle-dev-guides/wiki/Analytics-Architecture)** - Penguin Analytics integration\n* **[API Deployment](https://github.com/bcgov/eagle-dev-guides/wiki/API-Deployment)** - Deployment workflows and procedures\n* **[Deployment Pipeline](https://github.com/bcgov/eagle-dev-guides/wiki/Deployment-Pipeline)** - CI/CD workflows and image tagging\n* **[Rollback Procedures](https://github.com/bcgov/eagle-dev-guides/wiki/Rollback-Procedures)** - How to rollback deployments\n* **[Troubleshooting](https://github.com/bcgov/eagle-dev-guides/wiki/Troubleshooting)** - Common issues and solutions\n\n## Related projects\n\nEagle is a revision name of the EAO EPIC application suite.\n\nThese projects comprise EAO EPIC:\n\n* \u003chttps://github.com/bcgov/eagle-api\u003e\n* \u003chttps://github.com/bcgov/eagle-public\u003e\n* \u003chttps://github.com/bcgov/eagle-admin\u003e\n* \u003chttps://github.com/bcgov/eagle-mobile-inspections\u003e\n* \u003chttps://github.com/bcgov/eagle-reports\u003e\n* \u003chttps://github.com/bcgov/eagle-helper-pods\u003e\n* \u003chttps://github.com/bcgov/eagle-dev-guides\u003e\n* \u003chttps://github.com/bcgov/eao-nginx\u003e (rproxy reverse proxy)\n* \u003chttps://github.com/bcgov/penguin-analytics\u003e (analytics service)\n\n## Quick Start\n\n**Requirements**: Node 22.x, Docker\n\n```bash\n# 1. Install dependencies\nyarn install\n\n# 2. Configure environment\ncp .env.example .env\n\n# 3. Start MongoDB\nyarn db:up\n\n# 4. Start the API\nyarn start\n```\n\nAPI available at `http://localhost:3000`\nSwagger UI at `http://localhost:3000/api/docs/`\n\nFor watch mode (auto-restart on changes): `yarn start-watch`\n\nTo stop MongoDB: `yarn db:down`\n\n## Deployment\n\nFor deployment procedures, Helm charts, and CI/CD workflows, see the [Deployment Guide](https://github.com/bcgov/eagle-dev-guides/wiki/Deployment-Pipeline) in the Eagle documentation wiki.\n\n## Database\n\nOne can run the EPIC applications on two kinds of data; generated and backed-up-from-live.\n\nGenerated data will typically be cleaner as it is generated against the latest mongoose models.  Generated data also does not require transferring PI to dev machines.  Live production dumps should only be used in situations where a particular bug cannot be replicated locally, and after replicating, the data generators and unit tests should be updated to include that edge case.\n\n#### Generate data\n\nDescribed in [generate README](generate.md)\n\n#### Restoring from a live backup\n\nAcquire a dump of the database from one of the live environments.\n\nTo restore a dump into your local MongoDB:\n\n```bash\n# Drop the existing database (destructive!)\nmongosh --eval 'use epic; db.dropDatabase()'\n\n# Restore from a dump directory\nmongorestore -d epic epic/\n\n# Or restore from a gzipped archive\nmongorestore --gzip --archive=epic-dump.tar.gz\n```\n\n#### Restore into the docker compose container (recommended)\n\nWith `yarn db:up` running, pipe a mongodump archive directly into the container:\n\n```bash\n# From a mongodump --archive file\nyarn db:restore \u003c epic-prod-dump.archive\n\n# Or stream directly from a live environment\nmongodump --uri=\"\u003csource-uri\u003e\" --archive | yarn db:restore\n```\n\nThe `db:restore` script runs `mongorestore --drop` inside the container, so it\nreplaces any existing data. The volume (`eagle-api_mongodb-data`) persists across\n`yarn db:down` / `yarn db:up` restarts.\n\n\n### Database Conversions\n\nIn the process of developing this application, we have database conversion scripts that must be run in order to update the db model so that the newest codebase can work properly.  There are currently two methods of doing the database conversion depending on how long-lived and memory intensive the conversion is.\n\n### Method 1: db-migrate\n\n### Method 2: node scripts named migration* in the root folder\n\n### Method 1\n\nSee \u003chttps://www.npmjs.com/package/db-migrate\u003e for documentation on running the db migrate command.  General use case for local development at the root folder:\n\n```./node_modules/db-migrate/bin/db-migrate up```\n\nFor dev/test/prod environments, you will need to change the database.json file in the root folder accordingly and run with the --env param.  See \u003chttps://www.npmjs.com/package/db-migrate\u003e for more information.\n\n### Method 2\n\nIn the root folder, there are files named migrateDocuments*.js.  These are large, long-running, memory intensive scripts that operated on the vast majority of the EPIC documents.  As a result, db-migrate was slow and unreliable given the nature of the connection to our database.  As a result, these nodejs scripts operate using the mongodb driver in nodejs and can handle a more complicated, robust approach to doing the database conversion.  They can be run from your local machine as long as there is a ```oc port-forward``` tunnel from your machine to the openshift mongdb database.  Change the user/pass/port/host/authenticationDatabase params and the script will execute against the mongodb pod directly.\n\n## Developing\n\nSee [Code Reuse Strategy](https://github.com/bcgov/eagle-dev-guides/dev_guides/code_reuse_strategy.md)\n\n## Environment Variables\n\nSee `.env.example` for all available environment variables with descriptions and local defaults.\n\nKey variables for local development:\n- `KEYCLOAK_ENABLED=false` — disables Keycloak, uses local JWT with `SECRET`\n- `MONGODB_SERVICE_HOST=localhost` — MongoDB host (default: localhost)\n- `MONGODB_DATABASE=epic` — database name\n\nFull reference: [Configuration Management](https://github.com/bcgov/eagle-dev-guides/wiki/Configuration-Management) wiki.\n\n## Database Operations\n\n### Enable MET Comment Periods for Project\n1. Connect to Open Shift by copying login command\n2. Choose project and get Pods\n\t`oc get pods`\n3. Port-forward \n\t`oc port-forward eagle-api-mongodb-5-tj22g 5555:27017`\n4. Connect to db with mongoshell\n\t`mongo \"mongodb://admin:pw@localhost:27017/epic?authSource=admin\"`\n5. Query for project \n  Eg.\t`db.epic.find({_id : ObjectId(\"65c661a8399db00022d48849\")})`\n6. Set `hasMetCommentPeriods` to `true` for the project. \n  Eg.\t`db.epic.updateOne( { _id: ObjectId(\"65c661a8399db00022d48849\") }, { $set: { \"legislation_2018.hasMetCommentPeriods\": true } })`","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbcgov%2Feagle-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbcgov%2Feagle-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbcgov%2Feagle-api/lists"}