Skip to content

Richmond Centre for Disability platform for accessible parking permit applications

License

Notifications You must be signed in to change notification settings

uwblueprint/richmond-centre-for-disability

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Richmond Centre for Disability

Richmond Centre for Disability's (RCD) platform for people with disabilities to apply for accessible parking permits (APP) in Richmond, BC. The app consists of an applicant-facing application portal and an internal user/APP management portal.

General Architecture

  1. NodeJS application powered by the NextJS framework.
  2. Apollo for GraphQL server and client.
  3. Chakra UI for building accessible and responsive frontend components.
  4. Prisma ORM for PostgreSQL.
  5. i18next for internationalization and app translations.
  6. Service: Amazon SES for outbound email service.
  7. Service: Railway for application and database deploys.

Project structure

.
├── components # Project components
│   └── Layout.tsx
├── containers # State containers
├── lib # Library
│   ├── graphql # Global GraphQL setup
│   └── scripts # Scripts
├── pages # Pages
│   ├── _app.tsx
│   ├── api # API routes
│   └── index.tsx
├── prisma # Prisma ORM
│   └── schema.prisma # Prisma Schema
├── public
│   ├── assets # Assets
│   └── locales # Translations
├── tools # Tools that are not central to an app module (more frontend-heavy)
│   ├── pages # Tools for pages
│   └── components # Tools for components
# Misc individual files
├── .env.sample # Sample .env file
├── README.md
├── apollo.config.js
├── codegen.yml
├── next-env.d.ts
├── next-i18next.config.js
├── next.config.js
├── package.json
├── tsconfig.json
└── yarn.lock

Run locally

  1. Start database
docker-compose up --build
  1. Run the application
yarn install
npx prisma generate
yarn dev
  1. Deploy prisma schema
npx prisma migrate deploy
  1. Reset and seed database (ensure node is v14.17.0 or else it will stall)
npx prisma migrate reset
  1. Verify database
docker exec -it rcd_db bash -c "psql -U postgres -d rcd"

Migrations

To create a new migration (after making changes to the Prisma schema):

npx prisma migrate dev --name <migration-name> --create-only

Run locally (Heroku)

Duplicate .env.sample to .env and configure environment variables.

To deploy your database schema, run:

yarn reset-db YOUR_APP_NAME

or if that doesn't work, run the steps manually:

# Drop all tables from current Heroku Postgres database
heroku pg:reset -a YOUR_APP_NAME

# Deploy schema.sql to Heroku Postgres
heroku pg:psql -a YOUR_APP_NAME -f prisma/schema.sql

# Regenerate Prisma schema and client
npx prisma db pull && npx prisma format && npx prisma generate

# Seeding the database with sample data
npx prisma db seed --preview-feature

To run the application:

# Install dependencies
yarn

# Run locally
yarn dev

Development

After making changes to GraphQL schema, automatically generate the TypeScript types:

yarn generate-graphql-types

Railway provides deploys for every PR!

Deploy

Deployment occurs automatically on push to the Main and Staging branches. Railway handles the continuous deployment of these branches.

License

MIT