# t3dotgg/1app5stacks architecture

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

- Interactive diagram: https://gitdiagram.com/t3dotgg/1app5stacks
- Repository: https://github.com/t3dotgg/1app5stacks

## Overview

##### High-Level Overview

- Central Core (Application Concept)
- Common Features
- Pokemon Voting System
- Results Display
- Data Persistence

- Five Implementation Branches

A. Ruby on Rails Version
**Components:**
- MVC Architecture
- Models (Pokemon, Vote)
- Controllers (Home, Pokemons)
- Views (ERB templates)
- Asset Pipeline
- Active Record ORM
- Tailwind CSS

B. Elixir + Phoenix Version
**Components:**
- Phoenix Framework
- LiveView Components
- Controllers
- Templates (HEEX)
- Contexts
- Ecto (Database Layer)
- Asset Management

C. Go + GraphQL + React SPA
**Components:**
- Backend (Go)
- GraphQL Server
- Database Layer
- Schema Definitions
- Frontend (React)
- Apollo Client
- React Components
- TypeScript Integration

D. T3 Stack Version
**Components:**
- Next.js Pages
- tRPC API Layer
- Prisma ORM
- TypeScript
- React Components

E. Next.js RSC Version
**Components:**
- App Router
- React Server Components
- Server Actions
- API Routes
- Utils Layer

##### Key Elements to Highlight

For each implementation, emphasize:
- Request/response flow
- Data persistence strategy
- State management
- API architecture
- Frontend-backend communication

##### Common Patterns

Shared patterns across implementations:
- Database schema structure
- Route organization
- Asset handling
- Pokemon data management
- Voting mechanism

##### Implementation-Specific Details

Unique features for each stack:
- Rails: Convention over configuration
- Phoenix: LiveView real-time features
- Go/GraphQL: Schema-driven API
- T3: End-to-end type safety
- RSC: Server component architecture

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Core["Core Application Concept"]
        Features["Common Features"]
        PVS["Pokemon Voting System"]
        RD["Results Display"]
        DP["Data Persistence"]
        
        Features --> PVS
        Features --> RD
        Features --> DP
    end

    subgraph Rails["Ruby on Rails Implementation"]
        direction TB
        RailsMVC["MVC Architecture"]
        RailsModels["Models"]:::backend
        RailsControllers["Controllers"]:::backend
        RailsViews["Views"]:::frontend
        RailsAssets["Asset Pipeline"]:::frontend
        RailsORM["Active Record ORM"]:::database
        
        RailsMVC --> RailsModels
        RailsMVC --> RailsControllers
        RailsMVC --> RailsViews
        RailsControllers --> RailsViews
        RailsModels --> RailsORM
        RailsAssets --> RailsViews
    end

    subgraph Phoenix["Elixir + Phoenix Implementation"]
        direction TB
        PhoenixCore["Phoenix Framework"]
        LiveView["LiveView Components"]:::frontend
        PhoenixControllers["Controllers"]:::backend
        PhoenixTemplates["Templates (HEEX)"]:::frontend
        PhoenixContexts["Contexts"]:::backend
        Ecto["Ecto Database Layer"]:::database
        
        PhoenixCore --> LiveView
        PhoenixCore --> PhoenixControllers
        PhoenixCore --> PhoenixTemplates
        PhoenixCore --> PhoenixContexts
        PhoenixContexts --> Ecto
    end

    subgraph GoGraphQL["Go + GraphQL + React SPA"]
        direction TB
        Backend["Backend (Go)"]:::backend
        GraphQLServer["GraphQL Server"]:::api
        DBLayer["Database Layer"]:::database
        Schema["Schema Definitions"]:::api
        Frontend["Frontend (React)"]:::frontend
        Apollo["Apollo Client"]:::frontend
        ReactComps["React Components"]:::frontend
        TypeScript["TypeScript Integration"]:::frontend
        
        Backend --> GraphQLServer
        Backend --> DBLayer
        GraphQLServer --> Schema
        Frontend --> Apollo
        Frontend --> ReactComps
        Frontend --> TypeScript
        Apollo --> GraphQLServer
    end

    subgraph T3["T3 Stack Implementation"]
        direction TB
        NextPages["Next.js Pages"]:::frontend
        TRPC["tRPC API Layer"]:::api
        PrismaORM["Prisma ORM"]:::database
        T3TypeScript["TypeScript"]:::frontend
        T3React["React Components"]:::frontend
        
        NextPages --> TRPC
        TRPC --> PrismaORM
        T3React --> NextPages
        T3TypeScript --> T3React
    end

    subgraph RSC["Next.js RSC Implementation"]
        direction TB
        AppRouter["App Router"]:::frontend
        ServerComps["React Server Components"]:::backend
        ServerActions["Server Actions"]:::backend
        RSCApi["API Routes"]:::api
        Utils["Utils Layer"]:::backend
        
        AppRouter --> ServerComps
        ServerComps --> ServerActions
        ServerActions --> RSCApi
        ServerActions --> Utils
    end

    Core --> Rails
    Core --> Phoenix
    Core --> GoGraphQL
    Core --> T3
    Core --> RSC

    %% Component Mappings
    click RailsModels "https://github.com/t3dotgg/1app5stacks/tree/main/rails-version/app/models"
    click RailsControllers "https://github.com/t3dotgg/1app5stacks/tree/main/rails-version/app/controllers"
    click RailsViews "https://github.com/t3dotgg/1app5stacks/tree/main/rails-version/app/views"
    click RailsAssets "https://github.com/t3dotgg/1app5stacks/tree/main/rails-version/app/assets"
    click LiveView "https://github.com/t3dotgg/1app5stacks/tree/main/elixir-version/lib/roundest_phoenix_web/live"
    click PhoenixControllers "https://github.com/t3dotgg/1app5stacks/tree/main/elixir-version/lib/roundest_phoenix_web/controllers"
    click PhoenixTemplates "https://github.com/t3dotgg/1app5stacks/tree/main/elixir-version/lib/roundest_phoenix_web/controllers/pokemon_html"
    click Ecto "https://github.com/t3dotgg/1app5stacks/blob/main/elixir-version/lib/roundest_phoenix/repo.ex"
    click GraphQLServer "https://github.com/t3dotgg/1app5stacks/tree/main/go-graphql-spa-version/go-gql-server"
    click Frontend "https://github.com/t3dotgg/1app5stacks/tree/main/go-graphql-spa-version/react-gql-spa"
    click Apollo "https://github.com/t3dotgg/1app5stacks/tree/main/go-graphql-spa-version/react-gql-spa/src/utils/apollo"
    click ReactComps "https://github.com/t3dotgg/1app5stacks/tree/main/go-graphql-spa-version/react-gql-spa/src/routes"
    click AppRouter "https://github.com/t3dotgg/1app5stacks/tree/main/next-rsc-version/src/app"
    click ServerActions "https://github.com/t3dotgg/1app5stacks/tree/main/next-rsc-version/src/sdk"
    click Utils "https://github.com/t3dotgg/1app5stacks/tree/main/next-rsc-version/src/utils"
    click RSCApi "https://github.com/t3dotgg/1app5stacks/blob/main/next-rsc-version/src/app/sprite/[spritename]/route.ts"
    click TRPC "https://github.com/t3dotgg/1app5stacks/tree/main/t3-stack-version/src/server/api"
    click PrismaORM "https://github.com/t3dotgg/1app5stacks/tree/main/t3-stack-version/prisma"
    click NextPages "https://github.com/t3dotgg/1app5stacks/tree/main/t3-stack-version/src/pages"
    click T3React "https://github.com/t3dotgg/1app5stacks/tree/main/t3-stack-version/src/utils"

    classDef frontend fill:#3498db
    classDef backend fill:#2ecc71
    classDef database fill:#f1c40f
    classDef api fill:#e74c3c
    classDef utility fill:#9b59b6
```
