- The user sends a command to the Discord bot with the email they claim to have used
- The bot uses AWS SES to send the email using Mustache templates and Juice to inline CSS
- The email contains a link to
verify.jamhacks.ca/verify/:data
, where data is essentially a glorified JWT token encoded withbase64-url
and signed with HMAC SHA to ensure the integrity of the data
- The email contains a link to
- The user clicks the link in their email
- The link data is verified and decoded, and using Mustache templates, a response is rendered from the server
- The user's Discord details are added to the database
- The Discord service also runs a simple HTTP server locally. A request is given to this server so roles and nickname of the user can be changed, and a DM is sent to the user
- This codebase is organized as a monorepo, with the usual
packages
directory replaced withservices
- Typescript
- For Docker: Docker doesn't allow copying outside of CWD, and doesn't follow symlinks outside the CWD, so there are 3 copies of the Prisma schema located in each service. Hard link them with:
ln -vf schema.prisma services/sync/schema.prisma; ln -vf schema.prisma services/discord/schema.prisma; ln -vf schema.prisma services/web/schema.prisma
- Run the setup script
./setup.bash
. If you can't, follow the below steps- Packages are managed with
pnpm
. Install withnpm i -g pnpm
if you haven't already - Run
pnpm install
to install dependencies - All
.env
files are encrypted with gpg. You can decrypt withgpg .env.gpg
and enter the password - The Prisma client needs to be built and rebuilt with every migration. You can do this with
pnpm prismaGenerate -r
- Packages are managed with
- Discord: The Discord bot lives here. There's an HTTP server which only runs on localhost, which is used to complete the verification process by assigning roles and nicknames, and can be used to fetch user info.
- Web: the web page that runs on Mustache templates and ExpressJS for SSR
- Sync: Periodically syncs the spreadsheet(s) with the database. This approach is used because interactions with the spreadsheet may be rate limited and/or slow.