# paultibe/roammates architecture

> Architecture diagram of the GitHub repository paultibe/roammates, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/paultibe/roammates
- Repository: https://github.com/paultibe/roammates

## Overview

##### High-Level Architecture Components

a) Frontend Layer (Next.js Application):
- Sub-components:
- Pages/Routes (showing the main flow: dashboard → who → where → when → voting → review)
- Components (shared UI elements)
- Client-side Authentication (Auth0 integration)

b) API Layer (Next.js API Routes):
- API endpoints:
- Auth endpoints (/api/auth/[auth0])
- Profile creation (/api/create-profile)

c) Backend Layer (Deno):
- This at the bottom
- Connection to data storage (data.json)

##### Component Relationships

a) Client-Side Flow:
- Component reuse relationships
- Authentication flow

b) Data Flow:
- API calls between frontend and backend
- Data persistence flow to storage
- Authentication flow with Auth0

##### Key Technical Elements to Highlight

Create dedicated sections or callouts for:

a) Authentication & Authorization:
- Auth0 integration
- Protected routes
- User sessions

b) State Management:
- Firebase integration (shown in /lib/firebase)
- User model handling

c) External Services:
- Google Places API (indicated by GooglePlacesInput component)
- Voiceflow integration (indicated by voiceflow-test route)

##### Specific Implementation Details

Technical annotations for:
- Next.js 13+ App Router architecture
- TypeScript implementation
- Tailwind CSS styling
- Firebase integration
- Deno backend

##### Additional Elements

Create sections showing:
- Development tools and configuration
- Build and deployment pipeline
- Environment configurations

##### Integration points with external services

- The application's core trip planning functionality
- The social aspects (mate selection, voting)
- The authentication and authorization flow
- Data persistence strategy
- External service integrations

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Frontend
        direction TB
        Dashboard["Dashboard"]:::frontend
        TripDash["Trip Dashboard"]:::frontend
        
        subgraph TripFlow
            direction TB
            Who["Who"]:::frontend
            Where["Where"]:::frontend
            When["When"]:::frontend
            Vote["Voting"]:::frontend
            Review["Review"]:::frontend
            
            Who --> Where
            Where --> When
            When --> Vote
            Vote --> Review
        end
        
        subgraph VotingSystem
            direction TB
            VoteProcess["Voting Process"]:::frontend
            VoteProgress["Voting Progress"]:::frontend
            VoteComplete["Voting Complete"]:::frontend
            ReadyVote["Ready to Vote"]:::frontend
            
            VoteProcess --> VoteProgress
            VoteProgress --> VoteComplete
            ReadyVote --> VoteProcess
        end
        
        subgraph UIComponents
            direction TB
            Layout["Layout"]:::frontend
            TextBox["Text Input"]:::frontend
            Mate["Mate Component"]:::frontend
            Places["Google Places Input"]:::frontend
        end
        
        subgraph UserManagement
            direction TB
            Profile["Create Profile"]:::frontend
            UserModel["User Model"]:::frontend
            Share["Share Roam"]:::frontend
        end
    end
    
    subgraph APILayer
        direction TB
        Auth["Auth API"]:::api
        ProfileAPI["Profile API"]:::api
    end
    
    subgraph ExternalServices
        direction TB
        Auth0["Auth0"]:::external
        Firebase["Firebase"]:::external
        FirebaseAdmin["Firebase Admin"]:::external
        GoogleAPI["Google Places API"]:::external
        Voiceflow["Voiceflow"]:::external
    end
    
    subgraph Backend
        direction TB
        DenoService["Deno Service"]:::backend
        DataStorage["Data Storage"]:::backend
        
        DenoService --> DataStorage
    end
    
    Dashboard --> TripFlow
    TripFlow --> VotingSystem
    APILayer --> ExternalServices
    Frontend --> APILayer
    APILayer --> Backend
    
    %% Click Events
    click DenoService "https://github.com/paultibe/roammates/blob/main/backend/main.ts"
    click DataStorage "https://github.com/paultibe/roammates/blob/main/backend/data.json"
    click Auth "https://github.com/paultibe/roammates/blob/main/frontend/app/api/auth/[auth0]/route.js"
    click ProfileAPI "https://github.com/paultibe/roammates/blob/main/frontend/app/api/create-profile/route.ts"
    click Who "https://github.com/paultibe/roammates/blob/main/frontend/app/who/page.tsx"
    click Where "https://github.com/paultibe/roammates/blob/main/frontend/app/where/page.tsx"
    click When "https://github.com/paultibe/roammates/blob/main/frontend/app/when/page.tsx"
    click Vote "https://github.com/paultibe/roammates/blob/main/frontend/app/voting/page.tsx"
    click Review "https://github.com/paultibe/roammates/blob/main/frontend/app/review/page.tsx"
    click Dashboard "https://github.com/paultibe/roammates/blob/main/frontend/app/dashboard/page.tsx"
    click TripDash "https://github.com/paultibe/roammates/blob/main/frontend/app/trip-dashboard/page.tsx"
    click VoteProcess "https://github.com/paultibe/roammates/blob/main/frontend/app/voting/page.tsx"
    click VoteProgress "https://github.com/paultibe/roammates/blob/main/frontend/app/voting-in-progress/page.tsx"
    click VoteComplete "https://github.com/paultibe/roammates/blob/main/frontend/app/voting-complete/page.tsx"
    click ReadyVote "https://github.com/paultibe/roammates/blob/main/frontend/app/ready-to-vote/page.tsx"
    click Places "https://github.com/paultibe/roammates/blob/main/frontend/components/GooglePlacesInput.tsx"
    click Firebase "https://github.com/paultibe/roammates/blob/main/frontend/lib/firebase/config.ts"
    click FirebaseAdmin "https://github.com/paultibe/roammates/blob/main/frontend/lib/firebase/admin.ts"
    click Voiceflow "https://github.com/paultibe/roammates/blob/main/frontend/app/voiceflow-test/page.tsx"
    click UserModel "https://github.com/paultibe/roammates/blob/main/frontend/lib/models/user.ts"
    click Profile "https://github.com/paultibe/roammates/blob/main/frontend/app/create-profile/page.tsx"
    click Mate "https://github.com/paultibe/roammates/blob/main/frontend/components/Mate.tsx"
    click Share "https://github.com/paultibe/roammates/blob/main/frontend/app/share-roam/page.tsx"
    click TextBox "https://github.com/paultibe/roammates/blob/main/frontend/components/TextBox.tsx"
    click Layout "https://github.com/paultibe/roammates/blob/main/frontend/app/layout.tsx"
    
    %% Styling
    classDef frontend fill:#2196F3,color:white
    classDef api fill:#4CAF50,color:white
    classDef external fill:#FFC107,color:black
    classDef backend fill:#9C27B0,color:white
    
    %% Legend
    subgraph Legend
        Frontend_L["Frontend"]:::frontend
        API_L["API"]:::api
        External_L["External Services"]:::external
        Backend_L["Backend"]:::backend
    end
```
