# psycho-baller/convo-topics architecture

> Architecture diagram of the GitHub repository psycho-baller/convo-topics, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/psycho-baller/convo-topics
- Repository: https://github.com/psycho-baller/convo-topics

## Overview

##### Main System Components

The system architecture should be divided into these key components:

a) Client Applications:
- Expo Mobile App (iOS/Android)
- Next.js Web App
- Marketing Website

b) Backend Services:
- Auth Proxy Service
- tRPC API Layer
- Authentication Service (Auth.js)
- Database Layer (Drizzle ORM + Turso SQLite)

c) Shared Packages:
- UI Components (Tamagui)
- API Definitions
- Database Schema
- Authentication Logic

**[Client Layer]**

- Expo App     |  |   Next.js App |  |   Marketing   |
- (Mobile/Native)|  |   (Web App)   |  |   Website     |

- ↓                 ↓                  ↓

**[API/Communication Layer]   |                  |**

- tRPC Router                |    |

- ↓                 ↓                  ↓
**[Service Layer]**

- Auth Service  |  |  Local API    |  |  Server API   |
- (Auth.js Core) |  |  (Questions)  |  |  (Backend)    |

- ↓                 ↓                  ↓
**[Data Layer]**

- Drizzle ORM Layer            |

- ↓

- Turso SQLite DB              |

##### Important Relationships to Highlight

- Bidirectional communication between clients and tRPC router
- Shared package usage across applications
- Authentication flow through Auth Proxy
- Database access patterns through Drizzle ORM

##### Technical Stack Indicators

- React/React Native
- Expo
- Next.js
- Tamagui
- tRPC
- Drizzle
- Turso
- TypeScript

##### Development Workflow

A separate section showing:
- Monorepo structure (Turborepo)
- Shared package dependencies
- Build/deployment flow

Remember to emphasize the core functionality of question management and relationship building, as this is the primary purpose of the application.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        ExpoApp["Expo Mobile App"]:::client
        NextApp["Next.js Web App"]:::client
        Marketing["Marketing Website"]:::client
    end

    subgraph API
        tRPC["tRPC Router"]:::api
        AuthProxy["Auth Proxy Service"]:::api
    end

    subgraph Services
        AuthService["Authentication Service"]:::service
        LocalAPI["Local API (Questions)"]:::service
        ServerAPI["Server API (Backend)"]:::service
    end

    subgraph Features
        BLE["BLE Proximity"]:::feature
        Questions["Question Management"]:::feature
        Groups["Group Management"]:::feature
        People["People Management"]:::feature
        Search["Search"]:::feature
        Navigation["Cross-platform Navigation"]:::feature
    end

    subgraph Data
        ORM["Drizzle ORM Layer"]:::data
        DB["Turso SQLite DB"]:::data
    end

    subgraph Shared
        UI["UI Components (Tamagui)"]:::shared
        APIdef["API Definitions"]:::shared
        DBSchema["Database Schema"]:::shared
        AuthLogic["Authentication Logic"]:::shared
    end

    ExpoApp --> tRPC
    NextApp --> tRPC
    Marketing --> AuthProxy
    
    tRPC --> AuthService
    tRPC --> LocalAPI
    tRPC --> ServerAPI
    AuthProxy --> AuthService
    
    AuthService --> ORM
    LocalAPI --> ORM
    ServerAPI --> ORM
    
    ORM --> DB

    ExpoApp --> Features
    NextApp --> Features
    
    Features --> Shared
    Services --> Shared

    %% Click events for component mapping
    click ExpoApp "https://github.com/psycho-baller/convo-topics/tree/main/apps/expo/"
    click NextApp "https://github.com/psycho-baller/convo-topics/tree/main/apps/nextjs/"
    click Marketing "https://github.com/psycho-baller/convo-topics/tree/main/apps/marketing/"
    click AuthProxy "https://github.com/psycho-baller/convo-topics/tree/main/apps/auth-proxy/"
    click tRPC "https://github.com/psycho-baller/convo-topics/tree/main/packages/server-api/"
    click AuthService "https://github.com/psycho-baller/convo-topics/tree/main/packages/auth/"
    click ORM "https://github.com/psycho-baller/convo-topics/tree/main/packages/server-db/"
    click UI "https://github.com/psycho-baller/convo-topics/tree/main/packages/ui/"
    click APIdef "https://github.com/psycho-baller/convo-topics/tree/main/packages/queries/"
    click DBSchema "https://github.com/psycho-baller/convo-topics/tree/main/packages/local-db/schema/"
    click AuthLogic "https://github.com/psycho-baller/convo-topics/tree/main/packages/auth/"
    click BLE "https://github.com/psycho-baller/convo-topics/tree/main/packages/custom-modules/react-native-ble-advertise/"
    click Questions "https://github.com/psycho-baller/convo-topics/tree/main/packages/app/features/questions/"
    click Groups "https://github.com/psycho-baller/convo-topics/tree/main/packages/app/features/groups/"
    click People "https://github.com/psycho-baller/convo-topics/tree/main/packages/app/features/people/"
    click Search "https://github.com/psycho-baller/convo-topics/tree/main/packages/app/features/search/"
    click Navigation "https://github.com/psycho-baller/convo-topics/tree/main/packages/app/provider/"

    %% Styling
    classDef client fill:#2374ab
    classDef api fill:#48a9a6
    classDef service fill:#e4cc37
    classDef data fill:#d96941
    classDef shared fill:#9c89b8
    classDef feature fill:#75b9be

    %% Legend
    subgraph Legend
        Client1[Client Applications]:::client
        API1[API Layer]:::api
        Service1[Services]:::service
        Data1[Data Layer]:::data
        Shared1[Shared Packages]:::shared
        Feature1[Features]:::feature
    end
```
