Program registration platform for Social Diversity for Children Foundation.
Currently in development!
This project was generated with superplate.
Project Lead: Rickson Yang
Product Manager: Emily Nairn
Designers: Rebecca Ma, Vedant Patel
Developers: Matthew Geng, Neel Ismail, Amy Li, Greg Maxin, Brandon Wong, Kevin Zhang
Project Lead: Eric Feng
Product Manager: Raewyn Tsai
Designers: Stacy Kwok, Christina Ru
Developers: Jason Huang, Soha Khan, Cindy Wang, Brandon Wong, Victor Yun, Mahad Zaryab
- NodeJS application powered by the Next.JS framework
- Prisma ORM for PostgreSQL
- Chakra UI for building accessible and responsive frontend components
- i18next for internationalization and translations, specifically next-i18next
- NextAuth.js for authentication
- Service: Amazon S3 for file storage
- Service: Amazon SES for email service
- Service: Amazon Lambda and Amazon Cloudwatch for notification mailing
- Service: Amazon Systems Manager for Storing one-time dynamic links
- Service: Stripe for Class payment and product/coupon management
- Service: Railway for deployment and database hosting
- Service: Heroku for PostgreSQL DB hosting
- Unstated Next for state management
- SWR React Hook library for data fetching
.
βββ .github
β βββ workflows # Github workflows
β βββ pull_request_template.md # PR template
β
βββ pages # Pages
β βββ _app.tsx
β βββ api # API routes
β βββ index.tsx
β
βββ prisma # Prisma ORM
β βββ dev-seeds # seeding data for dev environment
β βββ migrations # migrations for production
β βββ schema.prisma # Prisma Schema
β βββ schema.sql # SQL Schema
β βββ seed.ts # utility to script dev environment
β
βββ public
β βββ icons # Icons
β βββ locales # Translations
β
βββ models # Typescript types
β
βββ src # Frontend tools
β βββ components # Components
β βββ definitions # Chakra
β βββ styles # CSS and Colours
β
βββ terraform # Infrastructure as code for dev and prod
β βββ environments # code separated by environments
β βββ modules # terraform modules for reuse
β
βββ types # Dependency types
β
βββ utils # Utility functions
β βββ containers # unstated-next containers
β βββ enum # enum utils
β βββ hooks # SWR API hooks
β βββ mail # SES mailing templates
β βββ request # API request utils
β βββ session # Session and authorization utils
β βββ time # time and date utils
β βββ toast # Chakra UI Toast msg utils
β βββ validation # Data/Input Validators
β
βββ services # Third party services
β βββ auth
β βββ aws
β βββ database
β βββ nodemailer
β βββ stripe
β
# Misc individual files
βββ .babelrc
βββ .eslintignore
βββ .env.sample # required env vars
βββ .gitattributes
βββ .gitignore
βββ .prettierignore
βββ .prettierrc
βββ LICENSE
βββ README.md
βββ next-i18next.config.js
βββ next-env.d.ts
βββ next.config.js
βββ package.json
βββ tsconfig.json
βββ yarn.lock
Reset your database on Heroku and then deploy your database schema run (one-time):
# 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
# optional - `npx prisma introspect`
npx prisma generate
# Seed your database with sample data
npx ts-node -O {\"module\":\"CommonJS\"} prisma/seed.ts
To run the application:
# Install dependencies
yarn
# Run locally
yarn dev
Linters run automatically as a pre-commit hook on edited .js, .jsx, .ts, .tsx
files you edit and commit
To run the linters manually:
# Runs linting
yarn lint
# Correct linting issues
yarn fix
NOTE: Before applying your migrations a production environment, ensure the diff via npx prisma db pull
and npx prisma migrate status
lines up with the migrations to be applied.
To migrate a database schema without losing data:
- change both the
schema.sql
andschema.prisma
file as required - run
prisma migrate dev --name <DESCRIPTIVE_NAME> --create-only
(this will require a shadow database) - after the migration is approved, run
npx prisma migrate deploy
to apply all new migrations
Baseline environment:
Baselining initializes a migration history for databases that contain data and cannot be reset - such as the production database. Baselining tells Prisma Migrate to assume that one or more migrations have already been applied. Run the following command to baseline for each of the required migration: prisma migrate resolve --applied <MIGRATION_FOLDER_NAME>
For more info, please reference: Adding Prisma Migrate to an existing project
Deployments occur automatically on push to main and staging branches through Railway.