# joreilly/confetti architecture

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

- Interactive diagram: https://gitdiagram.com/joreilly/confetti
- Repository: https://github.com/joreilly/confetti

## Overview

##### Project type and purpose
- Confetti is a full-stack, Kotlin Multiplatform (KMP) GraphQL application. It consists of:
- A GraphQL backend (Ktor/Apollo) with a data-import microservice and a datastore layer.
- Multiple Compose Multiplatform clients: Android, iOS (SwiftUI host), Desktop, Web (WASM+JS), Wear OS, Automotive OS/Android Auto, and Android Car OS.
- Shared KMP libraries (business logic, Apollo client, models, DI) and protobuf definitions.
- CI/CD scripts (GitHub Actions), build-logic plugins, and Terraform for infra.

##### File-structure analysis
- Top-level clients:
- androidApp, iosApp, compose-desktop, compose-web, wearApp, automotiveApp, common/car
- Shared code:
- shared (KMP business logic + Apollo), proto (shared proto definitions)
- Backend services:
- backend/service-graphql (GraphQL server), backend/service-import (data importer), backend/datastore (datastore abstraction), backend/terraform (infra as code)
- Build & deployment:
- build-logic (custom Gradle tasks), .github/workflows (CI/CD pipelines), fastlane (iOS/Android store publishing)

##### Key README insights
- Uses Apollo GraphQL for client/server schema sharing.
- Clients talk to GraphQL endpoint at confetti-app.dev/graphql.
- Data import service populates the datastore (Firebase Datastore or Cloud Datastore).
- CI/CD deploys backend to Cloud Run/App Engine; clients to app stores.

##### Main components
- Android App
- iOS App (SwiftUI host)
- Desktop App (Compose Desktop)
- Web App (Kotlin WASM + JS)
- Wear OS App
- Automotive OS & Android Auto App
- Android Car App
b. Shared library (Kotlin Multiplatform):
- Business logic, models, Apollo client, DI
c. GraphQL Backend service:
- HTTP API (Apollo/Ktor)
- Resolvers → DataSource layers
d. Data Import microservice:
- Pulls from external conference data sources (Sessionize, DeepAI, etc.)
- Writes to the datastore
e. Datastore layer:
- backend/datastore module abstracts Google Cloud Datastore (or Firestore)
f. Infrastructure & CI/CD:
- Terraform provisioning (Cloud Run, App Engine, Firestore)
- GitHub Actions pipelines (build/test/deploy)
- Fastlane for mobile store publishing
g. External services:
- Gemini API (optional recommendations)
- Firebase Auth & Analytics
- Google Play Services (sign-in)

##### Relationships & interactions
- GraphQL Backend → Datastore module → Cloud Datastore/Firestore
- Data Import service → Datastore module → Cloud Datastore/Firestore
- Terraform → provisions Cloud Run/App Engine, Datastore
- CI/CD pipelines → build & deploy code to clients and backend
- Clients & backend share schemas via Apollo GraphQL & proto definitions

##### Architectural patterns & principles
- Modular KMP layers: UI layers per platform, shared business logic.
- Microservices: GraphQL API service vs import service vs datastore abstraction.
- Dependency injection via Koin (in shared and platform modules).
- Infrastructure as code (Terraform) and automated pipelines.
- GraphQL schema serving as contract between frontends and backend.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Clients Layer
    subgraph "Clients"
        direction TB
        AndroidApp["Android App<br/>(Compose Multiplatform)"]:::client
        IOSApp["iOS App<br/>(SwiftUI host)"]:::client
        DesktopApp["Desktop App<br/>(Compose Desktop)"]:::client
        WebApp["Web App<br/>(WASM + JS)"]:::client
        WearApp["Wear OS App"]:::client
        AutomotiveApp["Automotive OS & Android Auto App"]:::client
        CarApp["Android Car App"]:::client
    end

    %% Shared Library
    subgraph "Shared Kotlin Multiplatform"
        direction TB
        SharedLib["Shared Library<br/>(Business Logic, Models, Apollo Client, DI)"]:::shared
        Protos["Protobuf Definitions"]:::shared
    end

    %% Backend Services
    subgraph "Backend Services"
        direction TB
        GraphQLService["GraphQL Backend Service<br/>(Ktor + Apollo)"]:::backend
        ImportService["Data Import Microservice"]:::backend
    end

    %% Datastore Layer
    subgraph "Datastore"
        direction TB
        DatastoreLayer["Datastore Abstraction Layer"]:::datastore
        CloudDatastore["Cloud Datastore / Firestore"]:::external
    end

    %% Infra & CI/CD
    subgraph "Infrastructure & CI/CD"
        direction TB
        Terraform["Terraform (IaC)"]:::infra
        Pipelines["GitHub Actions CI/CD"]:::infra
        Fastlane["Fastlane (Mobile Publishing)"]:::infra
        BuildLogic["Custom Gradle Build Logic"]:::infra
        CloudRun["Cloud Run / App Engine"]:::external
    end

    %% External Services
    subgraph "External Services"
        direction TB
        GeminiAPI["Gemini API (Recommendations)"]:::external
        FirebaseServices["Firebase Auth & Analytics"]:::external
        GooglePlayServices["Google Play Services"]:::external
    end

    %% Relationships
    AndroidApp -->|uses| SharedLib
    IOSApp -->|uses| SharedLib
    DesktopApp -->|uses| SharedLib
    WebApp -->|uses| SharedLib
    WearApp -->|uses| SharedLib
    AutomotiveApp -->|uses| SharedLib
    CarApp -->|uses| SharedLib

    SharedLib -->|GraphQL Queries| GraphQLService
    SharedLib -->|Schema Sharing| Protos
    Protos ---|shared definitions| GraphQLService

    GraphQLService -->|resolves| DatastoreLayer
    ImportService -->|writes to| DatastoreLayer
    DatastoreLayer -->|CRUD| CloudDatastore

    GraphQLService -->|optional recommendations| GeminiAPI
    AndroidApp -.->|auth| FirebaseServices
    IOSApp -.->|auth| FirebaseServices
    AndroidApp -.->|sign-in| GooglePlayServices

    Terraform -->|provisions| CloudRun
    Terraform -->|provisions| CloudDatastore
    Pipelines -->|deploy backend| GraphQLService
    Pipelines -->|deploy clients| AndroidApp
    Pipelines -->|deploy clients| IOSApp
    Pipelines -->|deploy clients| DesktopApp
    Pipelines -->|deploy clients| WebApp
    Pipelines -->|deploy clients| WearApp
    Pipelines -->|deploy clients| AutomotiveApp
    Pipelines -->|deploy clients| CarApp
    Pipelines -->|run Fastlane| Fastlane
    Fastlane -->|publishes| AndroidApp
    Fastlane -->|publishes| IOSApp
    Pipelines -->|uses| BuildLogic

    %% Click events
    click AndroidApp "https://github.com/joreilly/confetti/tree/main/androidApp/"
    click IOSApp "https://github.com/joreilly/confetti/tree/main/iosApp/"
    click DesktopApp "https://github.com/joreilly/confetti/tree/main/compose-desktop/"
    click WebApp "https://github.com/joreilly/confetti/tree/main/compose-web/"
    click WearApp "https://github.com/joreilly/confetti/tree/main/wearApp/"
    click AutomotiveApp "https://github.com/joreilly/confetti/tree/main/automotiveApp/"
    click CarApp "https://github.com/joreilly/confetti/tree/main/common/car/"
    click SharedLib "https://github.com/joreilly/confetti/tree/main/shared/"
    click Protos "https://github.com/joreilly/confetti/tree/main/proto/"
    click GraphQLService "https://github.com/joreilly/confetti/tree/main/backend/service-graphql/"
    click ImportService "https://github.com/joreilly/confetti/tree/main/backend/service-import/"
    click DatastoreLayer "https://github.com/joreilly/confetti/tree/main/backend/datastore/"
    click Terraform "https://github.com/joreilly/confetti/tree/main/backend/terraform/"
    click Pipelines "https://github.com/joreilly/confetti/tree/main/.github/workflows/"
    click Fastlane "https://github.com/joreilly/confetti/tree/main/fastlane/"
    click BuildLogic "https://github.com/joreilly/confetti/tree/main/build-logic/"

    %% Styles
    classDef client fill:#bbdefb,stroke:#2196f3,color:#0d47a1
    classDef shared fill:#c8e6c9,stroke:#388e3c,color:#1b5e20
    classDef backend fill:#ffe0b2,stroke:#f57c00,color:#e65100
    classDef datastore fill:#fff9c4,stroke:#fbc02d,color:#f57f17
    classDef infra fill:#e1bee7,stroke:#8e24aa,color:#4a148c
    classDef external fill:#eceff1,stroke:#90a4ae,color:#455a64
```
