Backend API for HackDay Hackathon Management Platform with RBAC and dual-track participation.
- Node.js + Express
- PostgreSQL (NeonDB)
- Prisma ORM
- JWT Authentication
npm installCopy .env.example to .env and update with your values:
cp .env.example .envUpdate the following:
DATABASE_URL: Your NeonDB connection stringJWT_SECRET: A secure random stringFRONTEND_URL: Your frontend URL (for CORS)
# Generate Prisma client
npm run prisma:generate
# Run migrations
npm run prisma:migrate
# (Optional) Open Prisma Studio to view/edit data
npm run prisma:studioAfter running migrations, you need to create an admin account manually in the database:
INSERT INTO users (id, email, password, role, created_at, updated_at)
VALUES (
gen_random_uuid(),
'admin@hackday.com',
-- Password: 'admin123' (hashed with bcrypt)
'$2a$10$YourHashedPasswordHere',
'ADMIN',
NOW(),
NOW()
);Or use Prisma Studio to create the admin user.
Development mode (with auto-reload):
npm run devProduction mode:
npm startPOST /login- Login (all roles)POST /logout- LogoutGET /profile- Get current user profile
POST /users- Create team/judge accountGET /users- Get all usersPOST /problem-statements- Create problem statementGET /problem-statements- Get all problem statementsPUT /problem-statements/:id- Update problem statementDELETE /problem-statements/:id- Delete problem statementPOST /toggle-submissions- Open/close submissionsPOST /toggle-leaderboard- Show/hide leaderboardGET /system-config- Get system configurationGET /teams- Get all teams with progressGET /leaderboard- Get master leaderboard
PATCH /select-track- Select track (Agentic AI or Open Innovation)GET /me- Get team data and scoresPOST /submit- Submit projectGET /problem-statements- Get problem statementsGET /leaderboard- Get leaderboard (if visible)
GET /teams- Get all teams for judgingGET /teams/:teamId- Get specific team projectPOST /score- Submit/update score for a teamGET /my-scores- Get judge's own scores
- Admin, Team leaders, and Judges
- Team information with track selection
- Custom tech stack and tags for Open Innovation
- Admin-created problems for Agentic AI track
- Team project submissions (GitHub, demo, PPT, video)
- Judge scores with criteria breakdown
- Global settings (submissions open/closed, leaderboard visibility)
- Create a new project on Railway
- Add NeonDB as a service (or use external NeonDB)
- Add environment variables from
.env.example - Deploy from GitHub or using Railway CLI
- Run migrations:
railway run npm run prisma:migrate
- Always use HTTPS in production
- Set
COOKIE_SECURE="true"in production - Use a strong
JWT_SECRET - Regularly update dependencies