# anthonyepv-ctrl/proyecto-iac architecture

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

- Interactive diagram: https://gitdiagram.com/anthonyepv-ctrl/proyecto-iac
- Repository: https://github.com/anthonyepv-ctrl/proyecto-iac

## Overview

TuCochera is an AWS-hosted parking reservation MVP. A client reaches the web app through CloudFront; the frontend can call the API for site listings, availability, and reservations. API Gateway routes to Lambda handlers, which use shared database access to read or update PostgreSQL. A separate initialization Lambda applies the schema and seed data. The README also describes the private VPC, security groups, and a reception-panel prototype; frontend implementation details and Terraform wiring are not excerpted, so those links reflect documented architecture rather than inspected source calls.

Main entry points: [`terraform/lambda.tf`](https://github.com/anthonyepv-ctrl/proyecto-iac/blob/main/terraform/lambda.tf) (Lambda deployment), [`app/backend/db_init/handler.py`](https://github.com/anthonyepv-ctrl/proyecto-iac/blob/main/app/backend/db_init/handler.py) (Database initializer), [`app/backend/disponibilidad/handler.py`](https://github.com/anthonyepv-ctrl/proyecto-iac/blob/main/app/backend/disponibilidad/handler.py) (Sites and availability), [`app/backend/registrar/handler.py`](https://github.com/anthonyepv-ctrl/proyecto-iac/blob/main/app/backend/registrar/handler.py) (Reservation registration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_static["Customer frontend<br/>[index.html]"]
  node_admin["Reception prototype<br/>[admin.html]"]
end

subgraph group_api["Reservation services"]
  node_availability["Sites and availability<br/>[handler.py]"]
  node_reservation["Reservation registration<br/>[handler.py]"]
  node_initializer["Database initializer<br/>[handler.py]"]
  node_http["HTTP responses<br/>[http.py]"]
end

subgraph group_data["Database"]
  node_dbaccess["Database access<br/>[db.py]"]
  node_postgres[("PostgreSQL<br/>[database.tf]")]
  node_schema["Schema and seed<br/>[schema.sql]"]
end

subgraph group_aws["AWS infrastructure"]
  node_cloudfront["CloudFront<br/>[frontend.tf]"]
  node_s3["Static hosting<br/>[frontend.tf]"]
  node_gateway["REST API<br/>[api.tf]"]
  node_vpc["Private network<br/>[network.tf]"]
  node_security["Network controls<br/>[security.tf]"]
  node_lambdas["Lambda deployment<br/>[lambda.tf]"]
end

node_client(("Parking client"))

node_client -->|"requests HTTPS"| node_cloudfront
node_cloudfront -->|"serves frontend"| node_s3
node_cloudfront -->|"routes /api"| node_gateway
node_s3 -->|"hosts"| node_static
node_static -.->|"calls API"| node_gateway
node_client -.->|"views prototype"| node_admin
node_gateway -->|"routes site queries"| node_availability
node_gateway -->|"routes reservations"| node_reservation
node_availability -->|"gets connection"| node_dbaccess
node_reservation -->|"gets connection"| node_dbaccess
node_initializer -->|"gets connection"| node_dbaccess
node_availability -->|"formats responses"| node_http
node_reservation -->|"formats responses"| node_http
node_initializer -->|"formats responses"| node_http
node_dbaccess -->|"connects securely"| node_postgres
node_initializer -->|"loads SQL"| node_schema
node_lambdas -->|"deploys"| node_availability
node_lambdas -->|"deploys"| node_reservation
node_lambdas -->|"deploys"| node_initializer
node_initializer -->|"invoked for setup"| node_lambdas
node_vpc -->|"hosts privately"| node_lambdas
node_vpc -->|"contains private subnets"| node_postgres
node_security -->|"restricts egress"| node_lambdas
node_security -->|"restricts ingress"| node_postgres

click node_cloudfront "https://github.com/anthonyepv-ctrl/proyecto-iac/blob/main/terraform/frontend.tf"
click node_static "https://github.com/anthonyepv-ctrl/proyecto-iac/blob/main/app/frontend/index.html"
click node_admin "https://github.com/anthonyepv-ctrl/proyecto-iac/blob/main/app/frontend/admin.html"
click node_s3 "https://github.com/anthonyepv-ctrl/proyecto-iac/blob/main/terraform/frontend.tf"
click node_gateway "https://github.com/anthonyepv-ctrl/proyecto-iac/blob/main/terraform/api.tf"
click node_availability "https://github.com/anthonyepv-ctrl/proyecto-iac/blob/main/app/backend/disponibilidad/handler.py"
click node_reservation "https://github.com/anthonyepv-ctrl/proyecto-iac/blob/main/app/backend/registrar/handler.py"
click node_initializer "https://github.com/anthonyepv-ctrl/proyecto-iac/blob/main/app/backend/db_init/handler.py"
click node_http "https://github.com/anthonyepv-ctrl/proyecto-iac/blob/main/app/backend/common/http.py"
click node_dbaccess "https://github.com/anthonyepv-ctrl/proyecto-iac/blob/main/app/backend/common/db.py"
click node_postgres "https://github.com/anthonyepv-ctrl/proyecto-iac/blob/main/terraform/database.tf"
click node_schema "https://github.com/anthonyepv-ctrl/proyecto-iac/blob/main/app/backend/db_init/schema.sql"
click node_vpc "https://github.com/anthonyepv-ctrl/proyecto-iac/blob/main/terraform/network.tf"
click node_security "https://github.com/anthonyepv-ctrl/proyecto-iac/blob/main/terraform/security.tf"
click node_lambdas "https://github.com/anthonyepv-ctrl/proyecto-iac/blob/main/terraform/lambda.tf"

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_static,node_admin,node_client toneBlue
class node_availability,node_reservation,node_initializer,node_http toneAmber
class node_dbaccess,node_postgres,node_schema toneMint
class node_cloudfront,node_s3,node_gateway,node_vpc,node_security,node_lambdas toneRose
```

## Components

### Web experience

- [Customer frontend](https://github.com/anthonyepv-ctrl/proyecto-iac/blob/main/app/frontend/index.html): `app/frontend/index.html`
- [Reception prototype](https://github.com/anthonyepv-ctrl/proyecto-iac/blob/main/app/frontend/admin.html): `app/frontend/admin.html`

### Reservation services

- [Sites and availability](https://github.com/anthonyepv-ctrl/proyecto-iac/blob/main/app/backend/disponibilidad/handler.py): `app/backend/disponibilidad/handler.py`
- [Reservation registration](https://github.com/anthonyepv-ctrl/proyecto-iac/blob/main/app/backend/registrar/handler.py): `app/backend/registrar/handler.py`
- [Database initializer](https://github.com/anthonyepv-ctrl/proyecto-iac/blob/main/app/backend/db_init/handler.py): `app/backend/db_init/handler.py`
- [HTTP responses](https://github.com/anthonyepv-ctrl/proyecto-iac/blob/main/app/backend/common/http.py): `app/backend/common/http.py`

### Database

- [Database access](https://github.com/anthonyepv-ctrl/proyecto-iac/blob/main/app/backend/common/db.py): `app/backend/common/db.py`
- [PostgreSQL](https://github.com/anthonyepv-ctrl/proyecto-iac/blob/main/terraform/database.tf): `terraform/database.tf`
- [Schema and seed](https://github.com/anthonyepv-ctrl/proyecto-iac/blob/main/app/backend/db_init/schema.sql): `app/backend/db_init/schema.sql`

### AWS infrastructure

- [CloudFront](https://github.com/anthonyepv-ctrl/proyecto-iac/blob/main/terraform/frontend.tf): `terraform/frontend.tf`
- [Static hosting](https://github.com/anthonyepv-ctrl/proyecto-iac/blob/main/terraform/frontend.tf): `terraform/frontend.tf`
- [REST API](https://github.com/anthonyepv-ctrl/proyecto-iac/blob/main/terraform/api.tf): `terraform/api.tf`
- [Private network](https://github.com/anthonyepv-ctrl/proyecto-iac/blob/main/terraform/network.tf): `terraform/network.tf`
- [Network controls](https://github.com/anthonyepv-ctrl/proyecto-iac/blob/main/terraform/security.tf): `terraform/security.tf`
- [Lambda deployment](https://github.com/anthonyepv-ctrl/proyecto-iac/blob/main/terraform/lambda.tf): `terraform/lambda.tf`

### Other components

- **Parking client**

## Connections

- Parking client → CloudFront: requests HTTPS (evidence: `README.md`)
- CloudFront → Static hosting: serves frontend (evidence: `README.md`)
- CloudFront → REST API: routes /api (evidence: `README.md`)
- Static hosting → Customer frontend: hosts (evidence: `README.md`)
- Customer frontend → REST API: calls API (evidence: `README.md`)
- Parking client → Reception prototype: views prototype (evidence: `README.md`)
- REST API → Sites and availability: routes site queries (evidence: `README.md`)
- REST API → Reservation registration: routes reservations (evidence: `README.md`)
- Sites and availability → Database access: gets connection (evidence: `app/backend/disponibilidad/handler.py`)
- Reservation registration → Database access: gets connection (evidence: `app/backend/registrar/handler.py`)
- Database initializer → Database access: gets connection (evidence: `app/backend/db_init/handler.py`)
- Sites and availability → HTTP responses: formats responses (evidence: `app/backend/disponibilidad/handler.py`)
- Reservation registration → HTTP responses: formats responses (evidence: `app/backend/registrar/handler.py`)
- Database initializer → HTTP responses: formats responses (evidence: `app/backend/db_init/handler.py`)
- Database access → PostgreSQL: connects securely (evidence: `README.md`)
- Database initializer → Schema and seed: loads SQL (evidence: `app/backend/db_init/handler.py`)
- Lambda deployment → Sites and availability: deploys (evidence: `README.md`)
- Lambda deployment → Reservation registration: deploys (evidence: `README.md`)
- Lambda deployment → Database initializer: deploys (evidence: `README.md`)
- Database initializer → Lambda deployment: invoked for setup (evidence: `README.md`)
- Private network → Lambda deployment: hosts privately (evidence: `README.md`)
- Private network → PostgreSQL: contains private subnets (evidence: `README.md`)
- Network controls → Lambda deployment: restricts egress (evidence: `README.md`)
- Network controls → PostgreSQL: restricts ingress (evidence: `README.md`)
