# ixahmedxi/orbitkit architecture

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

- Interactive diagram: https://gitdiagram.com/ixahmedxi/orbitkit
- Repository: https://github.com/ixahmedxi/orbitkit

## Overview

##### Project Type & Purpose
- This is a Turborepo‐based monorepo scaffold (“OrbitKit”) that bundles:
- A **marketing site** (Astro)
- A **documentation site** (Mintlify/Astro)
- A **web application** (Next.js)
- A **type‐safe tRPC API** server
- Shared **utility**, **UI**, **auth**, **db** and **config** packages
- Purpose: Provide a fully opinionated, end‑to‑end starter for SaaS‐style products, including CI/CD, analytics, monitoring, authentication, ORM, file uploads, and theming.

##### File Structure Analysis
- **Top‑level orchestration**:
- `turbo.json` & root `package.json` drive Turborepo commands.
- Preconfigured **Lint**, **Prettier**, **ESLint**, **Husky**, **Changesets**, **GitHub Actions** for CI/CD.
- **Apps/**:
- `apps/marketing` – a public Astro site with Tailwind, PostHog instrumentation.
- `apps/docs` – documentation site powered by Mintlify/Astro.
- `apps/web` – Next.js app with tRPC routes, Uploadthing, Lucia Auth, PostHog, Sentry.
- **Packages/** (shared code):
- `packages/api` – tRPC router definitions; entry point for API server.
- `packages/auth` – Lucia authentication integration (providers: GitHub, Google).
- `packages/db` – Drizzle ORM schemas & Neon DB config.
- `packages/ui` – Shadcn/Radix UI primitives & Storybook.
- `packages/env` – typed environment variables per app.
- `packages/utils` & `packages/core` – general utilities and core logic.
- `packages/config/*` – centralized ESLint, Tailwind, Vite, TSConfig, Storybook presets.
- `packages/assets` – font assets.
- **CI/CD & Dev Tooling**:
- `.github/workflows` – build, test, release, PR cleanup.
- `scripts/` – workspace update helpers.

##### README Insights
- Tech stack: TypeScript, Astro, Next.js, tRPC, Drizzle ORM, Neon DB, Uploadthing, PostHog, Sentry, Lucia Auth, Tailwind CSS, Shadcn UI, Storybook, Turborepo.
- Emphasis on type‐safety, monorepo scale, ESM only.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Monorepo Root
    MonorepoRoot["Monorepo Root<br/>Turborepo Orchestrator<br/>CI/CD Config"]:::monorepo
    click MonorepoRoot "https://github.com/ixahmedxi/orbitkit/blob/main/turbo.json"

    %% Config Packages
    subgraph "Config Packages"
        ESLint["ESLint Config"]:::config
        TailwindCfg["Tailwind Config"]:::config
        ViteCfg["Vite Config"]:::config
        TSConfig["TSConfig"]:::config
        StorybookCfg["Storybook Config"]:::config
    end
    click ESLint "https://github.com/ixahmedxi/orbitkit/tree/main/packages/config/eslint"
    click TailwindCfg "https://github.com/ixahmedxi/orbitkit/tree/main/packages/config/tailwind"
    click ViteCfg "https://github.com/ixahmedxi/orbitkit/tree/main/packages/config/vite"
    click TSConfig "https://github.com/ixahmedxi/orbitkit/tree/main/packages/config/tsconfig"
    click StorybookCfg "https://github.com/ixahmedxi/orbitkit/tree/main/packages/config/storybook"

    %% Shared Packages
    subgraph "Shared Packages"
        UIlib["UI Library<br/>Shadcn/Radix + Storybook"]:::shared
        AuthPkg["Auth Layer<br/>Lucia Auth"]:::backend
        DBpkg["DB Layer<br/>Drizzle ORM"]:::backend
        APIpkg["API Layer<br/>tRPC Routers"]:::backend
        EnvPkg["Env Variables"]:::shared
        CorePkg["Core Logic"]:::shared
        UtilsPkg["Utilities"]:::shared
        AssetsPkg["Assets<br/>Fonts"]:::shared
    end
    click UIlib "https://github.com/ixahmedxi/orbitkit/tree/main/packages/ui/src"
    click AuthPkg "https://github.com/ixahmedxi/orbitkit/tree/main/packages/auth/src"
    click DBpkg "https://github.com/ixahmedxi/orbitkit/tree/main/packages/db/src"
    click APIpkg "https://github.com/ixahmedxi/orbitkit/tree/main/packages/api/src"
    click EnvPkg "https://github.com/ixahmedxi/orbitkit/tree/main/packages/env/src"
    click CorePkg "https://github.com/ixahmedxi/orbitkit/tree/main/packages/core/src"
    click UtilsPkg "https://github.com/ixahmedxi/orbitkit/tree/main/packages/utils/src"
    click AssetsPkg "https://github.com/ixahmedxi/orbitkit/tree/main/packages/assets/fonts"

    %% Applications
    subgraph "Apps"
        Marketing["Marketing Site<br/>Astro + Tailwind + PostHog"]:::frontend
        Docs["Docs Site<br/>Mintlify/Astro"]:::frontend
        WebApp["Web App<br/>Next.js + tRPC + Uploadthing + Lucia Auth + PostHog + Sentry"]:::frontend
    end
    click Marketing "https://github.com/ixahmedxi/orbitkit/tree/main/apps/marketing"
    click Docs "https://github.com/ixahmedxi/orbitkit/tree/main/apps/docs"
    click WebApp "https://github.com/ixahmedxi/orbitkit/tree/main/apps/web"

    %% External Services
    PostHog["PostHog"]:::external
    Sentry["Sentry"]:::external
    Uploadthing["Uploadthing"]:::external
    NeonDB["Neon DB"]:::external
    Unkey["Unkey"]:::external
    GitHubAuth["GitHub OAuth"]:::external
    GoogleAuth["Google OAuth"]:::external

    %% Connections: Monorepo to Config & Shared
    MonorepoRoot -->|uses| ESLint
    MonorepoRoot -->|uses| TailwindCfg
    MonorepoRoot -->|uses| ViteCfg
    MonorepoRoot -->|uses| TSConfig
    MonorepoRoot -->|uses| StorybookCfg
    MonorepoRoot -->|manages| UIlib
    MonorepoRoot -->|manages| AuthPkg
    MonorepoRoot -->|manages| DBpkg
    MonorepoRoot -->|manages| APIpkg
    MonorepoRoot -->|manages| EnvPkg
    MonorepoRoot -->|manages| CorePkg
    MonorepoRoot -->|manages| UtilsPkg
    MonorepoRoot -->|manages| AssetsPkg

    %% Apps depend on shared packages
    Marketing -->|imports UI, Env, Utils| UIlib
    Marketing -->|imports UI, Env, Utils| EnvPkg
    Marketing -->|imports UI, Env, Utils| UtilsPkg
    Marketing -->|send events via HTTP| PostHog
    Marketing -->|send errors via HTTP| Sentry

    Docs -->|imports UI, Env, Utils| UIlib
    Docs -->|imports UI, Env, Utils| EnvPkg
    Docs -->|imports UI, Env, Utils| UtilsPkg
    Docs -->|send events via HTTP| PostHog
    Docs -->|send errors via HTTP| Sentry

    WebApp -->|imports UI, Env, Utils, Core| UIlib
    WebApp -->|imports UI, Env, Utils, Core| EnvPkg
    WebApp -->|imports UI, Env, Utils, Core| UtilsPkg
    WebApp -->|imports Core logic| CorePkg
    WebApp -->|interact via HTTP/tRPC| APIpkg
    WebApp -->|upload files via HTTP| Uploadthing
    WebApp -->|send events via HTTP| PostHog
    WebApp -->|send errors via HTTP| Sentry

    %% API Layer flows
    APIpkg -->|calls SQL via Drizzle ORM| DBpkg
    DBpkg -->|reads/writes| NeonDB
    APIpkg -->|auth calls| AuthPkg
    AuthPkg -->|OAuth flow| GitHubAuth
    AuthPkg -->|OAuth flow| GoogleAuth
    APIpkg -->|rate limiting| Unkey

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0366d6,color:#0366d6
    classDef backend fill:#DFFFE0,stroke:#28a745,color:#22863a
    classDef shared fill:#FFF5B1,stroke:#dbab09,color:#735c0f
    classDef config fill:#F0F0F0,stroke:#6a737d,color:#24292e
    classDef monorepo fill:#EDEDED,stroke:#444d56,color:#586069
    classDef external fill:#F5F5F5,stroke:#d1d5da,color:#586069
```
