# indie-collective/community architecture

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

- Interactive diagram: https://gitdiagram.com/indie-collective/community
- Repository: https://github.com/indie-collective/community

## Overview

##### Project Type and Purpose
- This is a full-stack web application built with the Remix framework (React on the client + server-side routes), Node.js, and PostgreSQL via the Prisma ORM.
- It serves as a community platform for events, games, and organizations, featuring user authentication (OAuth and e-mail/password), file uploads, map search, and external data integrations (IGDB, map services).

##### Key Architectural Components
a. Frontend (Client)
- Hosted in the browser.
- React components under app/components/ and app/hooks/.
- Remix “entry.client.jsx” bootstraps the client bundle.
- Handles UI state, form actions, map rendering, and API calls via Remix loaders/actions.

b. Backend (Server / Remix Node.js)
- Entry point: app/entry.server.jsx.
- Routes under app/routes/** define loader (GET) and action (POST/PUT/DELETE) functions.
- Central utilities in app/utils/**:
– db.server.js: Prisma client for PostgreSQL
– session.server.js & auth.server.js: session & authentication logic
– email.server.js: transactional e-mail service
– igdb.server.js, imageLinks.server.js: external API wrappers
- File upload handler: createUploadHandler.server.js

c. Database
- PostgreSQL instance
- Prisma schema (prisma/schema.prisma) and migration history (prisma/migrations/**).

d. External Services
- OAuth providers: GitHub, Discord, Steam, Twitter (app/routes/auth/*).
- IGDB API for game metadata.
- Mapbox/Photon for geocoding and map tiles.
- E-mail provider (SES/SMTP).
- Static assets served from public/.

##### Interactions & Data Flow
- User → Browser UI (React) → Remix route loader/action
- Remix server → Prisma client → PostgreSQL
- Remix server → External APIs (IGDB, Mapbox, E-mail)
- Server ↔ Cookie/session store (in Postgres or signed cookies)
- File uploads → createUploadHandler → Cloud storage / CDN

##### Architectural Patterns & Principles
- MVC-ish: app/routes (controllers), app/models & Prisma (models), app/components (views).
- Single-page application hydration via Remix streaming.
- Separation of concerns: UI vs. data access vs. integrations.
- Declarative routing: filesystem-based under app/routes.
- Modular services in app/utils for each external integration.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    subgraph "Client Layer"
        direction TB
        EntryClient["entry.client.jsx"]:::internal
        ReactComponents["app/components/"]:::internal
        CustomHooks["app/hooks/"]:::internal
        RemixRoot["app/root.jsx"]:::internal
    end

    %% Server Layer
    subgraph "Server Layer"
        direction TB
        EntryServer["entry.server.jsx"]:::internal
        RouteHandlers["app/routes/"]:::internal
        subgraph "Utilities"
            direction TB
            AuthUtils["auth.server.js"]:::internal
            SessionMgmt["session.server.js"]:::internal
            DBClient["db.server.js"]:::internal
            EmailService["email.server.js"]:::internal
            IGDBService["igdb.server.js"]:::internal
            ImageLinks["imageLinks.server.js"]:::internal
            FileUploadHandler["createUploadHandler.server.js"]:::internal
            SearchUtils["search.server.js"]:::internal
        end
        DomainModels["app/models/"]:::internal
    end

    %% Persistence Layer
    subgraph "Persistence Layer"
        direction TB
        PrismaClientCylinder(("Prisma Client")):::internal
        PostgreSQL(("PostgreSQL")):::db
        PrismaSchema["prisma/schema.prisma"]:::internal
        PrismaMigrations["prisma/migrations/"]:::internal
    end

    %% External Services
    subgraph "External Services"
        direction TB
        OAuthProviders(("OAuth Providers")):::external
        IGDBAPI(("IGDB API")):::external
        Mapbox(("Mapbox/Photon")):::external
        EmailProvider(("E-mail Service")):::external
        CloudStorage(("Cloud Storage/CDN")):::external
    end

    %% Connections
    EntryClient -->|"HTTP Request"| EntryServer
    ReactComponents --> EntryClient
    CustomHooks --> EntryClient
    RemixRoot --> EntryClient

    EntryServer --> RouteHandlers
    RouteHandlers --> DomainModels
    RouteHandlers --> DBClient
    RouteHandlers --> AuthUtils
    RouteHandlers --> SessionMgmt
    RouteHandlers --> EmailService
    RouteHandlers --> IGDBService
    RouteHandlers --> ImageLinks
    RouteHandlers --> FileUploadHandler
    RouteHandlers --> SearchUtils

    DBClient --> PrismaClientCylinder
    PrismaClientCylinder --> PostgreSQL
    SessionMgmt <--> PostgreSQL

    AuthUtils --> OAuthProviders
    IGDBService -.-> IGDBAPI
    SearchUtils -.-> Mapbox
    EmailService -.-> EmailProvider
    FileUploadHandler -.-> CloudStorage

    %% Migrations and Schema
    PrismaSchema --> PostgreSQL
    PrismaMigrations --> PostgreSQL

    %% Click Events
    click EntryClient "https://github.com/indie-collective/community/blob/main/app/entry.client.jsx"
    click ReactComponents "https://github.com/indie-collective/community/tree/main/app/components/"
    click CustomHooks "https://github.com/indie-collective/community/tree/main/app/hooks/"
    click RemixRoot "https://github.com/indie-collective/community/blob/main/app/root.jsx"
    click EntryServer "https://github.com/indie-collective/community/blob/main/app/entry.server.jsx"
    click RouteHandlers "https://github.com/indie-collective/community/tree/main/app/routes/"
    click AuthUtils "https://github.com/indie-collective/community/blob/main/app/utils/auth.server.js"
    click SessionMgmt "https://github.com/indie-collective/community/blob/main/app/utils/session.server.js"
    click DBClient "https://github.com/indie-collective/community/blob/main/app/utils/db.server.js"
    click EmailService "https://github.com/indie-collective/community/blob/main/app/utils/email.server.js"
    click IGDBService "https://github.com/indie-collective/community/blob/main/app/utils/igdb.server.js"
    click ImageLinks "https://github.com/indie-collective/community/blob/main/app/utils/imageLinks.server.js"
    click FileUploadHandler "https://github.com/indie-collective/community/blob/main/app/utils/createUploadHandler.server.js"
    click SearchUtils "https://github.com/indie-collective/community/blob/main/app/utils/search.server.js"
    click DomainModels "https://github.com/indie-collective/community/tree/main/app/models/"
    click PrismaSchema "https://github.com/indie-collective/community/blob/main/prisma/schema.prisma"
    click PrismaMigrations "https://github.com/indie-collective/community/tree/main/prisma/migrations/"

    %% Styles
    classDef internal fill:#D6EAF8,stroke:#1F618D,color:#1B4F72;
    classDef db fill:#FCF3CF,stroke:#B7950B,color:#7D6608,stroke-width:2px;
    classDef external fill:#E8DAEF,stroke:#7D3C98,color:#633974,stroke-dasharray: 5 5;
    classDef internalStroke stroke-width:2px;
```
