Full-stack club management platform for handling authentication, membership applications, members, events, notices, payments, testimonials, committee sessions, and contact messages.
This repository contains the backend API. The frontend connects to this service through the exposed REST endpoints and Better Auth routes.
The project is designed as a club portal for students and administrators.
- Public website pages for home, about, committee, testimonials, notices, and events
- Authentication screens for sign up, sign in, email verification, and password reset
- User dashboard for profile management, membership application, event registration, testimonials, and contact messages
- Admin dashboard for reviewing applications, managing users, publishing notices, managing committee sessions, and verifying event payments
- Session-based authentication with
better-auth - Role-based access control for
SUPER_ADMIN,ADMIN,EVENT_MANAGER,MEMBER, andUSER - Membership application review flow with approval and rejection support
- Member profile and account profile management
- Event management, registration, and payment verification flow
- Notice publishing for different audience groups
- Site settings management for homepage, about page, FAQs, impact stats, committee members, and testimonials
- Contact message submission and admin review
- Image upload support with Multer + Cloudinary
- Email workflows for verification, reset password, application updates, and payment receipts
- Any SPA or SSR client can consume this API
- Expected to use the backend base URL in its environment configuration
- Uses cookie-based authenticated requests with
credentials: include
- Node.js 22
- Express 5
- TypeScript
- PostgreSQL
- Prisma
- Better Auth
- Zod
- Nodemailer
- Cloudinary
- Stripe
server_Club/
|-- prisma/
| |-- migrations/
| |-- schema/
| `-- seed.ts
|-- src/
| |-- config/
| |-- lib/
| |-- middlewares/
| |-- modules/
| |-- routes/
| |-- templates/
| |-- utils/
| |-- app.ts
| `-- server.ts
|-- .env.example
|-- package.json
|-- render.yaml
`-- README.md
auth- register, login, logout, session, email verification, password reset, Google auth supportaccount- logged-in user profile read and updateapplications- membership application create, list, details, reviewmembers- member listing, details, profile updatesevents- public event listing, event CRUD, registration, payment-failed reportingregistrations- registration list, cancel, payment verificationnotices- notice CRUD with audience targetingdashboard- admin and member dashboard datasettings- public site settings and admin upsertuploads- authenticated image uploadusers- admin user management and role updatestestimonials- public testimonials, user submissions, admin reviewcommittee- public committee data and super admin committee managementcontacts- message submission, user history, admin reviewpayments- Stripe webhook handling
Local backend base URL:
http://localhost:5000/api/v1
Auth base path:
http://localhost:5000/api/v1/auth
POST /api/v1/auth/registerPOST /api/v1/auth/loginPOST /api/v1/auth/logoutGET /api/v1/auth/session
GET /api/v1/account/profilePATCH /api/v1/account/profilePOST /api/v1/applicationsGET /api/v1/applicationsGET /api/v1/applications/:idPATCH /api/v1/applications/:id/reviewGET /api/v1/membersGET /api/v1/members/:idPATCH /api/v1/members/:id
GET /api/v1/eventsGET /api/v1/events/:idPOST /api/v1/eventsPATCH /api/v1/events/:idDELETE /api/v1/events/:idPOST /api/v1/events/:id/registerPOST /api/v1/events/:id/payment-failedGET /api/v1/registrationsPATCH /api/v1/registrations/:id/verify-paymentPATCH /api/v1/registrations/:id/cancel
GET /api/v1/noticesPOST /api/v1/noticesPATCH /api/v1/notices/:idDELETE /api/v1/notices/:idGET /api/v1/dashboard/adminGET /api/v1/dashboard/memberGET /api/v1/settingsPUT /api/v1/settingsPOST /api/v1/uploads/imageGET /api/v1/usersPATCH /api/v1/users/:id/role
GET /api/v1/testimonialsGET /api/v1/committee/public
POST /api/v1/contactsGET /api/v1/contacts/mineGET /api/v1/contacts/adminPATCH /api/v1/contacts/:id/review
POST /api/v1/payments/stripe/webhook
The backend uses better-auth with cookie-based sessions.
SUPER_ADMINADMINEVENT_MANAGERMEMBERUSER
- Email and password authentication
- Email verification
- Password reset by email
- Optional Google sign-in when Google credentials are configured
- Secure cookies in production
- Trusted frontend origins through
CLIENT_URLandCLIENT_URLS
To connect the frontend with this backend:
- Point frontend API calls to the backend base URL
- Send authenticated requests with cookies enabled
- Make sure the frontend origin is included in backend
CLIENT_URLorCLIENT_URLS - Use the backend auth endpoints directly for session-based login flow
- Handle email verification redirect through the frontend route
/verify-email?status=success
This backend already expects a frontend client URL and uses it in:
- CORS allow-list
- Better Auth trusted origins
- Email verification callback URLs
Use .env.example as the starting point.
NODE_ENV=development
PORT=5000
CLIENT_URL=http://localhost:3000
CLIENT_URLS=http://localhost:3000,https://xyztechclub.vercel.app
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/club_management
BETTER_AUTH_SECRET=replace-with-a-strong-secret
BETTER_AUTH_URL=http://localhost:5000
SMTP_HOST=
SMTP_PORT=
SMTP_USER=
SMTP_PASS=
SMTP_FROM=
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
CLOUDINARY_CLOUD_NAME=
CLOUDINARY_API_KEY=
CLOUDINARY_API_SECRET=
STRIPE_SECRET_KEY=
STRIPE_WEBHOOK_SECRET=pnpm installCreate .env from .env.example and set your values.
pnpm run generatepnpm run migratepnpm run seedpnpm run devpnpm run dev- run in watch modepnpm run start:dev- run once withtsxpnpm run build- generate Prisma client and build withtsuppnpm run start- run compiled serverpnpm run typecheck- TypeScript checkpnpm run lint- ESLintpnpm run lint:fix- ESLint auto fixpnpm run format- Prettier writepnpm run format:check- Prettier checkpnpm run check- typecheck + lint + format checkpnpm run migrate- Prisma migrate devpnpm run migrate:deploy- Prisma migrate deploypnpm run migrate:reset- reset databasepnpm run db:push- push schemapnpm run db:pull- pull schemapnpm run db:seed- seed databasepnpm run studio- open Prisma Studiopnpm run stripe:webhook- forward Stripe webhook to local backend
The seed script prepares:
- One super admin
- Additional admins and event managers
- Members, applicants, and general users
- Site settings content for homepage and about page
- Notices
- Events
- Committee sessions and assignments
- Testimonials
- Contact messages
Default seeded admin credentials:
Email: admin@club.com
Password: Admin12345
These can be overridden through seed environment variables.
helmetfor security headersexpress-rate-limiton API requests- CORS restricted to configured frontend origins
- Zod validation for body and query validation
- Central error handling
- Role-protected routes
- HTTP-only cookies in production mode
The repository includes render.yaml for backend deployment on Render.
pnpm run buildpnpm run migrate:deploy && pnpm start- Backend can be deployed on Render
- Frontend can be deployed separately, such as on Vercel
- Production frontend domain must be added to
CLIENT_URLorCLIENT_URLS
The server root returns a simple success response:
GET /
Response includes:
- server status
- current environment
- uptime
This project is a full-stack club management platform where:
- the frontend handles the user experience for public pages, dashboards, and admin panels
- the backend in this repository handles authentication, business logic, database access, email, uploads, and payments
If you also keep the frontend in a separate repository, this README can serve as the shared backend reference for both sides.