# eduardolat/pgbackweb architecture

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

- Interactive diagram: https://gitdiagram.com/eduardolat/pgbackweb
- Repository: https://github.com/eduardolat/pgbackweb

## Overview

PG Back Web is a PostgreSQL backup-management web application. Users configure databases and destinations, define backup jobs, then run or schedule executions; they can monitor results, download backups, and initiate restorations. The dashboard also manages users, sessions, and event webhooks, while health checks and notifications are documented capabilities. The graph follows the server bootstrap, routing, and service composition shown in excerpts; database schema internals and several runtime integrations were not sampled, so uncertain links are omitted or marked unverified.

Main entry points: [`internal/service/service.go`](https://github.com/eduardolat/pgbackweb/blob/main/internal/service/service.go) (Service composition), [`internal/service/executions`](https://github.com/eduardolat/pgbackweb/tree/main/internal/service/executions) (Backup executions), [`cmd/app/main.go`](https://github.com/eduardolat/pgbackweb/blob/main/cmd/app/main.go) (Server bootstrap), [`internal/service/restorations`](https://github.com/eduardolat/pgbackweb/tree/main/internal/service/restorations) (Restoration workflow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Application entry"]
  node_bootstrap["Server bootstrap<br/>[main.go]"]
end

subgraph group_web["Web interface"]
  node_http["HTTP router<br/>[router.go]"]
  node_web_routes["Web routes<br/>[router.go]"]
  node_dashboard["Dashboard routes<br/>[router.go]"]
  node_browser["Browser assets"]
  node_auth_ui["Authentication UI"]
  node_resource_ui["Resource screens"]
end

subgraph group_domain["Backup domain"]
  node_service_hub["Service composition<br/>[service.go]"]
  node_auth["Authentication"]
  node_users["User management"]
  node_databases["Database management"]
  node_destinations["Destination management"]
  node_backups["Backup scheduling"]
  node_executions["Backup executions"]
  node_restorations["Restoration workflow"]
  node_webhooks["Event webhooks"]
end

subgraph group_integrations["Runtime integrations"]
  node_pg["PostgreSQL operations<br/>[postgres.go]"]
  node_storage["Backup storage"]
  node_local["Local storage<br/>[local.go]"]
  node_s3["S3 storage<br/>[s3.go]"]
end

subgraph group_platform["Shared platform"]
  node_scheduler["Cron scheduler<br/>[cron.go]"]
  node_db[("Application database<br/>[connect.go]")]
end

node_operator(("Operator"))
node_external_db[("Managed PostgreSQL")]
node_s3_service["S3 service"]
node_webhook_target(("Webhook endpoint"))

node_operator -->|"uses"| node_http
node_bootstrap -->|"starts"| node_scheduler
node_bootstrap -->|"connects"| node_db
node_bootstrap -->|"constructs"| node_service_hub
node_bootstrap -->|"mounts"| node_http
node_http -->|"mounts"| node_web_routes
node_http -->|"mounts API"| node_dashboard
node_web_routes -->|"routes to"| node_auth_ui
node_web_routes -->|"routes to"| node_dashboard
node_dashboard -->|"mounts screens"| node_resource_ui
node_dashboard -->|"uses"| node_service_hub
node_service_hub -->|"constructs"| node_auth
node_service_hub -->|"constructs"| node_users
node_service_hub -->|"constructs"| node_databases
node_service_hub -->|"constructs"| node_destinations
node_service_hub -->|"constructs"| node_backups
node_service_hub -->|"constructs"| node_executions
node_service_hub -->|"constructs"| node_restorations
node_service_hub -->|"constructs"| node_webhooks
node_service_hub -->|"receives scheduler"| node_scheduler
node_service_hub -->|"receives queries"| node_db
node_backups -->|"invokes"| node_executions
node_restorations -->|"uses"| node_executions
node_restorations -->|"uses"| node_databases
node_restorations -->|"uses"| node_destinations
node_executions -.->|"runs backups"| node_pg
node_executions -.->|"stores artifacts"| node_storage
node_storage -.->|"selects"| node_local
node_storage -.->|"selects"| node_s3
node_pg -.->|"backs up"| node_external_db
node_s3 -.->|"transfers files"| node_s3_service
node_webhooks -->|"sends events"| node_webhook_target
node_browser -->|"enhances UI"| node_operator

click node_bootstrap "https://github.com/eduardolat/pgbackweb/blob/main/cmd/app/main.go"
click node_http "https://github.com/eduardolat/pgbackweb/blob/main/internal/view/router.go"
click node_web_routes "https://github.com/eduardolat/pgbackweb/blob/main/internal/view/web/router.go"
click node_dashboard "https://github.com/eduardolat/pgbackweb/blob/main/internal/view/web/dashboard/router.go"
click node_browser "https://github.com/eduardolat/pgbackweb/tree/main/internal/view/static/js"
click node_auth_ui "https://github.com/eduardolat/pgbackweb/tree/main/internal/view/web/auth"
click node_resource_ui "https://github.com/eduardolat/pgbackweb/tree/main/internal/view/web/dashboard"
click node_service_hub "https://github.com/eduardolat/pgbackweb/blob/main/internal/service/service.go"
click node_auth "https://github.com/eduardolat/pgbackweb/tree/main/internal/service/auth"
click node_users "https://github.com/eduardolat/pgbackweb/tree/main/internal/service/users"
click node_databases "https://github.com/eduardolat/pgbackweb/tree/main/internal/service/databases"
click node_destinations "https://github.com/eduardolat/pgbackweb/tree/main/internal/service/destinations"
click node_backups "https://github.com/eduardolat/pgbackweb/tree/main/internal/service/backups"
click node_executions "https://github.com/eduardolat/pgbackweb/tree/main/internal/service/executions"
click node_restorations "https://github.com/eduardolat/pgbackweb/tree/main/internal/service/restorations"
click node_webhooks "https://github.com/eduardolat/pgbackweb/tree/main/internal/service/webhooks"
click node_scheduler "https://github.com/eduardolat/pgbackweb/blob/main/internal/cron/cron.go"
click node_db "https://github.com/eduardolat/pgbackweb/blob/main/internal/database/connect.go"
click node_pg "https://github.com/eduardolat/pgbackweb/blob/main/internal/integration/postgres/postgres.go"
click node_storage "https://github.com/eduardolat/pgbackweb/tree/main/internal/integration/storage"
click node_local "https://github.com/eduardolat/pgbackweb/blob/main/internal/integration/storage/local.go"
click node_s3 "https://github.com/eduardolat/pgbackweb/blob/main/internal/integration/storage/s3.go"

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_bootstrap toneBlue
class node_http,node_web_routes,node_dashboard,node_browser,node_auth_ui,node_resource_ui,node_external_db toneAmber
class node_service_hub,node_auth,node_users,node_databases,node_destinations,node_backups,node_executions,node_restorations,node_webhooks,node_webhook_target toneMint
class node_pg,node_storage,node_local,node_s3 toneRose
class node_scheduler,node_db,node_operator,node_s3_service toneIndigo
```

## Components

### Application entry

- [Server bootstrap](https://github.com/eduardolat/pgbackweb/blob/main/cmd/app/main.go): `cmd/app/main.go`

### Web interface

- [HTTP router](https://github.com/eduardolat/pgbackweb/blob/main/internal/view/router.go): `internal/view/router.go`
- [Web routes](https://github.com/eduardolat/pgbackweb/blob/main/internal/view/web/router.go): `internal/view/web/router.go`
- [Dashboard routes](https://github.com/eduardolat/pgbackweb/blob/main/internal/view/web/dashboard/router.go): `internal/view/web/dashboard/router.go`
- [Browser assets](https://github.com/eduardolat/pgbackweb/tree/main/internal/view/static/js): `internal/view/static/js`
- [Authentication UI](https://github.com/eduardolat/pgbackweb/tree/main/internal/view/web/auth): `internal/view/web/auth`
- [Resource screens](https://github.com/eduardolat/pgbackweb/tree/main/internal/view/web/dashboard): `internal/view/web/dashboard`

### Backup domain

- [Service composition](https://github.com/eduardolat/pgbackweb/blob/main/internal/service/service.go): `internal/service/service.go`
- [Authentication](https://github.com/eduardolat/pgbackweb/tree/main/internal/service/auth): `internal/service/auth`
- [User management](https://github.com/eduardolat/pgbackweb/tree/main/internal/service/users): `internal/service/users`
- [Database management](https://github.com/eduardolat/pgbackweb/tree/main/internal/service/databases): `internal/service/databases`
- [Destination management](https://github.com/eduardolat/pgbackweb/tree/main/internal/service/destinations): `internal/service/destinations`
- [Backup scheduling](https://github.com/eduardolat/pgbackweb/tree/main/internal/service/backups): `internal/service/backups`
- [Backup executions](https://github.com/eduardolat/pgbackweb/tree/main/internal/service/executions): `internal/service/executions`
- [Restoration workflow](https://github.com/eduardolat/pgbackweb/tree/main/internal/service/restorations): `internal/service/restorations`
- [Event webhooks](https://github.com/eduardolat/pgbackweb/tree/main/internal/service/webhooks): `internal/service/webhooks`

### Runtime integrations

- [PostgreSQL operations](https://github.com/eduardolat/pgbackweb/blob/main/internal/integration/postgres/postgres.go): `internal/integration/postgres/postgres.go`
- [Backup storage](https://github.com/eduardolat/pgbackweb/tree/main/internal/integration/storage): `internal/integration/storage`
- [Local storage](https://github.com/eduardolat/pgbackweb/blob/main/internal/integration/storage/local.go): `internal/integration/storage/local.go`
- [S3 storage](https://github.com/eduardolat/pgbackweb/blob/main/internal/integration/storage/s3.go): `internal/integration/storage/s3.go`

### Shared platform

- [Cron scheduler](https://github.com/eduardolat/pgbackweb/blob/main/internal/cron/cron.go): `internal/cron/cron.go`
- [Application database](https://github.com/eduardolat/pgbackweb/blob/main/internal/database/connect.go): `internal/database/connect.go`

### Other components

- **Operator**
- **Managed PostgreSQL**
- **S3 service**
- **Webhook endpoint**

## Connections

- Operator → HTTP router: uses
- Server bootstrap → Cron scheduler: starts (evidence: `cmd/app/main.go`)
- Server bootstrap → Application database: connects (evidence: `cmd/app/main.go`)
- Server bootstrap → Service composition: constructs (evidence: `cmd/app/main.go`)
- Server bootstrap → HTTP router: mounts (evidence: `cmd/app/main.go`)
- HTTP router → Web routes: mounts (evidence: `internal/view/router.go`)
- HTTP router → Dashboard routes: mounts API (evidence: `internal/view/router.go`)
- Web routes → Authentication UI: routes to (evidence: `internal/view/web/router.go`)
- Web routes → Dashboard routes: routes to (evidence: `internal/view/web/router.go`)
- Dashboard routes → Resource screens: mounts screens (evidence: `internal/view/web/dashboard/router.go`)
- Dashboard routes → Service composition: uses (evidence: `internal/view/web/dashboard/router.go`)
- Service composition → Authentication: constructs (evidence: `internal/service/service.go`)
- Service composition → User management: constructs (evidence: `internal/service/service.go`)
- Service composition → Database management: constructs (evidence: `internal/service/service.go`)
- Service composition → Destination management: constructs (evidence: `internal/service/service.go`)
- Service composition → Backup scheduling: constructs (evidence: `internal/service/service.go`)
- Service composition → Backup executions: constructs (evidence: `internal/service/service.go`)
- Service composition → Restoration workflow: constructs (evidence: `internal/service/service.go`)
- Service composition → Event webhooks: constructs (evidence: `internal/service/service.go`)
- Service composition → Cron scheduler: receives scheduler (evidence: `internal/service/service.go`)
- Service composition → Application database: receives queries (evidence: `internal/service/service.go`)
- Backup scheduling → Backup executions: invokes (evidence: `internal/service/service.go`)
- Restoration workflow → Backup executions: uses (evidence: `internal/service/service.go`)
- Restoration workflow → Database management: uses (evidence: `internal/service/service.go`)
- Restoration workflow → Destination management: uses (evidence: `internal/service/service.go`)
- Backup executions → PostgreSQL operations: runs backups
- Backup executions → Backup storage: stores artifacts
- Backup storage → Local storage: selects
- Backup storage → S3 storage: selects
- PostgreSQL operations → Managed PostgreSQL: backs up
- S3 storage → S3 service: transfers files
- Event webhooks → Webhook endpoint: sends events
- Browser assets → Operator: enhances UI (evidence: `internal/view/static/js/app.js`)
