# dlazarte/recibosgo architecture

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

- Interactive diagram: https://gitdiagram.com/dlazarte/recibosgo
- Repository: https://github.com/dlazarte/recibosgo

## Overview

RecibosGo is a web application for managing apartment-building expenses and services. Operators and residents enter through HTTP routes; authentication and role checks protect workflows for units, people, services, receipts, debts, and reports. Receipt records support payments, and the product also offers receipt PDFs and resident self-registration. PostgreSQL is the system of record. The map follows documented routes and the sampled startup/authentication code; several feature-handler implementations were indexed as read but not excerpted, so uncertain internal calls are not asserted.

Main entry points: [`internal/server/server.go`](https://github.com/dlazarte/recibosgo/blob/main/internal/server/server.go) (HTTP router), [`cmd/server/main.go`](https://github.com/dlazarte/recibosgo/blob/main/cmd/server/main.go) (Server startup), [`internal/database/database.go`](https://github.com/dlazarte/recibosgo/blob/main/internal/database/database.go) (Schema and connection), [`internal/handlers/auth.go`](https://github.com/dlazarte/recibosgo/blob/main/internal/handlers/auth.go) (Login and sessions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Web runtime"]
  node_main["Server startup<br/>[main.go]"]
  node_router["HTTP router<br/>[server.go]"]
  node_app["Handler context<br/>[app.go]"]
  node_templates["HTML and HTMX views"]
  node_models["Domain records<br/>[models.go]"]
  node_database["Schema and connection<br/>[database.go]"]
end

subgraph group_identity["Identity and access"]
  node_auth["Login and sessions<br/>[auth.go]"]
  node_registration["Self-registration<br/>[registro.go]"]
  node_access["Authentication and roles<br/>[middleware.go]"]
end

subgraph group_building["Building administration"]
  node_dashboard["Dashboard<br/>[dashboard.go]"]
  node_units["Units and people<br/>[departamentos.go]"]
  node_people["People accounts<br/>[personas.go]"]
  node_services["Services<br/>[servicios.go]"]
end

subgraph group_finance["Billing and reporting"]
  node_receipts["Receipts and payments<br/>[recibos.go]"]
  node_debts["Monthly debts<br/>[deudas.go]"]
  node_reports["Reports<br/>[reportes.go]"]
  node_pdf["Receipt PDF<br/>[recibo.go]"]
end

node_operator(("Staff or resident"))
node_postgres[("PostgreSQL")]

node_operator -.->|"uses"| node_router
node_main -->|"connects"| node_database
node_main -->|"starts"| node_router
node_main -->|"constructs"| node_app
node_main -->|"loads"| node_templates
node_router -->|"routes login"| node_auth
node_router -->|"routes signup"| node_registration
node_router -->|"applies access"| node_access
node_router -->|"routes dashboard"| node_dashboard
node_router -->|"routes units"| node_units
node_router -->|"routes people"| node_people
node_router -->|"routes services"| node_services
node_router -->|"routes receipts"| node_receipts
node_router -->|"routes debts"| node_debts
node_router -->|"routes reports"| node_reports
node_auth -->|"sets sessions"| node_access
node_database -->|"connects"| node_postgres
node_database -->|"migrates schema"| node_models
node_receipts -.->|"renders PDF"| node_pdf

click node_main "https://github.com/dlazarte/recibosgo/blob/main/cmd/server/main.go"
click node_router "https://github.com/dlazarte/recibosgo/blob/main/internal/server/server.go"
click node_app "https://github.com/dlazarte/recibosgo/blob/main/internal/handlers/app.go"
click node_templates "https://github.com/dlazarte/recibosgo/tree/main/templates"
click node_auth "https://github.com/dlazarte/recibosgo/blob/main/internal/handlers/auth.go"
click node_registration "https://github.com/dlazarte/recibosgo/blob/main/internal/handlers/registro.go"
click node_access "https://github.com/dlazarte/recibosgo/blob/main/internal/middleware/middleware.go"
click node_dashboard "https://github.com/dlazarte/recibosgo/blob/main/internal/handlers/dashboard.go"
click node_units "https://github.com/dlazarte/recibosgo/blob/main/internal/handlers/departamentos.go"
click node_people "https://github.com/dlazarte/recibosgo/blob/main/internal/handlers/personas.go"
click node_services "https://github.com/dlazarte/recibosgo/blob/main/internal/handlers/servicios.go"
click node_receipts "https://github.com/dlazarte/recibosgo/blob/main/internal/handlers/recibos.go"
click node_debts "https://github.com/dlazarte/recibosgo/blob/main/internal/handlers/deudas.go"
click node_reports "https://github.com/dlazarte/recibosgo/blob/main/internal/handlers/reportes.go"
click node_pdf "https://github.com/dlazarte/recibosgo/blob/main/internal/pdf/recibo.go"
click node_models "https://github.com/dlazarte/recibosgo/blob/main/internal/models/models.go"
click node_database "https://github.com/dlazarte/recibosgo/blob/main/internal/database/database.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_main,node_router,node_app,node_templates,node_models,node_database toneBlue
class node_auth,node_registration,node_access,node_postgres toneAmber
class node_dashboard,node_units,node_people,node_services toneMint
class node_receipts,node_debts,node_reports,node_pdf toneRose
class node_operator toneIndigo
```

## Components

### Web runtime

- [Server startup](https://github.com/dlazarte/recibosgo/blob/main/cmd/server/main.go): `cmd/server/main.go`
- [HTTP router](https://github.com/dlazarte/recibosgo/blob/main/internal/server/server.go): `internal/server/server.go`
- [Handler context](https://github.com/dlazarte/recibosgo/blob/main/internal/handlers/app.go): `internal/handlers/app.go`
- [HTML and HTMX views](https://github.com/dlazarte/recibosgo/tree/main/templates): `templates`
- [Domain records](https://github.com/dlazarte/recibosgo/blob/main/internal/models/models.go): `internal/models/models.go`
- [Schema and connection](https://github.com/dlazarte/recibosgo/blob/main/internal/database/database.go): `internal/database/database.go`

### Identity and access

- [Login and sessions](https://github.com/dlazarte/recibosgo/blob/main/internal/handlers/auth.go): `internal/handlers/auth.go`
- [Self-registration](https://github.com/dlazarte/recibosgo/blob/main/internal/handlers/registro.go): `internal/handlers/registro.go`
- [Authentication and roles](https://github.com/dlazarte/recibosgo/blob/main/internal/middleware/middleware.go): `internal/middleware/middleware.go`

### Building administration

- [Dashboard](https://github.com/dlazarte/recibosgo/blob/main/internal/handlers/dashboard.go): `internal/handlers/dashboard.go`
- [Units and people](https://github.com/dlazarte/recibosgo/blob/main/internal/handlers/departamentos.go): `internal/handlers/departamentos.go`
- [People accounts](https://github.com/dlazarte/recibosgo/blob/main/internal/handlers/personas.go): `internal/handlers/personas.go`
- [Services](https://github.com/dlazarte/recibosgo/blob/main/internal/handlers/servicios.go): `internal/handlers/servicios.go`

### Billing and reporting

- [Receipts and payments](https://github.com/dlazarte/recibosgo/blob/main/internal/handlers/recibos.go): `internal/handlers/recibos.go`
- [Monthly debts](https://github.com/dlazarte/recibosgo/blob/main/internal/handlers/deudas.go): `internal/handlers/deudas.go`
- [Reports](https://github.com/dlazarte/recibosgo/blob/main/internal/handlers/reportes.go): `internal/handlers/reportes.go`
- [Receipt PDF](https://github.com/dlazarte/recibosgo/blob/main/internal/pdf/recibo.go): `internal/pdf/recibo.go`

### Other components

- **Staff or resident**
- **PostgreSQL**

## Connections

- Staff or resident → HTTP router: uses (evidence: `README.md`)
- Server startup → Schema and connection: connects (evidence: `cmd/server/main.go`)
- Server startup → HTTP router: starts (evidence: `cmd/server/main.go`)
- Server startup → Handler context: constructs (evidence: `cmd/server/main.go`)
- Server startup → HTML and HTMX views: loads (evidence: `cmd/server/main.go`)
- HTTP router → Login and sessions: routes login (evidence: `internal/server/server.go`)
- HTTP router → Self-registration: routes signup (evidence: `internal/server/server.go`)
- HTTP router → Authentication and roles: applies access (evidence: `internal/server/server.go`)
- HTTP router → Dashboard: routes dashboard (evidence: `internal/server/server.go`)
- HTTP router → Units and people: routes units (evidence: `internal/server/server.go`)
- HTTP router → People accounts: routes people (evidence: `internal/server/server.go`)
- HTTP router → Services: routes services (evidence: `internal/server/server.go`)
- HTTP router → Receipts and payments: routes receipts (evidence: `internal/server/server.go`)
- HTTP router → Monthly debts: routes debts (evidence: `internal/server/server.go`)
- HTTP router → Reports: routes reports (evidence: `internal/server/server.go`)
- Login and sessions → Authentication and roles: sets sessions (evidence: `internal/handlers/auth.go`)
- Schema and connection → PostgreSQL: connects (evidence: `internal/database/database.go`)
- Schema and connection → Domain records: migrates schema (evidence: `internal/database/database.go`)
- Receipts and payments → Receipt PDF: renders PDF
