Pubcode
This repository will house all the source code and artifacts related to public code asset management of BCGov.
Install / Use
/learn @bcgov/PubcodeREADME
<!-- PROJECT SHIELDS -->
BCGov public code asset tracking
This contains schema definitions for yml and a web application to assist end users to create/edit bcgovpubcode.yml files, store them in a MongoDB database and retrieve them using a Node/Express API.
Architecture
FAQ
Please click here
Components
- Database (MongoDB): Stores all bcgovpubcode.yml files, converted to JSON, for each participating repo in the bcgov organization.
- Backend (Node/Express API): Provides read and write access to the database. The read endpoint is open to the public, while the write endpoint is protected by an API key. Both are rate-limited.
- Crawler (Node module): Crawls through GitHub repos on a schedule, collects any bcgovpubcode.yml files, converts to JSON, and stores using the API's write endpoint.
- Frontend (React.js and MaterialUI): Allows users to create bcgovpubcode.yml files or edit existing ones using a GitHub link.
- Schema (JSON Schema): The standard on which the bcgovpubcode.yml file is based.
How it works
- The Crawler runs in a scheduled GitHub Action, collecting bcgovpubcode.yml files from participating GitHub repositories.
- Yaml is converted to JSON and sent to the API's write endpoint, which is secured with an API key.
- The API stores to the MongoDB database.
- Users can access all data from the API's read endpoint.
- Frontend allows users to create or edit bcgovpubcode.yml files, which are validated against the JSON schema.
Note
Only the Crawler module is allowed to call the APIs post endpoint, which uses the MongoDB as its source of truth.
sequenceDiagram
participant Crawler
participant API
participant MongoDB
participant Frontend
participant JSON Schema
participant GitHub Repos
Crawler->>GitHub Repos: Crawls through
GitHub Repos->>Crawler: Collects bcgovpubcode.yml files
Crawler->>API: Calls the secured post endpoint
API->>MongoDB: Stores JSON data
Frontend->>JSON Schema: Uses as standard to create or edit bcgovpubcode.yml files
More Information
Please see README.md files in each component's folder to learn more.
