# geezdock/voyaq architecture

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

- Interactive diagram: https://gitdiagram.com/geezdock/voyaq
- Repository: https://github.com/geezdock/voyaq

## Overview

#### Purpose and runtime
VOYAQ is a Next.js 16/React 19 collaborative group-travel planner for Indian students. It supports squad creation and invitations, consensus planning, destination intelligence, trip status, and shared expense settlement. The App Router is the application entry surface: `src/app/layout.tsx`, `src/app/page.tsx`, and `src/proxy.ts` (authentication middleware).

#### Route domains and user entry points
Public flows include landing, authentication, squad creation/joining, tools, travel intel, and consent: `src/app/auth/page.tsx`, `src/app/create/page.tsx`, `src/app/join/[code]/page.tsx`. Authenticated/dashboard flows expose squads and profiles through `src/app/(dashboard)/layout.tsx` and `src/app/(dashboard)/dashboard/page.tsx`. Per-squad planning and finalized trip views are parameterized routes at `src/app/workspace/[id]/page.tsx`, `src/app/trip/[id]/page.tsx`, and `src/app/trip/[id]/hub/page.tsx`.

#### Identity, tenancy, and persistence boundary
Supabase supplies PostgreSQL, Auth, and Realtime; client and server access are separated in `src/services/supabase/client.ts` and `src/services/supabase/server.ts`. Shared authentication and selected-squad state are propagated through React providers: `src/shared/providers/AuthContext.tsx` and `src/shared/providers/SquadContext.tsx`. Database evolution and security policy are encoded in `supabase/migrations/00001_initial_schema.sql`, `supabase/migrations/00002_rls_gaps.sql`, and `supabase/migrations/00006_fix_rls_recursion.sql`; RLS is therefore a core tenant/access boundary. Development can bypass auth, and the app can run against mock/fallback data.

#### Squad planning workflow
Workspace UI implements the consensus pipeline: membership, destination proposal/voting, date voting, anonymous budget alignment, and custom polls. The orchestration surface is `src/features/workspace/components/WorkspaceView.tsx`; discrete stages live in `src/features/workspace/components/steps/TabSquad.tsx`, `src/features/workspace/components/steps/TabDestinations.tsx`, and `src/features/workspace/components/steps/TabDates.tsx` (with budget/polls sibling steps). Completion feeds the trip route, whose summary/status UI is `src/features/trip/components/TripView.tsx`.

#### Server actions and domain repositories
Mutation/read coordination is concentrated in server actions rather than exposed API-route files: `src/actions/data.ts` handles application data operations and `src/actions/ai.ts` handles AI-backed requests. Repository adapters isolate persistence concerns for squads and expenses: `src/lib/repositories/squad.ts` and `src/lib/repositories/expense.ts`. Types at `src/types/squad.ts` and `src/types/expense.ts` establish shared domain contracts across UI, actions, and storage.

#### Destination intelligence and AI
The destination hub is a tabbed aggregation boundary for weather, food, places, events, safety, transport, budget, itinerary, maps, and AI suggestions. Its shell is `src/features/destination/components/DestinationHub.tsx`, with representative panels `src/features/destination/components/Weather/HubWeather.tsx` and `src/features/destination/components/AISuggestions/HubAISuggestions.tsx`. Google Gemini is optional for itinerary, tips, and budgeting via `src/actions/ai.ts`; destination constants and typed data constrain this domain in `src/constants/destinations.ts` and `src/types/destination.ts`.

#### Expenses, tools, and client persistence
Expense tracking collects items, derives per-person balances, settlement matrices, and payment QR output through `src/features/expense/components/ExpenseTracker.tsx`, `src/features/expense/components/SettlementMatrix.tsx`, and `src/features/expense/hooks/useExpenses.ts`. Standalone planning tools are browser-oriented and include local-storage packing state and a currency service with offline fallback: `src/features/toolkit/PackingList.tsx`, `src/features/toolkit/CurrencyConverter.tsx`.

#### Cross-cutting operations
Caching uses Upstash Redis when configured, with in-memory fallback in `src/lib/cache.ts`. Sentry initializes across client, server, and edge runtimes via `sentry.client.config.ts`, `sentry.server.config.ts`, and `sentry.edge.config.ts`; PostHog is integrated through `src/shared/providers/AnalyticsProvider.tsx`. PWA behavior is delivered by `public/sw.js`, `public/manifest.json`, and the navigation fallback `src/app/offline/page.tsx`.

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App entry &amp; routes"]
  node_app_router["App Router<br/>Next.js entry<br/>[layout.tsx]"]
  node_auth_proxy["Auth proxy<br/>middleware<br/>[proxy.ts]"]
  node_dashboard["Dashboard routes<br/>authenticated UI<br/>[page.tsx]"]
  node_workspace_route["Workspace route<br/>planning route<br/>[page.tsx]"]
  node_trip_route["Trip routes<br/>[page.tsx]"]
  node_auth_state["Auth &amp; squad state<br/>React providers<br/>[AuthContext.tsx]"]
end

subgraph group_planning["Planning &amp; trips"]
  node_workspace["Consensus workspace<br/>planning orchestration<br/>[WorkspaceView.tsx]"]
  node_planning_steps["Planning stages<br/>workspace tabs"]
  node_trip_view["Trip summary<br/>trip UI<br/>[TripView.tsx]"]
  node_expenses["Expense tracker<br/>shared expense UI<br/>[ExpenseTracker.tsx]"]
end

subgraph group_data["Data &amp; domain"]
  node_server_actions["Data actions<br/>server actions<br/>[data.ts]"]
  node_repositories["Squad &amp; expense repositories<br/>persistence adapters<br/>[squad.ts]"]
  node_domain_contracts["Squad &amp; expense contracts<br/>shared types<br/>[squad.ts]"]
  node_supabase[("Supabase<br/>PostgreSQL, Auth &amp; Realtime<br/>[server.ts]")]
  node_rls["RLS policies<br/>tenant security<br/>[00002_rls_gaps.sql]"]
end

subgraph group_intel["Destination &amp; AI"]
  node_destination_hub["Destination hub<br/>tabbed intelligence UI<br/>[DestinationHub.tsx]"]
  node_ai_actions["AI actions<br/>Gemini integration<br/>[ai.ts]"]
  node_destination_contracts["Destination data<br/>constants &amp; types<br/>[destinations.ts]"]
end

subgraph group_operations["Operations"]
  node_cache[("Cache<br/>Redis with memory fallback<br/>[cache.ts]")]
  node_observability["Analytics &amp; error tracking<br/>PostHog and Sentry"]
  node_pwa["Offline PWA<br/>service worker<br/>[sw.js]"]
end

node_auth_proxy -->|"guards requests"| node_app_router
node_app_router -->|"serves"| node_dashboard
node_app_router -->|"serves"| node_workspace_route
node_app_router -->|"serves"| node_trip_route
node_app_router -->|"provides session context"| node_auth_state
node_workspace_route -->|"renders"| node_workspace
node_workspace -->|"coordinates"| node_planning_steps
node_workspace -->|"reads and mutates"| node_server_actions
node_workspace -->|"completion feeds"| node_trip_view
node_trip_route -->|"renders"| node_trip_view
node_trip_view -->|"opens intelligence"| node_destination_hub
node_expenses -->|"persists expenses"| node_server_actions
node_server_actions -->|"uses"| node_repositories
node_repositories -->|"accesses"| node_supabase
node_domain_contracts -.->|"contracts"| node_repositories
node_auth_state -->|"auth session"| node_supabase
node_rls -->|"enforces tenancy"| node_supabase
node_destination_hub -->|"requests suggestions"| node_ai_actions
node_destination_hub -->|"uses typed data"| node_destination_contracts
node_ai_actions -.->|"caches optional responses"| node_cache
node_app_router -.->|"reports telemetry"| node_observability
node_app_router -.->|"offline support"| node_pwa

click node_app_router "https://github.com/geezdock/voyaq/blob/main/src/app/layout.tsx"
click node_auth_proxy "https://github.com/geezdock/voyaq/blob/main/src/proxy.ts"
click node_dashboard "https://github.com/geezdock/voyaq/blob/main/src/app/(dashboard)/dashboard/page.tsx"
click node_workspace_route "https://github.com/geezdock/voyaq/blob/main/src/app/workspace/%5Bid%5D/page.tsx"
click node_trip_route "https://github.com/geezdock/voyaq/blob/main/src/app/trip/%5Bid%5D/page.tsx"
click node_auth_state "https://github.com/geezdock/voyaq/blob/main/src/shared/providers/AuthContext.tsx"
click node_workspace "https://github.com/geezdock/voyaq/blob/main/src/features/workspace/components/WorkspaceView.tsx"
click node_planning_steps "https://github.com/geezdock/voyaq/blob/main/src/features/workspace/components/steps/TabDestinations.tsx"
click node_trip_view "https://github.com/geezdock/voyaq/blob/main/src/features/trip/components/TripView.tsx"
click node_expenses "https://github.com/geezdock/voyaq/blob/main/src/features/expense/components/ExpenseTracker.tsx"
click node_server_actions "https://github.com/geezdock/voyaq/blob/main/src/actions/data.ts"
click node_repositories "https://github.com/geezdock/voyaq/blob/main/src/lib/repositories/squad.ts"
click node_domain_contracts "https://github.com/geezdock/voyaq/blob/main/src/types/squad.ts"
click node_supabase "https://github.com/geezdock/voyaq/blob/main/src/services/supabase/server.ts"
click node_rls "https://github.com/geezdock/voyaq/blob/main/supabase/migrations/00002_rls_gaps.sql"
click node_destination_hub "https://github.com/geezdock/voyaq/blob/main/src/features/destination/components/DestinationHub.tsx"
click node_ai_actions "https://github.com/geezdock/voyaq/blob/main/src/actions/ai.ts"
click node_destination_contracts "https://github.com/geezdock/voyaq/blob/main/src/constants/destinations.ts"
click node_cache "https://github.com/geezdock/voyaq/blob/main/src/lib/cache.ts"
click node_observability "https://github.com/geezdock/voyaq/blob/main/src/shared/providers/AnalyticsProvider.tsx"
click node_pwa "https://github.com/geezdock/voyaq/blob/main/public/sw.js"

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_app_router,node_auth_proxy,node_dashboard,node_workspace_route,node_trip_route,node_auth_state toneBlue
class node_workspace,node_planning_steps,node_trip_view,node_expenses toneAmber
class node_server_actions,node_repositories,node_domain_contracts,node_supabase,node_rls toneMint
class node_destination_hub,node_ai_actions,node_destination_contracts toneRose
class node_cache,node_observability,node_pwa toneIndigo
```

## Components

### App entry & routes

- [App Router](https://github.com/geezdock/voyaq/blob/main/src/app/layout.tsx): Next.js entry · Public, dashboard, workspace, and trip route surface. · `src/app/layout.tsx`
- [Auth proxy](https://github.com/geezdock/voyaq/blob/main/src/proxy.ts): middleware · `src/proxy.ts`
- [Dashboard routes](https://github.com/geezdock/voyaq/blob/main/src/app/(dashboard)/dashboard/page.tsx): authenticated UI · `src/app/(dashboard)/dashboard/page.tsx`
- [Workspace route](https://github.com/geezdock/voyaq/blob/main/src/app/workspace/%5Bid%5D/page.tsx): planning route · `src/app/workspace/[id]/page.tsx`
- [Trip routes](https://github.com/geezdock/voyaq/blob/main/src/app/trip/%5Bid%5D/page.tsx): trip route · Finalized trip and destination hub entry points. · `src/app/trip/[id]/page.tsx`
- [Auth & squad state](https://github.com/geezdock/voyaq/blob/main/src/shared/providers/AuthContext.tsx): React providers · `src/shared/providers/AuthContext.tsx`

### Planning & trips

- [Consensus workspace](https://github.com/geezdock/voyaq/blob/main/src/features/workspace/components/WorkspaceView.tsx): planning orchestration · Coordinates membership, proposals, votes, budget, and polls. · `src/features/workspace/components/WorkspaceView.tsx`
- [Planning stages](https://github.com/geezdock/voyaq/blob/main/src/features/workspace/components/steps/TabDestinations.tsx): workspace tabs · Squad, destination, date, budget, and poll stages. · `src/features/workspace/components/steps/TabDestinations.tsx`
- [Trip summary](https://github.com/geezdock/voyaq/blob/main/src/features/trip/components/TripView.tsx): trip UI · `src/features/trip/components/TripView.tsx`
- [Expense tracker](https://github.com/geezdock/voyaq/blob/main/src/features/expense/components/ExpenseTracker.tsx): shared expense UI · Derives balances, settlements, and payment QR output. · `src/features/expense/components/ExpenseTracker.tsx`

### Data & domain

- [Data actions](https://github.com/geezdock/voyaq/blob/main/src/actions/data.ts): server actions · Coordinates application reads and mutations. · `src/actions/data.ts`
- [Squad & expense repositories](https://github.com/geezdock/voyaq/blob/main/src/lib/repositories/squad.ts): persistence adapters · `src/lib/repositories/squad.ts`
- [Squad & expense contracts](https://github.com/geezdock/voyaq/blob/main/src/types/squad.ts): shared types · `src/types/squad.ts`
- [Supabase](https://github.com/geezdock/voyaq/blob/main/src/services/supabase/server.ts): PostgreSQL, Auth & Realtime · `src/services/supabase/server.ts`
- [RLS policies](https://github.com/geezdock/voyaq/blob/main/supabase/migrations/00002_rls_gaps.sql): tenant security · Database policy boundary for squad access. · `supabase/migrations/00002_rls_gaps.sql`

### Destination & AI

- [Destination hub](https://github.com/geezdock/voyaq/blob/main/src/features/destination/components/DestinationHub.tsx): tabbed intelligence UI · Aggregates travel intelligence and recommendations. · `src/features/destination/components/DestinationHub.tsx`
- [AI actions](https://github.com/geezdock/voyaq/blob/main/src/actions/ai.ts): Gemini integration · Optional itinerary, tips, and budget requests. · `src/actions/ai.ts`
- [Destination data](https://github.com/geezdock/voyaq/blob/main/src/constants/destinations.ts): constants & types · `src/constants/destinations.ts`

### Operations

- [Cache](https://github.com/geezdock/voyaq/blob/main/src/lib/cache.ts): Redis with memory fallback · `src/lib/cache.ts`
- [Analytics & error tracking](https://github.com/geezdock/voyaq/blob/main/src/shared/providers/AnalyticsProvider.tsx): PostHog and Sentry · Client, server, and edge operational telemetry. · `src/shared/providers/AnalyticsProvider.tsx`
- [Offline PWA](https://github.com/geezdock/voyaq/blob/main/public/sw.js): service worker · Provides offline navigation fallback. · `public/sw.js`

## Connections

- Auth proxy → App Router: guards requests
- App Router → Dashboard routes: serves
- App Router → Workspace route: serves
- App Router → Trip routes: serves
- App Router → Auth & squad state: provides session context
- Workspace route → Consensus workspace: renders
- Consensus workspace → Planning stages: coordinates
- Consensus workspace → Data actions: reads and mutates
- Consensus workspace → Trip summary: completion feeds
- Trip routes → Trip summary: renders
- Trip summary → Destination hub: opens intelligence
- Expense tracker → Data actions: persists expenses
- Data actions → Squad & expense repositories: uses
- Squad & expense repositories → Supabase: accesses
- Squad & expense contracts → Squad & expense repositories: contracts
- Auth & squad state → Supabase: auth session
- RLS policies → Supabase: enforces tenancy
- Destination hub → AI actions: requests suggestions
- Destination hub → Destination data: uses typed data
- AI actions → Cache: caches optional responses
- App Router → Analytics & error tracking: reports telemetry
- App Router → Offline PWA: offline support
