A full-stack event platform: organizers publish events and sell General and VIP tickets; attendees discover events, book seats, get QR-coded tickets, and review events they attended.
Live demo: https://event-hive-zeta.vercel.app
| Layer | Technology |
|---|---|
| Frontend | Next.js 16 (App Router, server components, CSS Modules), TypeScript, Phosphor icons, qrcode.react |
| Backend | Express 5, TypeScript, zod validation |
| Database | MongoDB with Mongoose (indexes enforce one ticket and one review per user per event) |
| Auth | JWT, stored in an httpOnly cookie on the Next.js origin and forwarded to the API by a same-origin proxy |
| Tests / CI | node:test API suite against a local MongoDB, GitHub Actions |
| Architecture | Layered (Controller → Service → Repository) with a single error middleware |
- Palette: the default light theme is colourful: each category owns one colour (music pink, tech blue, sports lime, art orange, food yellow, business violet, other teal) used on its cards, chips, rows and tickets, with ink buttons. The optional dark theme keeps a single stage-light magenta accent. Every text colour pair is at least 4.5:1; ratios are noted in
client/src/app/globals.css. - Type: Archivo (condensed via its width axis) for display, Geist for body and UI, Geist Mono for ticket codes.
- Signature: the admission ticket. Event cards, the booking panel, My Tickets and the organizer band use real notch cut-outs (CSS masks) and a perforated tear line.
- Motion: the landing page is deliberately loud: letters that pop in and jump under the cursor, a rotating colour-changing headline word, a cursor-following glow, parallax shapes, floating tickets with 3D tilt, magnetic buttons, crossing marquee bands, count-up stats, a pinned horizontal-scroll "Coming up" gallery, categories that slide in from alternating sides, a holographic organizer ticket whose stub tears on hover, and a rainbow scroll-progress bar, a live countdown sticker for the next event, a "Surprise Me" slot-machine pick with confetti, a statement whose words paint in as you scroll while event photos trail the cursor, and a sticky-stack "How it works" with live mini previews (chips, a stamped ticket, a scanning QR). Elsewhere: the theme switch grows out of its button as a circle (View Transitions API), confetti on a successful booking, event cards tilt toward the cursor, a navbar that turns into a glass pill on scroll, a card-to-page image morph (React
<ViewTransition>), and a stamp when a booking succeeds. All pure CSS plus one delegated pointer listener; everything settles underprefers-reduced-motion. - Photography: seed events and categories use subject-matched Unsplash photos (Unsplash License).
Browser ──► Next.js server ──► Express API ──► MongoDB
│ server components fetch data with the user's token
│ /api/* proxy forwards browser mutations and sets the auth cookie
└─ proxy.ts guards /dashboard and /bookings
- The browser never calls Express directly, so there is no CORS layer and the token never touches JavaScript.
POST /api/auth/loginand/registerreturn the user; the Next.js proxy keeps the token in an httpOnly cookie (SameSite=Lax, 7 days).- Public pages (home, events, event detail) are server-rendered with real metadata (title, description, Open Graph image).
- Every write is validated with zod on the server; unknown fields are stripped, so clients cannot set
organizerIdorbookedCount.
├── client/ # Next.js frontend
│ └── src/
│ ├── app/ # Routes (server components) + client islands
│ │ ├── api/[...path]/ # Same-origin proxy to the Express API (sets/clears the auth cookie)
│ │ ├── events/ # Listing with filters + pagination, event detail (booking, reviews)
│ │ ├── bookings/ # My tickets with QR codes and cancellation
│ │ ├── dashboard/ # Organizer: stats, create/edit events, attendees
│ │ └── auth/ # Login / register
│ ├── components/ # Navbar, Footer, EventCard, EventForm, ConfirmButton, …
│ ├── lib/ # server.ts (SSR fetch + session), api.ts (browser mutations), session.ts, categories.ts
│ ├── proxy.ts # Route protection (Next 16 "proxy", formerly middleware)
│ └── types/
├── server/ # Express backend
│ └── src/
│ ├── index.ts # App (exported for Vercel and tests); server.ts listens locally
│ ├── schemas.ts # zod request schemas
│ ├── config/ # Database singleton
│ ├── controllers/ # Thin: parse input, call a service, send JSON
│ ├── services/ # Business rules (ownership, booking and review rules)
│ ├── repositories/ # Mongoose queries
│ ├── models/ # User, Event, Booking, Review (+ indexes), Ticket factory
│ ├── middleware/ # auth (JWT), rbac, errorHandler
│ ├── interfaces/ # IPaymentGateway + mock gateways
│ ├── seed.ts # Demo data
│ └── tests/ # API tests (node:test)
├── .github/workflows/ci.yml
├── idea.md # Project concept document
└── *Diagram.* # UML diagrams (Class, ER, Sequence, Use Case)
- Discover: search, category and date filters (all in the URL), pagination, past events, "More like this" on every event, and a ⌘K / Ctrl+K quick search across events, categories and pages.
- Save: heart any event; saved events live on
/saved. - Book: General or VIP tickets, confetti on success, QR-coded tickets under My Tickets, cancellation with refund.
- Plan: add an event to Google Calendar or download an
.icsfile (Apple Calendar, Outlook); share via the native share sheet or copy the link. - Host: create and edit events, see revenue and sales, list attendees, and run a check-in desk at the door (type the code or scan the QR with the camera where the browser supports
BarcodeDetector); each ticket can only be admitted once. - Review: attendees rate events after they end.
- Check-in: only the event's organizer (or an admin) can admit tickets; codes are case-insensitive; the update is atomic so a ticket scanned twice is admitted once; cancelled tickets are refused.
- Booking: only published, upcoming events; one confirmed ticket per user per event (database unique index, race-safe); seats are decremented atomically and returned if anything fails after the decrement; VIP costs double; the mock payment's transaction id is stored and refunded on cancellation; no cancellation once the event has started.
- Reviews: only attendees with a confirmed ticket, only after the event has ended, one review per user; the endpoint returns the average and count.
- Events: organizers manage only their own events (admins can manage any); the attendee list (names, emails) is visible only to the event's organizer.
- Registration can only create
attendeeororganizeraccounts.
- Inheritance:
User←Attendee/Organizer/Admin;Event←OnlineEvent/VenueEvent - Abstraction:
IPaymentGatewayinterface with mock Stripe/PayPal implementations - Factory:
TicketFactorycreates VIP / General tickets - Singleton:
Databaseconnection (cached across serverless invocations) - Encapsulation:
BaseControllerresponse helpers; services hide rules from controllers
- Node.js 20 or newer
- MongoDB running locally (
brew services start mongodb-communityon macOS) or a MongoDB Atlas URI
cd server
npm install
cp .env.example .env # set MONGODB_URI and a random JWT_SECRET
npm run seed # demo users, 11 events, bookings and reviews
npm run dev # http://localhost:5001/apiDemo logins created by the seed (password password123): organizer@eventhive.dev, organizer2@eventhive.dev, attendee@eventhive.dev, attendee2@eventhive.dev.
cd client
npm install
cp .env.example .env.local # API_URL=http://localhost:5001/api
npm run dev # http://localhost:3000cd server && npm run typecheck && npm test # tests use mongodb://localhost:27017/eventhive_test
cd client && npm run lint && npx tsc --noEmit && npm run buildCI runs the same checks on every push (.github/workflows/ci.yml) with a MongoDB service container.
Backend — root directory server, deployed as a serverless function (vercel.json):
| Variable | Value |
|---|---|
MONGODB_URI |
MongoDB Atlas connection string (allow Vercel's IPs in Atlas Network Access) |
JWT_SECRET |
a long random string |
JWT_EXPIRES_IN |
7d |
Frontend — root directory client:
| Variable | Value |
|---|---|
API_URL |
https://<your-backend>.vercel.app/api |
API_URL is server-only; the browser talks to the frontend's own /api/* proxy.
All routes are under /api. Responses are { success, data } or { success: false, error }; list endpoints add pagination.
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| POST | /api/auth/register |
No | Register (attendee or organizer) |
| POST | /api/auth/login |
No | Login, returns user + token |
| GET | /api/events |
No | List published upcoming events: q, category, eventType, from, to, page, limit |
| GET | /api/events/:id |
No | Event detail |
| POST | /api/events |
Organizer/Admin | Create event |
| GET | /api/events/my/events |
Organizer/Admin | My events with revenue |
| PUT | /api/events/:id |
Owner/Admin | Update event |
| DELETE | /api/events/:id |
Owner/Admin | Delete event (cancels its bookings) |
| POST | /api/bookings |
User | Book a ticket (eventId, ticketType) |
| GET | /api/bookings/my |
User | My bookings |
| PATCH | /api/bookings/:id/cancel |
User | Cancel a booking (refund, seat released) |
| GET | /api/bookings/event/:eventId |
Owner/Admin | Attendees of an event |
| POST | /api/bookings/check-in |
Owner/Admin | Admit a ticket at the door (eventId, code); once only |
| GET | /api/me/saved |
User | My saved events |
| GET | /api/me/saved/ids |
User | Ids of my saved events |
| PUT | /api/me/saved/:eventId |
User | Save an event (idempotent) |
| DELETE | /api/me/saved/:eventId |
User | Remove a saved event |
| POST | /api/reviews |
Attendee of the event | Leave a review after the event ends |
| GET | /api/reviews/event/:eventId |
No | Reviews with averageRating and reviewCount |
| GET | /api/health |
No | Health check |
Errors use proper status codes: 400 validation, 401 unauthenticated, 403 forbidden, 404 not found, 409 conflict (duplicate ticket, sold out, duplicate review).