How ashwin0727/gameall-club-management works
Purpose and runtime
A Next.js TypeScript application for an authenticated operational dashboard, currently centered on dashboard statistics and member management. It uses the App Router, React/Tailwind UI, and Supabase for authentication and database access. Core runtime roots: src/app/layout.tsx, src/app/page.tsx, src/middleware.ts.
Route partitioning and access control
Routes are separated into public authentication and protected dashboard route groups. Authentication screens cover signup, login, password recovery/reset, email verification, and onboarding; protected routes expose dashboard and members views. Supabase session handling and redirects form the access boundary: src/app/(auth)/layout.tsx, src/app/(dashboard)/layout.tsx, src/lib/supabase/middleware.ts.
Authentication subsystem
Feature-level auth UI submits through a service abstraction rather than binding directly to a provider. auth.api.ts and use-auth.ts coordinate forms with auth operations; supabase-auth.service.ts implements the Supabase-specific provider. The callback endpoint completes provider/email auth flows. Paths: src/features/auth/api/auth.api.ts, src/services/auth/supabase-auth.service.ts, src/app/auth/callback/route.ts.
Supabase integration and persistence
Supabase is the external identity and database platform. Distinct client, server, admin, and middleware constructors isolate browser calls, server-rendered/route-handler access, privileged operations, and session refresh respectively. Database schema/type contracts are rooted in the initial migration and generated-style database types: src/lib/supabase/client.ts, src/lib/supabase/server.ts, supabase/migrations/0001_init.sql.
Dashboard application shell and state
Protected pages render through a reusable shell with sidebar and topbar navigation. Cross-cutting server/client query caching is provided at the application provider layer, while transient UI state is managed separately in a store. Paths: src/components/shared/app-shell.tsx, src/providers/query-provider.tsx, src/stores/ui-store.ts.
Dashboard data flow
Dashboard pages consume a feature API through a dedicated query hook, then render aggregate statistics as presentation components. This establishes the intended flow: route/page → feature hook → feature API → backend/Supabase boundary → typed UI. Paths: src/app/(dashboard)/dashboard/page.tsx, src/features/dashboard/hooks/use-dashboard-stats.ts, src/features/dashboard/api/dashboard.api.ts.
Member management flow
Members is the primary CRUD domain. The route renders a table and form dialog; the members hook/API own client data operations; the Next route handler is a same-origin backend boundary for member requests. Validation and domain types constrain form and transport data. Paths: src/app/(dashboard)/members/page.tsx, src/features/members/hooks/use-members.ts, src/app/api/members/route.ts.
Domain expansion points
Bookings and inventory currently expose domain type modules without visible routes, APIs, or feature workflows. They appear to be planned peers to members, expected to adopt the existing feature structure of types, validation, API, hooks, and components. Paths: src/features/bookings/types.ts, src/features/inventory/types.ts, src/features/members/types.ts.
Main entry points: (dashboard)/layout.tsx Dashboard layout · middleware.ts Request middleware · route.ts Members API route · app/layout.tsx Root layout
Components 24
Next.js application
- Root layout
src/app/layout.tsx - Home page
src/app/page.tsx - Request middleware
src/middleware.ts - Query provider · Provides cross-cutting server/client query caching.
src/providers/query-provider.tsx - UI store · Owns transient interface state.
src/stores/ui-store.ts
Authentication
- Auth route layout
src/app/(auth)/layout.tsx - Auth feature API
src/features/auth/api/auth.api.ts - Supabase auth service
src/services/auth/supabase-auth.service.ts - Auth callback · Completes provider and email authentication flows.
src/app/auth/callback/route.ts
Protected dashboard
- Dashboard layout
src/app/(dashboard)/layout.tsx - Application shell · Supplies sidebar and topbar navigation.
src/components/shared/app-shell.tsx - Dashboard page
src/app/(dashboard)/dashboard/page.tsx - Dashboard stats hook
src/features/dashboard/hooks/use-dashboard-stats.ts - Dashboard feature API
src/features/dashboard/api/dashboard.api.ts - Members page · Renders member table and form dialog.
src/app/(dashboard)/members/page.tsx - Members hook
src/features/members/hooks/use-members.ts - Members API route
src/app/api/members/route.ts
Supabase boundary
- Supabase clients · Separates browser, server, privileged, and middleware access.
src/lib/supabase/client.ts - Supabase middleware helper
src/lib/supabase/middleware.ts - Supabase platform
- Initial database schema · Roots database schema and generated type contracts.
supabase/migrations/0001_init.sql
Domain contracts
- Member contracts · Constrains member validation and transport data.
src/features/members/types.ts - Booking contracts · Planned peer domain without workflow implementation.
src/features/bookings/types.ts - Inventory contracts · Planned peer domain without workflow implementation.
src/features/inventory/types.ts
Connections 23
- Root layout → Query provider: installs
- Root layout → Home page: renders routes
- Request middleware → Supabase middleware helper: refreshes via
- Supabase middleware helper → Supabase platform: reads session
- Request middleware → Auth route layout: permits public access
- Request middleware → Dashboard layout: guards
- Auth route layout → Auth feature API: uses
- Auth feature API → Supabase auth service: delegates auth
- Supabase auth service → Supabase platform: authenticates with
- Auth callback → Supabase platform: completes callback
- Dashboard layout → Application shell: renders
- Application shell → UI store: uses
- Dashboard layout → Dashboard page: protects
- Dashboard layout → Members page: protects
- Dashboard page → Dashboard stats hook: queries through
- Dashboard stats hook → Dashboard feature API: calls
- Dashboard feature API → Supabase clients: accesses data through
- Members page → Members hook: manages via
- Members hook → Members API route: requests
- Members API route → Supabase platform: persists to
- Members API route → Member contracts: uses contracts
- Supabase clients → Supabase platform: connects to
- Initial database schema → Supabase platform: defines