How saiabhinav001/ai_4_impact works
1. This repo is a Next.js App Router application with a clear split between browser UI, server-rendered pages, and route-handler APIs. The src/app tree contains the user-facing routes, while src/app/api holds the backend boundary for all persistence, auth, and file operations.
2. The main product surface is a registration portal for two event types: hackathon and workshop. The reusable registration UI lives under src/components/registration, with forms, track selection, file upload, payment sections, and a portal shell that likely switches behavior based on the selected registration type.
3. There are two primary public flows:
- registration and submission for participants,
- team/workflow actions after registration.
The public pages include /, /auth, /dashboard, and /team, which appear to route users into the appropriate experience after authentication or registration state checks.
4. The backend is organized around domain-specific API endpoints rather than a single monolithic API. Under src/app/api, there are distinct groups for:
- register and registrations for creating and reading registration records,
- team and teams for team access, dashboard, selection, and submission,
- upload for file uploads,
- users/profile for user data,
- hackathon/phase and hackathon/timeline for event state,
- admin/* for operational/admin functions.
5. Firebase is the main infrastructure boundary. The presence of firebaseAdmin.js, lib/admin.js, lib/client.js, lib/firebase.js, plus firestore.rules and storage.rules, indicates a split between client-side Firebase access and privileged server-side admin access. This strongly suggests Firestore is the primary database and Firebase Storage is used for uploaded assets such as payment screenshots and PPT files.
6. Authentication and authorization are centralized rather than embedded in each UI page. middleware.js, lib/auth.js, lib/server/auth.js, and src/app/api/admin/_utils/auth.js indicate request-time protection for both end-user and admin paths. The lib/constants/roles.js file suggests role-based access control, and scripts/set-admin-claims.mjs implies custom claims are used for admin privileges.
7. The admin subsystem is a separate operational console under src/app/admin with its own login page and API endpoints. It supports analytics, registration viewing, submission review, payment verification, DB initialization, team credential regeneration, and sending team credentials email in bulk or individually. This is the main human-in-the-loop control plane for the event organizers.
8. File handling is an important part of the architecture. There are dedicated upload routes for payment screenshots and PPTs, plus a cleanup utility in src/app/api/register/_utils/screenshotCleanup.js. That means uploaded files are treated as managed artifacts, not just incidental attachments, and there is explicit lifecycle handling to prevent orphaned storage objects.
9. The hackathon domain has its own state model. lib/constants/phases.js plus the hackathon/phase and hackathon/timeline APIs show that event progression is externally modeled as phases/timeline data, likely used to gate UI behavior and team actions. This is a separate control plane from registration records.
10. Server-side helper modules under lib/server and src/app/api/*/_utils suggest a layered backend: route handlers are thin, and shared logic lives in server utilities. This is where validation, credential-email formatting, and hackathon-specific server functions are centralized.
11. The repo also contains one-off operational scripts under scripts/ for maintenance and data migration: backfilling access, cleaning test data, listing collections, initializing the database, checking credential state, and deploying Firestore config. These scripts indicate a production system with ongoing data hygiene and admin operations, not just a static frontend.
12. Deployment/runtime configuration is standard Next.js plus Firebase. next.config.mjs, firebase.json, firestore.indexes.json, firestore.rules, storage.rules, and public/ assets show the project is designed to deploy as a web app with Firebase-backed services and security rules enforcing access at the data layer.
13. A useful architecture diagram should emphasize three boundaries:
- browser UI in src/app and src/components,
- Next.js route handlers in src/app/api,
- Firebase services and rules as the persistence/auth/storage backend.
The admin console is a privileged branch of the same app, not a separate service.
14. In short, this is an event-registration and team-management platform built on Next.js + Firebase, with public participant flows, protected team workflows, and an admin control plane operating over Firestore/Storage through server-side APIs and custom auth.
Main entry points: firestore.rules Firestore · route.js Register API · firebase.js Firebase Clients · page.jsx Auth
Components 25
App UI
Public routes and reusable registration components in the Next.js app router.
- Home · Landing route that routes users into registration or account flows.
src/app/page.tsx - Auth · Authentication entry point for participants and admins.
src/app/auth/page.jsx - Dashboard · User dashboard for post-registration status and actions.
src/app/dashboard/page.jsx - Team · Team workflow page for access, selection, and submission actions.
src/app/team/page.jsx - Reg Portal · Reusable registration experience that switches between event types and steps.
src/components/registration/RegistrationPortal.tsx - Hackathon Form · Participant registration form for the hackathon flow.
src/components/registration/HackathonForm.tsx - Workshop Form · Participant registration form for the workshop flow.
src/components/registration/WorkshopForm.tsx - Uploads UI · Shared file upload and payment UI used during registration and submission.
src/components/registration/FileUpload.tsx - Admin Console · Privileged console for reviewing registrations, submissions, analytics, and verification tasks.
src/app/admin/page.js - Admin Login · Dedicated login entry for the administrative console.
src/app/admin/login/page.js
Route APIs
Next.js route handlers for registration, team, upload, user, hackathon, and admin workflows.
- Register API · Backend entry for creating registration records and handling registration variants.
src/app/api/register/route.js - Registrations API · Registration retrieval endpoints for hackathon and workshop records.
src/app/api/registrations/hackathon/route.js - Team API · Team access, dashboard, selection, and submission endpoints.
src/app/api/team/access/resolve/route.js - Upload API · Upload endpoints for payment screenshots and PPT artifacts.
src/app/api/upload/route.js - Users API · User profile endpoint used by authenticated flows.
src/app/api/users/profile/route.js - Hackathon API · Event phase and timeline endpoints that gate user and team behavior.
src/app/api/hackathon/phase/route.js - Admin API · Administrative endpoints for analytics, review, credentialing, verification, and init tasks.
src/app/api/admin/analytics/route.js
Shared Backend
Auth, Firebase wrappers, server helpers, and domain constants shared across routes.
- Auth Core · Request-time auth and role checks for user and admin paths.
middleware.js - Server Utils · Shared server-side logic for auth and hackathon domain behavior.
lib/server/auth.js - Firebase Clients · Client and admin Firebase wrappers used by server and browser code.
lib/firebase.js - Domain Consts · Centralized role and phase definitions used across UI and server flows.
lib/constants/phases.js
Firebase Infra
Firebase services, security rules, and deployment/runtime configuration.
- Firestore · Primary application database for registrations, teams, users, and admin state.
firestore.rules - Storage · Firebase Storage for uploaded screenshots and presentation files.
storage.rules - Firebase Config · Firebase project wiring, indexes, and runtime deployment configuration.
firebase.json
Admin & Ops
Operator console and maintenance scripts for the live event system.
- Ops Scripts · One-off scripts for backfills, cleanup, initialization, and credential operations.
scripts/init-db-once.cjs
Connections 30
- Home → Reg Portal: start registration · Landing users into the main participant flow.
- Home → Auth: sign in · Routes unauthenticated users to authentication.
- Auth → Dashboard: session entry · Authenticated users proceed to protected pages.
- Auth → Team: team access · Authenticated users can enter team workflows.
- Reg Portal → Hackathon Form: hackathon · Switches the portal into hackathon registration.
- Reg Portal → Workshop Form: workshop · Switches the portal into workshop registration.
- Hackathon Form → Uploads UI: attach files · Uses shared upload and payment controls.
- Workshop Form → Uploads UI: attach files · Uses shared upload and payment controls.
- Hackathon Form → Register API: submit · Creates hackathon registration records.
- Workshop Form → Register API: submit · Creates workshop registration records.
- Register API → Registrations API: persist/read · Registration data is stored and later retrieved through domain endpoints.
- Team → Team API: workflow calls · Team access, dashboard, selection, and submission actions.
- Dashboard → Users API: profile · Reads authenticated user profile state.
- Uploads UI → Upload API: upload · Sends screenshots and PPTs to the file backend.
- Hackathon API → Domain Consts: phases · Uses phase and timeline definitions to gate behavior.
- Register API → Firestore: write records · Registration writes go to the primary database.
- Team API → Firestore: team state · Team access and submission state are persisted in Firestore.
- Upload API → Storage: store files · Uploaded artifacts are stored in Firebase Storage.
- Users API → Firestore: read/write profile · User profile data is sourced from Firestore.
- Admin Console → Admin API: ops actions · Console actions call privileged administrative endpoints.
- Admin Login → Auth Core: admin auth · Admin sign-in is protected by request-time auth checks.
- Admin API → Server Utils: shared logic · Admin handlers depend on server-side auth and helper utilities.
- Auth Core → Firebase Clients: verify claims · Auth middleware relies on Firebase admin/client capabilities.
- Server Utils → Firebase Clients: backend access · Server helpers use Firebase wrappers for privileged operations.
- Firebase Clients → Firestore: admin sdk · Privileged server access to Firestore.
- Firebase Clients → Storage: admin sdk · Privileged server access to Storage.
- Firebase Config → Firestore: rules/indexes · Deployment config governs database behavior and indexing.
- Firebase Config → Storage: rules · Deployment config governs storage access control.
- Ops Scripts → Firebase Config: maintain · Scripts operate on Firebase configuration and data lifecycle.
- Ops Scripts → Firestore: backfill/cleanup · Maintenance scripts mutate and inspect production data.