From 412788510262a43ace7534ed4822d26ec6ceaf31 Mon Sep 17 00:00:00 2001 From: Krish Modi Date: Thu, 1 Oct 2026 20:22:13 +0530 Subject: [PATCH 01/11] Fix production blockers and security holes - Mount API under /api so the client's default base URL works locally and in prod - Database singleton: cache the connect promise, stop calling process.exit on failure - Require JWT_SECRET; load dotenv before any module reads env - Registration can no longer create admin accounts - Average rating aggregate casts eventId to ObjectId (was always 0) - Cancel booking: extract ids from populated refs via idOf() (was a CastError) - Strip bookedCount/organizerId from event create/update bodies - Attendee list is restricted to the event's organizer or an admin - styled-jsx SSR registry so pages render styled (no flash of unstyled content) - Home search navigates with the router instead of a full reload Co-Authored-By: Claude Fable 5.1 --- .gitignore | 1 + client/src/app/layout.tsx | 19 +++++++----- client/src/app/page.tsx | 4 ++- client/src/app/registry.tsx | 19 ++++++++++++ server/src/config/Database.ts | 33 ++++++++++----------- server/src/controllers/BookingController.ts | 4 +-- server/src/controllers/EventController.ts | 7 +++-- server/src/index.ts | 24 +++++++-------- server/src/lib/idOf.ts | 5 ++++ server/src/repositories/ReviewRepository.ts | 3 +- server/src/services/AuthService.ts | 25 +++++++++++----- server/src/services/BookingService.ts | 22 +++++++++----- server/src/services/EventService.ts | 9 ++---- 13 files changed, 110 insertions(+), 65 deletions(-) create mode 100644 client/src/app/registry.tsx create mode 100644 server/src/lib/idOf.ts diff --git a/.gitignore b/.gitignore index 3debacf..104d493 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,4 @@ yarn-debug.log* .agents/ client/AGENTS.md client/CLAUDE.md +.claude/ diff --git a/client/src/app/layout.tsx b/client/src/app/layout.tsx index db362ff..f953bfe 100644 --- a/client/src/app/layout.tsx +++ b/client/src/app/layout.tsx @@ -2,6 +2,7 @@ import type { Metadata } from "next"; import "./globals.css"; import Navbar from "@/components/Navbar"; import Footer from "@/components/Footer"; +import StyledJsxRegistry from "./registry"; export const metadata: Metadata = { title: "EventHive — Discover & Book Amazing Events", @@ -17,14 +18,16 @@ export default function RootLayout({ return ( -
-
-
-
-
- -
{children}
-