Skip to content

bcgov/citz-imb-playground

Repository files navigation

BCGov CITZ IMB Playground

Lifecycle:Experimental License

NodeJS Typescript React Express Postgres


TL/DR

Set up by following the steps at Basic Setup Guide.

What is this app for? - Used to test CITZ IMB node packages.


Table of Contents

General Information

  • Running on a NodeJS:20 with React, Express, and Postgres.
  • Used to test CITZ IMB node packages.


Basic Setup Guide

  1. Create a .env file based on the example.env file.

  2. Run npm run up to start the app.

Return to Top


Directory Structure

.
├── .github/
|   ├── config/
|   |   └── dep-report.json5                # Configure options for NPM Dep Report.
|   ├── helpers/
|   |   ├── github-api/                     # Functions to access the GitHub API.
|   |   ├── create-npm-dep-report-issues.js # Creates GitHub Issues for Npm Dep Reports.
|   |   ├── create-npm-dep-report.js        # Creates text bodies for Npm Dep Reports.
|   |   ├── parse-json5-config.js           # Parses json5 files for GitHub actions output.
|   |   └── parse-npm-deps.js               # Parses package.json files for changes to package versions.
|   ├── workflows/
|   |   └── npm-dep-report.yaml             # Reports on new package versions.
├── src/
|   ├── backend/                            # Express API.
|   |   ├── scripts/                        # Utility scripts used to run the server.
|   |   ├── src/                             
|   |   |   ├── migrations/                 # Migrations on database (check src/backend/README).
|   |   |   ├── modules/                    # Modules of functionality (routes, controllers, entities, services).
|   |   |   └── utils/                      # Utility functions for the express api.
|   |   ├── config.ts                       # Utilizes env vars and exports common variables.
|   |   ├── dataSource.ts                   # Connection to database and configuration with typeorm.
|   |   ├── express.ts                      # Express configuration and base route configuration.
|   |   ├── index.ts                        # Server and database connection initialization.
|   |   └── package.json                    # Configure packages.
|   ├── frontend/                           # React.
|   |   ├── src/                             
|   |   |   ├── assets/                     # Images.
|   |   |   ├── components/                 
|   |   |   |   ├── common/                 # Common or reusable visual components.
|   |   |   |   ├── icons/                  # Icons as svg components.
|   |   |   |   └── layout/                 # Layout components like PageLayout.
|   |   |   ├── css/                        # Base styles and variables.
|   |   |   ├── pages/                      # Page components.
|   |   |   ├── AppRouter.tsx               # Router for loading pages at routes.
|   |   |   ├── global.d.ts                 # Global type declarations (used for config endpoint).
|   |   |   └── main.tsx                    # Main JavaScript run in index.html.
|   |   ├── index.html                      # Set web app meta data and title.
|   |   ├── nginx.conf                      # Configure proxy pass for prod build.
|   |   ├── package.json                    # Configure packages.
|   |   └── vite.config.ts                  # Configure vite server and proxy pass for dev build.

Return to Top


Git Aliases

These aliases are available within the repository.

# List all available aliases.
$ git aliases
# Amend staged changes to the last commit without changing the commit message.
$ git amend
# Undo the last commit and bring it's changes back into the staging area.
$ git undo-last-commit-soft
# Undo the last commit and discard it's changes.
$ git undo-last-commit-hard

Return to Top


Scripts

# Start the web app (ensure env vars set).
$ npm run up
# Stop the web app.
$ npm run down
# Prune all containers, images and volumes.
$ npm run prune
# Clean install packages in frontend and backend (requires prune and up to affect live site).
$ npm run install
# Clean install packages in frontend (requires prune and up to affect live site).
$ npm run install:frontend
# Clean install packages in backend (requires prune and up to affect live site).
$ npm run install:backend
# Prunes, clean installs packages, and rebuilds containers.
$ npm run rebuild
# Shell into frontend container.
# Type 'exit' + ENTER to exit shell.
$ npm run shell:frontend
# Shell into backend container (used when working with migrations).
# Type 'exit' + ENTER to exit shell.
$ npm run shell:backend
# Shell into database container.
# Type 'exit' + ENTER to exit shell.
$ npm run shell:database

Return to Top


Included Packages

Return to Top