# ghulam8586/justpostgres architecture

> Architecture diagram of the GitHub repository ghulam8586/justpostgres, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ghulam8586/justpostgres
- Repository: https://github.com/ghulam8586/justpostgres

## Overview

justpostgres is a self-hosted Postgres management product: an administrator signs in, creates and manages projects, connects to their databases, and can browse/query data or operate backups, branches, extensions, and optional REST APIs. The graph shows the UI/API boundary, major project lifecycle and database capabilities, background jobs, and the connection router. Some service-to-handler and runtime wiring is not visible in the excerpts, so those relationships are omitted rather than inferred.

Main entry points: [`apps/control-plane/src/api/routes`](https://github.com/ghulam8586/justpostgres/tree/main/apps/control-plane/src/api/routes) (API route handlers), [`apps/control-plane/src/projects/service.ts`](https://github.com/ghulam8586/justpostgres/blob/main/apps/control-plane/src/projects/service.ts) (Project management), [`apps/control-plane/src/backups/service.ts`](https://github.com/ghulam8586/justpostgres/blob/main/apps/control-plane/src/backups/service.ts) (Backup and restore), [`apps/control-plane/src/api/app.ts`](https://github.com/ghulam8586/justpostgres/blob/main/apps/control-plane/src/api/app.ts) (HTTP application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User interface"]
  node_web["Web application<br/>[App.tsx]"]
  node_client["API client<br/>[api.ts]"]
end

subgraph group_control["Control plane"]
  node_api["HTTP application<br/>[app.ts]"]
  node_auth["Authentication<br/>[middleware.ts]"]
  node_routes["API route handlers"]
end

subgraph group_operations["Project operations"]
  node_projects["Project management<br/>[service.ts]"]
  node_data["Data browser and SQL"]
  node_backups["Backup and restore<br/>[service.ts]"]
  node_branches["Project branching<br/>[service.ts]"]
  node_extensions["Extensions<br/>[service.ts]"]
  node_rest["Optional REST API<br/>[service.ts]"]
  node_upgrades["Major upgrades<br/>[service.ts]"]
  node_metrics["Project metrics<br/>[service.ts]"]
end

subgraph group_runtime["Database runtime"]
  node_pgbackrest["Backup execution<br/>[pgbackrest.ts]"]
  node_objectstore["Object storage<br/>[object-storage.ts]"]
  node_jobs["Job queue and worker<br/>[queue.ts]"]
  node_docker["Container runtime<br/>[driver.ts]"]
  node_router["Connection router<br/>[session.ts]"]
end

subgraph group_state["Metadata and storage"]
  node_db[("Control metadata<br/>[schema.ts]")]
  node_disk["Disk capacity monitor<br/>[disk.ts]"]
end

node_admin(("Administrator"))

node_admin -->|"uses"| node_web
node_web -->|"requests through"| node_client
node_client -.->|"calls"| node_api
node_api -->|"applies"| node_auth
node_api -->|"registers"| node_routes
node_routes -.->|"dispatches to"| node_projects
node_routes -.->|"dispatches to"| node_data
node_routes -.->|"dispatches to"| node_backups
node_routes -.->|"dispatches to"| node_branches
node_routes -.->|"dispatches to"| node_extensions
node_routes -.->|"dispatches to"| node_rest
node_routes -.->|"dispatches to"| node_upgrades
node_projects -->|"enqueues work"| node_jobs
node_projects -.->|"checks capacity"| node_disk
node_backups -->|"runs backups"| node_pgbackrest
node_backups -->|"uses configured storage"| node_objectstore
node_jobs -.->|"runs container work"| node_docker
node_branches -->|"restores recovery point"| node_backups
node_router -.->|"routes project connections"| node_projects
node_projects -.->|"stores project metadata"| node_db
node_backups -.->|"stores backup state"| node_db
node_metrics -.->|"reads project state"| node_db
node_upgrades -.->|"enqueues work"| node_jobs

click node_web "https://github.com/ghulam8586/justpostgres/blob/main/apps/web/src/App.tsx"
click node_client "https://github.com/ghulam8586/justpostgres/blob/main/apps/web/src/lib/api.ts"
click node_api "https://github.com/ghulam8586/justpostgres/blob/main/apps/control-plane/src/api/app.ts"
click node_auth "https://github.com/ghulam8586/justpostgres/blob/main/apps/control-plane/src/auth/middleware.ts"
click node_routes "https://github.com/ghulam8586/justpostgres/tree/main/apps/control-plane/src/api/routes"
click node_projects "https://github.com/ghulam8586/justpostgres/blob/main/apps/control-plane/src/projects/service.ts"
click node_data "https://github.com/ghulam8586/justpostgres/tree/main/apps/control-plane/src/data"
click node_backups "https://github.com/ghulam8586/justpostgres/blob/main/apps/control-plane/src/backups/service.ts"
click node_pgbackrest "https://github.com/ghulam8586/justpostgres/blob/main/apps/control-plane/src/backups/pgbackrest.ts"
click node_objectstore "https://github.com/ghulam8586/justpostgres/blob/main/apps/control-plane/src/backups/object-storage.ts"
click node_branches "https://github.com/ghulam8586/justpostgres/blob/main/apps/control-plane/src/branches/service.ts"
click node_extensions "https://github.com/ghulam8586/justpostgres/blob/main/apps/control-plane/src/extensions/service.ts"
click node_rest "https://github.com/ghulam8586/justpostgres/blob/main/apps/control-plane/src/rest/service.ts"
click node_upgrades "https://github.com/ghulam8586/justpostgres/blob/main/apps/control-plane/src/upgrades/service.ts"
click node_metrics "https://github.com/ghulam8586/justpostgres/blob/main/apps/control-plane/src/metrics/service.ts"
click node_jobs "https://github.com/ghulam8586/justpostgres/blob/main/apps/control-plane/src/jobs/queue.ts"
click node_docker "https://github.com/ghulam8586/justpostgres/blob/main/apps/control-plane/src/docker/driver.ts"
click node_router "https://github.com/ghulam8586/justpostgres/blob/main/apps/router/src/session.ts"
click node_db "https://github.com/ghulam8586/justpostgres/blob/main/apps/control-plane/src/db/schema.ts"
click node_disk "https://github.com/ghulam8586/justpostgres/blob/main/apps/control-plane/src/storage/disk.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_web,node_client toneBlue
class node_api,node_auth,node_routes toneAmber
class node_projects,node_data,node_backups,node_branches,node_extensions,node_rest,node_upgrades,node_metrics toneMint
class node_pgbackrest,node_objectstore,node_jobs,node_docker,node_router toneRose
class node_db,node_disk,node_admin toneIndigo
```

## Components

### User interface

- [Web application](https://github.com/ghulam8586/justpostgres/blob/main/apps/web/src/App.tsx): `apps/web/src/App.tsx`
- [API client](https://github.com/ghulam8586/justpostgres/blob/main/apps/web/src/lib/api.ts): `apps/web/src/lib/api.ts`

### Control plane

- [HTTP application](https://github.com/ghulam8586/justpostgres/blob/main/apps/control-plane/src/api/app.ts): `apps/control-plane/src/api/app.ts`
- [Authentication](https://github.com/ghulam8586/justpostgres/blob/main/apps/control-plane/src/auth/middleware.ts): `apps/control-plane/src/auth/middleware.ts`
- [API route handlers](https://github.com/ghulam8586/justpostgres/tree/main/apps/control-plane/src/api/routes): `apps/control-plane/src/api/routes`

### Project operations

- [Project management](https://github.com/ghulam8586/justpostgres/blob/main/apps/control-plane/src/projects/service.ts): `apps/control-plane/src/projects/service.ts`
- [Data browser and SQL](https://github.com/ghulam8586/justpostgres/tree/main/apps/control-plane/src/data): `apps/control-plane/src/data`
- [Backup and restore](https://github.com/ghulam8586/justpostgres/blob/main/apps/control-plane/src/backups/service.ts): `apps/control-plane/src/backups/service.ts`
- [Project branching](https://github.com/ghulam8586/justpostgres/blob/main/apps/control-plane/src/branches/service.ts): `apps/control-plane/src/branches/service.ts`
- [Extensions](https://github.com/ghulam8586/justpostgres/blob/main/apps/control-plane/src/extensions/service.ts): `apps/control-plane/src/extensions/service.ts`
- [Optional REST API](https://github.com/ghulam8586/justpostgres/blob/main/apps/control-plane/src/rest/service.ts): `apps/control-plane/src/rest/service.ts`
- [Major upgrades](https://github.com/ghulam8586/justpostgres/blob/main/apps/control-plane/src/upgrades/service.ts): `apps/control-plane/src/upgrades/service.ts`
- [Project metrics](https://github.com/ghulam8586/justpostgres/blob/main/apps/control-plane/src/metrics/service.ts): `apps/control-plane/src/metrics/service.ts`

### Database runtime

- [Backup execution](https://github.com/ghulam8586/justpostgres/blob/main/apps/control-plane/src/backups/pgbackrest.ts): `apps/control-plane/src/backups/pgbackrest.ts`
- [Object storage](https://github.com/ghulam8586/justpostgres/blob/main/apps/control-plane/src/backups/object-storage.ts): `apps/control-plane/src/backups/object-storage.ts`
- [Job queue and worker](https://github.com/ghulam8586/justpostgres/blob/main/apps/control-plane/src/jobs/queue.ts): `apps/control-plane/src/jobs/queue.ts`
- [Container runtime](https://github.com/ghulam8586/justpostgres/blob/main/apps/control-plane/src/docker/driver.ts): `apps/control-plane/src/docker/driver.ts`
- [Connection router](https://github.com/ghulam8586/justpostgres/blob/main/apps/router/src/session.ts): `apps/router/src/session.ts`

### Metadata and storage

- [Control metadata](https://github.com/ghulam8586/justpostgres/blob/main/apps/control-plane/src/db/schema.ts): `apps/control-plane/src/db/schema.ts`
- [Disk capacity monitor](https://github.com/ghulam8586/justpostgres/blob/main/apps/control-plane/src/storage/disk.ts): `apps/control-plane/src/storage/disk.ts`

### Other components

- **Administrator**

## Connections

- Administrator → Web application: uses (evidence: `README.md`)
- Web application → API client: requests through (evidence: `apps/web/src/App.tsx`)
- API client → HTTP application: calls
- HTTP application → Authentication: applies (evidence: `apps/control-plane/src/api/app.ts`)
- HTTP application → API route handlers: registers (evidence: `apps/control-plane/src/api/app.ts`)
- API route handlers → Project management: dispatches to
- API route handlers → Data browser and SQL: dispatches to
- API route handlers → Backup and restore: dispatches to
- API route handlers → Project branching: dispatches to
- API route handlers → Extensions: dispatches to
- API route handlers → Optional REST API: dispatches to
- API route handlers → Major upgrades: dispatches to
- Project management → Job queue and worker: enqueues work (evidence: `apps/control-plane/src/projects/service.ts`)
- Project management → Disk capacity monitor: checks capacity (evidence: `apps/control-plane/src/projects/service.ts`)
- Backup and restore → Backup execution: runs backups (evidence: `apps/control-plane/src/backups/service.ts`)
- Backup and restore → Object storage: uses configured storage (evidence: `apps/control-plane/src/backups/service.ts`)
- Job queue and worker → Container runtime: runs container work
- Project branching → Backup and restore: restores recovery point (evidence: `apps/control-plane/src/branches/service.ts`)
- Connection router → Project management: routes project connections
- Project management → Control metadata: stores project metadata (evidence: `apps/control-plane/src/projects/service.ts`)
- Backup and restore → Control metadata: stores backup state (evidence: `apps/control-plane/src/backups/service.ts`)
- Project metrics → Control metadata: reads project state (evidence: `apps/control-plane/src/metrics/service.ts`)
- Major upgrades → Job queue and worker: enqueues work (evidence: `apps/control-plane/src/upgrades/service.ts`)
