Student registration and profile app for ESC, Faculty of Engineering,
Chulalongkorn University. Students sign in with their university Google
account (@student.chula.ac.th); data is stored in MongoDB Atlas; the app
deploys on Vercel.
- Next.js 14 (App Router) + TypeScript + Tailwind / shadcn-ui
- NextAuth (Auth.js) v5 with Google sign-in, restricted to
@student.chula.ac.th(student ID is derived from the email local part) - MongoDB Atlas via Mongoose — single
studentscollection - Deployed on Vercel (preview per PR, production on merge to
main)
- Copy
.env.exampleto.envand fill it in:AUTH_SECRET— generate withopenssl rand -base64 32AUTH_GOOGLE_ID/AUTH_GOOGLE_SECRET— a Google OAuth 2.0 Client ID (Web application) from the Google Cloud console with authorized redirect URIhttp://localhost:3000/api/auth/callback/google(andhttps://<production-domain>/api/auth/callback/googlein production)MONGODB_URI— a MongoDB Atlas connection string including the database name, e.g..../intania-registration
- Install and run:
pnpm install
pnpm devNote: only @student.chula.ac.th Google accounts can sign in. To test
locally you need a Chula student account, or temporarily change
ALLOWED_EMAIL_DOMAIN in src/lib/auth-shared.ts (do not commit that).
- Create a free (M0) cluster — region Singapore (
ap-southeast-1) to match Vercel'ssin1. - Create a database user, and under Network Access allow
0.0.0.0/0(Vercel functions have no fixed IP). - Put the connection string in
MONGODB_URI(local.envand Vercel project env vars).
Departments, religions, and family statuses live in src/data/*.ts and can
be edited directly. Thai provinces/districts and countries are generated:
node scripts/generate-geo-data.mjs && pnpm formatpnpm typecheck && pnpm lint && pnpm test && pnpm build