Admin-managed hackathon scoring with live public leaderboards. Built with Next.js (App Router) + Neon Postgres, deployed on Vercel.
- Admins create hackathons, teams, tasks/challenges, and award points (task completions or ad hoc awards with a description).
- Every point change is logged in an activity history per team.
- Each hackathon has a unique public UUID link showing a live leaderboard that auto-refreshes (default every 30s, no page reload), optimized for full-screen display, with light/dark mode. Click a team to see its full point history with timestamps.
-
In Vercel, open your project → Storage → Create Database Store → Neon (Marketplace integration) and connect it to your Neon project. Vercel injects
DATABASE_URL(pooled) andDATABASE_URL_UNPOOLEDautomatically at runtime. -
The schema is applied automatically: on the first database access, the app checks whether the tables exist and runs the idempotent schema (
lib/schema.ts) if they don't. No manual setup needed. -
To apply the schema manually instead (optional), run once:
psql "$DATABASE_URL_UNPOOLED" -f schema.sql # or: npm run db:setup
(Get
DATABASE_URL_UNPOOLEDfrom the Neon dashboard → your project → Connect → direct connection string.)
Note: auto-setup only creates missing tables — it never alters existing ones. If the schema changes in a future version, apply the migration manually.
Copy .env.example to .env.local for local development, and set the following in Vercel → Settings → Environment Variables:
| Variable | Purpose |
|---|---|
DATABASE_URL |
Neon pooled connection string (auto-set by the Marketplace integration) |
DATABASE_URL_UNPOOLED |
Neon direct connection string, used only for applying schema.sql |
ADMIN_PASSWORD |
Shared admin password for /admin/login |
JWT_SECRET |
Secret for signing the admin session JWT (openssl rand -base64 32) |
LEADERBOARD_REFRESH_MS |
Optional. Leaderboard auto-refresh interval in ms (default 30000) |
npm install
npm run devVisit http://localhost:3000, go to /admin/login, and log in with ADMIN_PASSWORD.
Push to main — Vercel deploys automatically. Make sure the env vars above are set in the Vercel project.
- Log in at
/admin/loginand create a hackathon. - Add teams and tasks/challenges with point values.
- Mark tasks complete for teams or award ad hoc points (with a required description). Every award is logged in the activity history.
- Set the hackathon status to active and share its public link (
/h/<uuid>, shown on the admin page). - The public leaderboard auto-refreshes every 30s (configurable), works great on a full-screen display, and clicking a team opens its detailed point history.
- Single shared password (
ADMIN_PASSWORD) → JWT session cookie (HttpOnly, SameSite=Lax, 7-day expiry), signed withJWT_SECRET. proxy.tsguards all/adminroutes; every write server action additionally callsrequireAdmin()(defense in depth).
- Scores are derived from the unified
point_eventslog: cumulative points =SUM(points)per team; the leaderboard ranks by that total (tie-break: team name A→Z). - Task completions are unique per (team, task); deleting a point event removes the linked achievement via cascade.
- Only hackathons with status
activeare publicly visible (admins can preview drafts).