# logscore/nimbus architecture

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

- Interactive diagram: https://gitdiagram.com/logscore/nimbus
- Repository: https://github.com/logscore/nimbus

## Overview

##### Project type and purpose
- This is a full-stack, monorepo “cloud storage” application called **Nimbus cloud storage**.
- It provides:
- A browser-based frontend (apps/web) built with Next.js (App Router) and React/TypeScript
- A standalone backend API server (apps/server) in TypeScript (Node/bun)
- Shared packages for authentication (packages/auth) and database access (packages/db)
- It integrates with multiple third-party storage providers (Google Drive, AWS, Azure, GCP, iCloud, OneDrive).

##### File structure
- Top-level tooling:
- bun.lock, Docker Compose, eslint.config.mjs
- Root package.json and tsconfig.json configure the monorepo workspaces.
- apps/web (Next.js):
- app directory with App Router (pages, api routes for auth)
- components folder with UI primitives, file-browser, upload components
- next.config.ts, postcss.config.mjs, tsconfig.json
- apps/server:
- A small Node/bun server with a Google Drive adapter (lib/google-drive.ts)
- index.ts entry point
- tsconfig.json and package.json
- packages/auth:
- auth.ts (server-side logic) and auth-client.ts (client SDK)
- packages/db:
- Drizzle ORM configuration and migration files
- auth-schema.ts defines user/auth tables
- index.ts export for database client connections

##### README for additional insights
- Startup instructions use `bun i && bun dev` to spin up both web and server in development.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        direction TB
        NextJS["Next.js Frontend"]:::frontend
        UIComponents["UI Components (file-browser, upload)"]:::frontend
        AuthClient["Auth Client SDK"]:::frontend
        Utils["Frontend Utils"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend Layer"
        direction TB
        APIServer["Backend API Server"]:::backend
        GoogleDrive["Google Drive Adapter"]:::backend
        AuthService["Auth Service (Server Logic)"]:::auth
    end

    %% Database Layer
    subgraph "Database Layer"
        direction TB
        DBClient["DB Client\u00A0(Drizzle ORM)"]:::db
        DBSchema["DB Schema Definitions"]:::db
        DBMigrate["DB Migrations"]:::db
    end

    %% External Providers
    subgraph "External Cloud Storage"
        direction TB
        Cloud["Cloud Providers (Google Drive, AWS S3, Azure, GCP, iCloud, OneDrive)"]:::external
    end

    %% Infrastructure
    subgraph "Infrastructure"
        direction TB
        DockerCompose["Docker Compose"]:::infra
        Env["Environment Variables (.env)"]:::infra
    end

    %% Connections
    NextJS -->|"HTTPS/JSON"| APIServer
    NextJS -->|uses| AuthClient
    AuthClient -->|"SDK calls"| AuthService
    APIServer -->|"internal calls"| AuthService
    APIServer -->|"SQL queries"| DBClient
    DBClient -->|"uses schema"| DBSchema
    DBClient -->|"runs migrations"| DBMigrate
    APIServer -->|"integrates via SDK/API"| GoogleDrive
    APIServer -->|"HTTPS/SDK"| Cloud
    DockerCompose -.-> NextJS
    DockerCompose -.-> APIServer
    Env -.-> DockerCompose

    %% Click Events
    click NextJS "https://github.com/logscore/nimbus/tree/main/apps/web/app"
    click UIComponents "https://github.com/logscore/nimbus/tree/main/apps/web/components"
    click AuthClient "https://github.com/logscore/nimbus/blob/main/packages/auth/src/auth-client.ts"
    click Utils "https://github.com/logscore/nimbus/blob/main/apps/web/lib/utils.ts"
    click APIServer "https://github.com/logscore/nimbus/blob/main/apps/server/src/index.ts"
    click GoogleDrive "https://github.com/logscore/nimbus/blob/main/apps/server/lib/google-drive.ts"
    click AuthService "https://github.com/logscore/nimbus/blob/main/packages/auth/src/auth.ts"
    click DBClient "https://github.com/logscore/nimbus/blob/main/packages/db/src/index.ts"
    click DBSchema "https://github.com/logscore/nimbus/blob/main/packages/db/auth-schema.ts"
    click DBMigrate "https://github.com/logscore/nimbus/tree/main/packages/db/drizzle"
    click DockerCompose "https://github.com/logscore/nimbus/blob/main/docker-compose.yml"
    click Env "https://github.com/logscore/nimbus/blob/main/.env.example"

    %% Styles
    classDef frontend fill:#CCE5FF,stroke:#333,stroke-width:1px
    classDef backend fill:#CCFFCC,stroke:#333,stroke-width:1px
    classDef auth fill:#FFD699,stroke:#333,stroke-width:1px
    classDef db fill:#FFFFCC,stroke:#333,stroke-width:1px
    classDef external fill:#E0E0E0,stroke:#333,stroke-width:1px
    classDef infra fill:#F0D9FF,stroke:#333,stroke-width:1px
```
