# ashwin0727/gameall-club-management architecture

> Architecture diagram of the GitHub repository ashwin0727/gameall-club-management, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ashwin0727/gameall-club-management
- Repository: https://github.com/ashwin0727/gameall-club-management

## Overview

#### 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: [`src/app/(dashboard)/layout.tsx`](https://github.com/ashwin0727/gameall-club-management/blob/main/src/app/(dashboard)/layout.tsx) (Dashboard layout), [`src/middleware.ts`](https://github.com/ashwin0727/gameall-club-management/blob/main/src/middleware.ts) (Request middleware), [`src/app/api/members/route.ts`](https://github.com/ashwin0727/gameall-club-management/blob/main/src/app/api/members/route.ts) (Members API route), [`src/app/layout.tsx`](https://github.com/ashwin0727/gameall-club-management/blob/main/src/app/layout.tsx) (Root layout)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Next.js application"]
  node_root_layout["Root layout<br/>App Router root<br/>[layout.tsx]"]
  node_home_page["Home page<br/>route page<br/>[page.tsx]"]
  node_middleware{{"Request middleware<br/>session gate<br/>[middleware.ts]"}}
  node_query_provider["Query provider<br/>query cache<br/>[query-provider.tsx]"]
  node_ui_store["UI store<br/>client state<br/>[ui-store.ts]"]
end

subgraph group_auth["Authentication"]
  node_auth_layout["Auth route layout<br/>public route group<br/>[layout.tsx]"]
  node_auth_api["Auth feature API<br/>auth abstraction<br/>[auth.api.ts]"]
  node_supabase_auth["Supabase auth service<br/>provider adapter"]
  node_auth_callback{{"Auth callback<br/>route handler<br/>[route.ts]"}}
end

subgraph group_dashboard["Protected dashboard"]
  node_dashboard_layout["Dashboard layout<br/>protected route group<br/>[layout.tsx]"]
  node_app_shell["Application shell<br/>shared UI shell<br/>[app-shell.tsx]"]
  node_dashboard_page["Dashboard page<br/>route page<br/>[page.tsx]"]
  node_dashboard_stats_hook["Dashboard stats hook<br/>query hook"]
  node_dashboard_api["Dashboard feature API<br/>data API<br/>[dashboard.api.ts]"]
  node_members_page["Members page<br/>CRUD route page<br/>[page.tsx]"]
  node_members_hook["Members hook<br/>CRUD hook<br/>[use-members.ts]"]
  node_members_api{{"Members API route<br/>same-origin backend<br/>[route.ts]"}}
end

subgraph group_supabase["Supabase boundary"]
  node_supabase_clients["Supabase clients<br/>client/server/admin constructors<br/>[client.ts]"]
  node_supabase_session["Supabase middleware helper<br/>session refresh<br/>[middleware.ts]"]
  node_supabase_platform[("Supabase platform<br/>identity and database")]
  node_database_schema["Initial database schema<br/>SQL migration<br/>[0001_init.sql]"]
end

subgraph group_domains["Domain contracts"]
  node_member_types["Member contracts<br/>domain types<br/>[types.ts]"]
  node_booking_types["Booking contracts<br/>planned domain types<br/>[types.ts]"]
  node_inventory_types["Inventory contracts<br/>planned domain types<br/>[types.ts]"]
end

node_root_layout -->|"installs"| node_query_provider
node_root_layout -->|"renders routes"| node_home_page
node_middleware -->|"refreshes via"| node_supabase_session
node_supabase_session -->|"reads session"| node_supabase_platform
node_middleware -.->|"permits public access"| node_auth_layout
node_middleware -->|"guards"| node_dashboard_layout
node_auth_layout -->|"uses"| node_auth_api
node_auth_api -->|"delegates auth"| node_supabase_auth
node_supabase_auth -->|"authenticates with"| node_supabase_platform
node_auth_callback -->|"completes callback"| node_supabase_platform
node_dashboard_layout -->|"renders"| node_app_shell
node_app_shell -->|"uses"| node_ui_store
node_dashboard_layout -->|"protects"| node_dashboard_page
node_dashboard_layout -->|"protects"| node_members_page
node_dashboard_page -->|"queries through"| node_dashboard_stats_hook
node_dashboard_stats_hook -->|"calls"| node_dashboard_api
node_dashboard_api -->|"accesses data through"| node_supabase_clients
node_members_page -->|"manages via"| node_members_hook
node_members_hook -->|"requests"| node_members_api
node_members_api -->|"persists to"| node_supabase_platform
node_members_api -->|"uses contracts"| node_member_types
node_supabase_clients -->|"connects to"| node_supabase_platform
node_database_schema -->|"defines"| node_supabase_platform

click node_root_layout "https://github.com/ashwin0727/gameall-club-management/blob/main/src/app/layout.tsx"
click node_home_page "https://github.com/ashwin0727/gameall-club-management/blob/main/src/app/page.tsx"
click node_middleware "https://github.com/ashwin0727/gameall-club-management/blob/main/src/middleware.ts"
click node_query_provider "https://github.com/ashwin0727/gameall-club-management/blob/main/src/providers/query-provider.tsx"
click node_ui_store "https://github.com/ashwin0727/gameall-club-management/blob/main/src/stores/ui-store.ts"
click node_auth_layout "https://github.com/ashwin0727/gameall-club-management/blob/main/src/app/(auth)/layout.tsx"
click node_auth_api "https://github.com/ashwin0727/gameall-club-management/blob/main/src/features/auth/api/auth.api.ts"
click node_supabase_auth "https://github.com/ashwin0727/gameall-club-management/blob/main/src/services/auth/supabase-auth.service.ts"
click node_auth_callback "https://github.com/ashwin0727/gameall-club-management/blob/main/src/app/auth/callback/route.ts"
click node_dashboard_layout "https://github.com/ashwin0727/gameall-club-management/blob/main/src/app/(dashboard)/layout.tsx"
click node_app_shell "https://github.com/ashwin0727/gameall-club-management/blob/main/src/components/shared/app-shell.tsx"
click node_dashboard_page "https://github.com/ashwin0727/gameall-club-management/blob/main/src/app/(dashboard)/dashboard/page.tsx"
click node_dashboard_stats_hook "https://github.com/ashwin0727/gameall-club-management/blob/main/src/features/dashboard/hooks/use-dashboard-stats.ts"
click node_dashboard_api "https://github.com/ashwin0727/gameall-club-management/blob/main/src/features/dashboard/api/dashboard.api.ts"
click node_members_page "https://github.com/ashwin0727/gameall-club-management/blob/main/src/app/(dashboard)/members/page.tsx"
click node_members_hook "https://github.com/ashwin0727/gameall-club-management/blob/main/src/features/members/hooks/use-members.ts"
click node_members_api "https://github.com/ashwin0727/gameall-club-management/blob/main/src/app/api/members/route.ts"
click node_supabase_clients "https://github.com/ashwin0727/gameall-club-management/blob/main/src/lib/supabase/client.ts"
click node_supabase_session "https://github.com/ashwin0727/gameall-club-management/blob/main/src/lib/supabase/middleware.ts"
click node_database_schema "https://github.com/ashwin0727/gameall-club-management/blob/main/supabase/migrations/0001_init.sql"
click node_member_types "https://github.com/ashwin0727/gameall-club-management/blob/main/src/features/members/types.ts"
click node_booking_types "https://github.com/ashwin0727/gameall-club-management/blob/main/src/features/bookings/types.ts"
click node_inventory_types "https://github.com/ashwin0727/gameall-club-management/blob/main/src/features/inventory/types.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_root_layout,node_home_page,node_middleware,node_query_provider,node_ui_store toneBlue
class node_auth_layout,node_auth_api,node_supabase_auth,node_auth_callback toneAmber
class node_dashboard_layout,node_app_shell,node_dashboard_page,node_dashboard_stats_hook,node_dashboard_api,node_members_page,node_members_hook,node_members_api toneMint
class node_supabase_clients,node_supabase_session,node_supabase_platform,node_database_schema toneRose
class node_member_types,node_booking_types,node_inventory_types toneIndigo
```

## Components

### Next.js application

- [Root layout](https://github.com/ashwin0727/gameall-club-management/blob/main/src/app/layout.tsx): App Router root · `src/app/layout.tsx`
- [Home page](https://github.com/ashwin0727/gameall-club-management/blob/main/src/app/page.tsx): route page · `src/app/page.tsx`
- [Request middleware](https://github.com/ashwin0727/gameall-club-management/blob/main/src/middleware.ts): session gate · `src/middleware.ts`
- [Query provider](https://github.com/ashwin0727/gameall-club-management/blob/main/src/providers/query-provider.tsx): query cache · Provides cross-cutting server/client query caching. · `src/providers/query-provider.tsx`
- [UI store](https://github.com/ashwin0727/gameall-club-management/blob/main/src/stores/ui-store.ts): client state · Owns transient interface state. · `src/stores/ui-store.ts`

### Authentication

- [Auth route layout](https://github.com/ashwin0727/gameall-club-management/blob/main/src/app/(auth)/layout.tsx): public route group · `src/app/(auth)/layout.tsx`
- [Auth feature API](https://github.com/ashwin0727/gameall-club-management/blob/main/src/features/auth/api/auth.api.ts): auth abstraction · `src/features/auth/api/auth.api.ts`
- [Supabase auth service](https://github.com/ashwin0727/gameall-club-management/blob/main/src/services/auth/supabase-auth.service.ts): provider adapter · `src/services/auth/supabase-auth.service.ts`
- [Auth callback](https://github.com/ashwin0727/gameall-club-management/blob/main/src/app/auth/callback/route.ts): route handler · Completes provider and email authentication flows. · `src/app/auth/callback/route.ts`

### Protected dashboard

- [Dashboard layout](https://github.com/ashwin0727/gameall-club-management/blob/main/src/app/(dashboard)/layout.tsx): protected route group · `src/app/(dashboard)/layout.tsx`
- [Application shell](https://github.com/ashwin0727/gameall-club-management/blob/main/src/components/shared/app-shell.tsx): shared UI shell · Supplies sidebar and topbar navigation. · `src/components/shared/app-shell.tsx`
- [Dashboard page](https://github.com/ashwin0727/gameall-club-management/blob/main/src/app/(dashboard)/dashboard/page.tsx): route page · `src/app/(dashboard)/dashboard/page.tsx`
- [Dashboard stats hook](https://github.com/ashwin0727/gameall-club-management/blob/main/src/features/dashboard/hooks/use-dashboard-stats.ts): query hook · `src/features/dashboard/hooks/use-dashboard-stats.ts`
- [Dashboard feature API](https://github.com/ashwin0727/gameall-club-management/blob/main/src/features/dashboard/api/dashboard.api.ts): data API · `src/features/dashboard/api/dashboard.api.ts`
- [Members page](https://github.com/ashwin0727/gameall-club-management/blob/main/src/app/(dashboard)/members/page.tsx): CRUD route page · Renders member table and form dialog. · `src/app/(dashboard)/members/page.tsx`
- [Members hook](https://github.com/ashwin0727/gameall-club-management/blob/main/src/features/members/hooks/use-members.ts): CRUD hook · `src/features/members/hooks/use-members.ts`
- [Members API route](https://github.com/ashwin0727/gameall-club-management/blob/main/src/app/api/members/route.ts): same-origin backend · `src/app/api/members/route.ts`

### Supabase boundary

- [Supabase clients](https://github.com/ashwin0727/gameall-club-management/blob/main/src/lib/supabase/client.ts): client/server/admin constructors · Separates browser, server, privileged, and middleware access. · `src/lib/supabase/client.ts`
- [Supabase middleware helper](https://github.com/ashwin0727/gameall-club-management/blob/main/src/lib/supabase/middleware.ts): session refresh · `src/lib/supabase/middleware.ts`
- **Supabase platform**: identity and database
- [Initial database schema](https://github.com/ashwin0727/gameall-club-management/blob/main/supabase/migrations/0001_init.sql): SQL migration · Roots database schema and generated type contracts. · `supabase/migrations/0001_init.sql`

### Domain contracts

- [Member contracts](https://github.com/ashwin0727/gameall-club-management/blob/main/src/features/members/types.ts): domain types · Constrains member validation and transport data. · `src/features/members/types.ts`
- [Booking contracts](https://github.com/ashwin0727/gameall-club-management/blob/main/src/features/bookings/types.ts): planned domain types · Planned peer domain without workflow implementation. · `src/features/bookings/types.ts`
- [Inventory contracts](https://github.com/ashwin0727/gameall-club-management/blob/main/src/features/inventory/types.ts): planned domain types · Planned peer domain without workflow implementation. · `src/features/inventory/types.ts`

## Connections

- 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
