The frontend for the NUSCC Website.
- Frontend: Next.js, React, TypeScript
- Database: Prisma, Supabase
- Styling: Tailwind CSS, Shadcn UI components
- Node.js (v22+)
- pnpm
- Any tool to expose localhost to https endpoints, such as ngrok or tunnl.gg
- This guide will be assuming you are using ngrok
-
Set up your Telegram dev bot
- Go to @BotFather on Telegram
- Run
/newbot - Enter a username for the bot (e.g. nusc_web_dev_bot) -> BotFather will send with a BOT_TOKEN e.g. XXXXXXXX
- In your
.envfile, set the following variables:- Set
BOT_TOKENwith the token given by @BotFather - Set
NEXT_PUBLIC_TELEGRAM_LOGIN_BOTwith your bot username
- Set
-
Clone the repository:
git clone https://github.com/usdevs/NUSCweb cd NUSCweb -
Install dependencies:
pnpm install
-
Generate a JWT key pair for authentication:
openssl genrsa -out private.pem 2048 openssl rsa -in private.pem -pubout -out public.pem
Then set the following in your
.envfile:JWT_PRIVATE_KEY=$(python -c "f=open('private.pem').read().strip(); print(f.replace(chr(10), r'\n'))") JWT_PUBLIC_KEY=$(python -c "f=open('public.pem').read().strip(); print(f.replace(chr(10), r'\n'))")
-
Setup your remaining environment variables in
.envfile, with.env.examplefor reference -
Expose your localhost port:
ngrok http 3000
- Retrieve your custom HTTPS URL (e.g. https://xxx.ngrok.io)
- In @BotFather, run
/setdomain, choose your nusc dev bot, and enter the ngrok URL
-
Run the development server:
pnpm dev
-
Access our dev server via the ngrok HTTPS URL (e.g. https://xxx.ngrok.io)
- If you see "Bot domain invalid" on the top nav bar, ensure your accessing your dev environment via the ngrok HTTPS URL, not your localhost