How googie08/fablabs works
1. This repository’s main system is a Next.js App Router application at the repo root. It combines the frontend UI and backend API in one codebase, with server-side route handlers under src/app/api acting as the application backend.
2. The app is organized around multiple user personas and workspaces: public pages, user/student/service reservation flows, staff pages, cashier pages, and several admin dashboards. The route structure under src/app/* is the clearest diagram boundary for the presentation layer.
3. The public-facing UI includes the landing page, services, contact, sign-in, and sign-up flows. Shared layout and styling live in src/app/layout.tsx, globals.css, and the reusable component library under src/components/ui.
4. The core business workflows are reservation-centric. Users can create machine/service reservations, EVC reservations, and related schedules from pages like user-services, student-schedule, msme-schedule, and survey/*. These flows are implemented with form components in src/components/student-forms and src/components/msme-forms, plus calendar/reservation widgets in src/components/custom and src/components/user.
5. Administrative operations are split into separate dashboards and feature modules. The admin area includes review/approval, machine management, user management, staff tools, report generation, and history views. These are backed by components in src/components/admin* and pages in src/app/admin-dashboard/*.
6. The backend API is fairly granular and domain-driven. Route groups exist for account management, auth checks, admin approval/status updates, cashier payment queues, machine/tool/service CRUD, user profile updates, reservations, EVC reservations, blocked dates, surveys, teacher-email workflows, and uploads. In architecture terms, the frontend does not talk directly to the database; it calls these route handlers.
7. Persistence is handled through Prisma with a SQLite database (prisma/schema.prisma and prisma/dev.db). The schema models the business domain explicitly: accounts, client and business profile info, utilization requests, machine utilization logs, EVC reservations, survey results, and job/payment records. Most workflows are relational and centered on AccInfo, UtilReq, and EVCReservation.
8. The data model shows two major reservation tracks: external client utilization requests and EVC/lab reservations. Each track has its own sub-records, approval flags, satisfaction/evaluation records, and nested child entities such as times, process details, materials, students, and machine utilization breakdowns.
9. A notable operational boundary is notifications and document generation. Email-related route handlers under src/app/api/admin-email and src/app/api/teacher-email suggest outbound notifications for approvals, rejections, cancellations, and contact messages. Printable artifacts are generated from components under src/components/admin-functions/pdf and src/components/admin-reports, covering forms, machine utilization reports, dashboard reports, and payment/job documents.
10. Access control is enforced at the application layer. src/middleware.ts, auth-related API routes, and the role-guard component indicate that route access and UI visibility depend on user role rather than a separate backend gateway.
11. Static assets are part of the architecture because the app depends on many branded resources: fonts, logos, machine images, and slider assets live under public/. This matters because several pages and PDFs likely depend on those assets for presentation and generated documents.
12. There is also a separate my-app directory containing a standalone Create React App scaffold. It appears isolated from the main Next.js application and should be treated as a separate legacy/demo frontend unless intentionally wired in elsewhere. For an architecture diagram of the active system, the root Next.js app is the primary focus.
Main entry points: prisma.ts Prisma client · middleware.ts Route guard · review-reservation.tsx Admin tools · utilization-info.tsx MSME forms
Components 27
Next.js app
Primary App Router frontend plus route handlers
- App shell · Global layout and styling for the App Router application
src/app/layout.tsx - Home · Landing page for the main application
src/app/page.tsx - Public info · Public-facing services and contact routes
src/app/services/page.tsx - Auth entry · Sign-in and sign-up entry points
src/app/sign-in/[[...sign-in]]/page.tsx - User flows · Student and client scheduling flows
src/app/student-schedule/page.tsx - MSME flow · Machine/service utilization workflow for MSME users
src/app/msme-schedule/page.tsx - Survey flow · Public and internal survey entry points
src/app/survey/page.tsx - Admin dashboard · Main admin console and related dashboards
src/app/admin-dashboard/page.tsx - User dashboard · User account and reservation history views
src/app/user-dashboard/page.tsx - Ops dashboards · Staff and cashier operational consoles
src/app/staff-dashboard/page.tsx - Reservation API · Create, fetch, review, and status-update reservation handlers
src/app/api/user/create-reservation/route.ts - EVC API · EVC reservation and status handlers
src/app/api/user/create-evc-reservation/route.ts - Admin API · Administrative approval, reporting, and management handlers
src/app/api/admin/reservation-review/[id]/route.ts - Catalog API · Machines, tools, and services CRUD handlers
src/app/api/machines/route.ts - Account API · Account, profile, and user-management handlers
src/app/api/account/[userId]/route.ts - Comms API · Email and contact notification handlers
src/app/api/admin-email/contact/route.ts
UI components
Reusable presentation and workflow components
- Navbar · Top-level navigation shared across pages
src/components/custom/navbar.tsx - Student forms · Student reservation forms and calendar widgets
src/components/student-forms/lab-reservation.tsx - MSME forms · MSME utilization forms and selectors
src/components/msme-forms/utilization-info.tsx - Admin tools · Admin review, machine, and role-management UI
src/components/admin/review-reservation.tsx - Reports & PDF · PDF generation and reporting utilities
src/components/admin-reports/report-generator-dialog.tsx - Role guard UI · Client-side role-based visibility control
src/components/auth/role-guard.tsx - Profile UI · Personal and business information editing widgets
src/components/user/personal-info-edit-modal.tsx
Data layer
Prisma client and schema-backed persistence
- Route guard · Application-layer access control and role checks
src/middleware.ts - Prisma client · Shared database access helper
src/lib/prisma.ts - Domain schema · Prisma schema and SQLite persistence model
prisma/schema.prisma
Legacy app
Standalone Create React App scaffold kept separate
- Legacy app · Standalone Create React App scaffold separate from the Next.js system
my-app/src/App.js
Connections 26
- Home → Navbar: renders · Landing page uses shared navigation
- Public info → Navbar: renders · Public pages share the app shell and nav
- User flows → Student forms: uses · Student scheduling pages are built from reservation forms
- MSME flow → MSME forms: uses · MSME scheduling pages are built from utilization forms
- Survey flow → User flows: feeds · Survey flows relate to reservation and evaluation journeys
- Admin dashboard → Admin tools: uses · Admin dashboard pages are composed from admin feature components
- Admin dashboard → Reports & PDF: uses · Admin reporting and exports rely on PDF/report components
- User dashboard → Profile UI: uses · Account pages expose profile editing and user history
- Ops dashboards → Admin tools: uses · Operational dashboards reuse admin-style controls
- Student forms → Reservation API: calls · Reservation forms submit to backend route handlers
- MSME forms → Reservation API: calls · MSME workflow ultimately writes reservation records
- MSME forms → EVC API: calls · MSME and lab flows can create EVC reservations
- Admin tools → Admin API: calls · Approval and management actions go through admin APIs
- Admin tools → Catalog API: calls · Machine and service management use catalog APIs
- Profile UI → Account API: calls · Profile editing and account actions use account APIs
- Reservation API → Prisma client: persists · Reservation handlers read and write through Prisma
- EVC API → Prisma client: persists · EVC handlers persist reservation state through Prisma
- Admin API → Prisma client: persists · Admin review and reporting handlers use the database
- Catalog API → Prisma client: persists · Catalog CRUD is backed by the shared database client
- Account API → Prisma client: persists · Account and user-management handlers update persisted profiles
- Comms API → Prisma client: persists · Notification workflows likely record or read domain records
- Route guard → Auth entry: guards · Route access depends on application-layer auth and roles
- Route guard → Admin dashboard: guards · Role checks restrict dashboard access
- Route guard → Ops dashboards: guards · Staff and cashier views are role-gated
- Domain schema → Prisma client: backed by · Prisma client is generated from the schema
- Legacy app → Route guard: isolated · Legacy CRA frontend is separate from the main Next.js runtime