# thiagoconnectcom/ecoleta architecture

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

- Interactive diagram: https://gitdiagram.com/thiagoconnectcom/ecoleta
- Repository: https://github.com/thiagoconnectcom/ecoleta

## Overview

Ecoleta is a waste-collection marketplace with a React web client and an Express/SQLite API. The visible user workflow starts at the home page, opens point registration, gathers contact details, location and collection-item choices, then submits a point. The API also exposes item listing and point search/detail operations. Source excerpts show the registration-to-API path and server-side persistence; the README is empty, and the home page excerpt does not show a search interface, so no client-side discovery flow is inferred.

Main entry points: [`server/src/routes.ts`](https://github.com/thiagoconnectcom/ecoleta/blob/master/server/src/routes.ts) (API routing), [`web/src/pages/CreatePoint/index.tsx`](https://github.com/thiagoconnectcom/ecoleta/blob/master/web/src/pages/CreatePoint/index.tsx) (Register collection point), [`server/src/database/connection.ts`](https://github.com/thiagoconnectcom/ecoleta/blob/master/server/src/database/connection.ts) (Knex connection), [`web/src/routes.tsx`](https://github.com/thiagoconnectcom/ecoleta/blob/master/web/src/routes.tsx) (Page routing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web client"]
  node_app["React app<br/>[App.tsx]"]
  node_web_routes["Page routing<br/>[routes.tsx]"]
  node_home["Marketplace home<br/>[index.tsx]"]
  node_create_point["Register collection point<br/>[index.tsx]"]
  node_api_client["HTTP API client<br/>[api.tsx]"]
end

subgraph group_api["API service"]
  node_server["HTTP server<br/>[server.ts]"]
  node_api_routes["API routing<br/>[routes.ts]"]
  node_items_api["List collection items<br/>[ItemsController.ts]"]
  node_point_search["Search points"]
  node_point_detail["Point details"]
  node_point_registration["Create point"]
  node_uploads["Static uploads<br/>[server.ts]"]
end

subgraph group_data["Persistence"]
  node_db_connection["Knex connection<br/>[connection.ts]"]
  node_sqlite[("SQLite database<br/>[database.sqlite]")]
  node_migrations["Marketplace schema"]
  node_seed_items["Initial item data<br/>[create_items.ts]"]
end

subgraph group_integrations["External services"]
  node_ibge["IBGE location service"]
  node_map_tiles["OpenStreetMap tiles"]
end

node_visitor(("Marketplace visitor"))

node_visitor -->|"opens"| node_home
node_app -->|"renders"| node_web_routes
node_web_routes -->|"routes to"| node_home
node_web_routes -->|"routes to"| node_create_point
node_home -->|"links to"| node_create_point
node_create_point -->|"requests through"| node_api_client
node_create_point -->|"loads locations"| node_ibge
node_create_point -->|"loads map tiles"| node_map_tiles
node_api_client -->|"sends HTTP requests"| node_server
node_server -->|"mounts routes"| node_api_routes
node_api_routes -->|"routes item listing"| node_items_api
node_api_routes -->|"routes point creation"| node_point_registration
node_api_routes -->|"routes point search"| node_point_search
node_api_routes -->|"routes point detail"| node_point_detail
node_server -->|"serves files"| node_uploads
node_items_api -->|"queries items"| node_db_connection
node_point_search -->|"queries matching points"| node_db_connection
node_point_detail -->|"reads point and items"| node_db_connection
node_point_registration -->|"writes point and item links"| node_db_connection
node_db_connection -->|"connects to"| node_sqlite
node_migrations -.->|"defines schema"| node_sqlite
node_seed_items -.->|"seeds items"| node_sqlite

click node_app "https://github.com/thiagoconnectcom/ecoleta/blob/master/web/src/App.tsx"
click node_web_routes "https://github.com/thiagoconnectcom/ecoleta/blob/master/web/src/routes.tsx"
click node_home "https://github.com/thiagoconnectcom/ecoleta/blob/master/web/src/pages/Home/index.tsx"
click node_create_point "https://github.com/thiagoconnectcom/ecoleta/blob/master/web/src/pages/CreatePoint/index.tsx"
click node_api_client "https://github.com/thiagoconnectcom/ecoleta/blob/master/web/src/services/api.tsx"
click node_server "https://github.com/thiagoconnectcom/ecoleta/blob/master/server/src/server.ts"
click node_api_routes "https://github.com/thiagoconnectcom/ecoleta/blob/master/server/src/routes.ts"
click node_items_api "https://github.com/thiagoconnectcom/ecoleta/blob/master/server/src/controllers/ItemsController.ts"
click node_point_search "https://github.com/thiagoconnectcom/ecoleta/blob/master/server/src/controllers/PointsController.ts"
click node_point_detail "https://github.com/thiagoconnectcom/ecoleta/blob/master/server/src/controllers/PointsController.ts"
click node_point_registration "https://github.com/thiagoconnectcom/ecoleta/blob/master/server/src/controllers/PointsController.ts"
click node_uploads "https://github.com/thiagoconnectcom/ecoleta/blob/master/server/src/server.ts"
click node_db_connection "https://github.com/thiagoconnectcom/ecoleta/blob/master/server/src/database/connection.ts"
click node_sqlite "https://github.com/thiagoconnectcom/ecoleta/blob/master/server/src/database/database.sqlite"
click node_migrations "https://github.com/thiagoconnectcom/ecoleta/tree/master/server/src/database/migrations"
click node_seed_items "https://github.com/thiagoconnectcom/ecoleta/blob/master/server/src/database/seeds/create_items.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_app,node_web_routes,node_home,node_create_point,node_api_client toneBlue
class node_server,node_api_routes,node_items_api,node_point_search,node_point_detail,node_point_registration,node_uploads toneAmber
class node_db_connection,node_sqlite,node_migrations,node_seed_items toneMint
class node_ibge,node_map_tiles toneRose
class node_visitor toneIndigo
```

## Components

### Web client

- [React app](https://github.com/thiagoconnectcom/ecoleta/blob/master/web/src/App.tsx): `web/src/App.tsx`
- [Page routing](https://github.com/thiagoconnectcom/ecoleta/blob/master/web/src/routes.tsx): `web/src/routes.tsx`
- [Marketplace home](https://github.com/thiagoconnectcom/ecoleta/blob/master/web/src/pages/Home/index.tsx): `web/src/pages/Home/index.tsx`
- [Register collection point](https://github.com/thiagoconnectcom/ecoleta/blob/master/web/src/pages/CreatePoint/index.tsx): `web/src/pages/CreatePoint/index.tsx`
- [HTTP API client](https://github.com/thiagoconnectcom/ecoleta/blob/master/web/src/services/api.tsx): `web/src/services/api.tsx`

### API service

- [HTTP server](https://github.com/thiagoconnectcom/ecoleta/blob/master/server/src/server.ts): `server/src/server.ts`
- [API routing](https://github.com/thiagoconnectcom/ecoleta/blob/master/server/src/routes.ts): `server/src/routes.ts`
- [List collection items](https://github.com/thiagoconnectcom/ecoleta/blob/master/server/src/controllers/ItemsController.ts): `server/src/controllers/ItemsController.ts`
- [Search points](https://github.com/thiagoconnectcom/ecoleta/blob/master/server/src/controllers/PointsController.ts): `server/src/controllers/PointsController.ts`
- [Point details](https://github.com/thiagoconnectcom/ecoleta/blob/master/server/src/controllers/PointsController.ts): `server/src/controllers/PointsController.ts`
- [Create point](https://github.com/thiagoconnectcom/ecoleta/blob/master/server/src/controllers/PointsController.ts): `server/src/controllers/PointsController.ts`
- [Static uploads](https://github.com/thiagoconnectcom/ecoleta/blob/master/server/src/server.ts): `server/src/server.ts`

### Persistence

- [Knex connection](https://github.com/thiagoconnectcom/ecoleta/blob/master/server/src/database/connection.ts): `server/src/database/connection.ts`
- [SQLite database](https://github.com/thiagoconnectcom/ecoleta/blob/master/server/src/database/database.sqlite): `server/src/database/database.sqlite`
- [Marketplace schema](https://github.com/thiagoconnectcom/ecoleta/tree/master/server/src/database/migrations): `server/src/database/migrations`
- [Initial item data](https://github.com/thiagoconnectcom/ecoleta/blob/master/server/src/database/seeds/create_items.ts): `server/src/database/seeds/create_items.ts`

### External services

- **IBGE location service**
- **OpenStreetMap tiles**

### Other components

- **Marketplace visitor**

## Connections

- Marketplace visitor → Marketplace home: opens (evidence: `web/src/pages/Home/index.tsx`)
- React app → Page routing: renders (evidence: `web/src/App.tsx`)
- Page routing → Marketplace home: routes to (evidence: `web/src/routes.tsx`)
- Page routing → Register collection point: routes to (evidence: `web/src/routes.tsx`)
- Marketplace home → Register collection point: links to (evidence: `web/src/pages/Home/index.tsx`)
- Register collection point → HTTP API client: requests through (evidence: `web/src/pages/CreatePoint/index.tsx`)
- Register collection point → IBGE location service: loads locations (evidence: `web/src/pages/CreatePoint/index.tsx`)
- Register collection point → OpenStreetMap tiles: loads map tiles (evidence: `web/src/pages/CreatePoint/index.tsx`)
- HTTP API client → HTTP server: sends HTTP requests (evidence: `web/src/services/api.tsx`)
- HTTP server → API routing: mounts routes (evidence: `server/src/server.ts`)
- API routing → List collection items: routes item listing (evidence: `server/src/routes.ts`)
- API routing → Create point: routes point creation (evidence: `server/src/routes.ts`)
- API routing → Search points: routes point search (evidence: `server/src/routes.ts`)
- API routing → Point details: routes point detail (evidence: `server/src/routes.ts`)
- HTTP server → Static uploads: serves files (evidence: `server/src/server.ts`)
- List collection items → Knex connection: queries items (evidence: `server/src/controllers/ItemsController.ts`)
- Search points → Knex connection: queries matching points (evidence: `server/src/controllers/PointsController.ts`)
- Point details → Knex connection: reads point and items (evidence: `server/src/controllers/PointsController.ts`)
- Create point → Knex connection: writes point and item links (evidence: `server/src/controllers/PointsController.ts`)
- Knex connection → SQLite database: connects to (evidence: `server/src/database/connection.ts`)
- Marketplace schema → SQLite database: defines schema
- Initial item data → SQLite database: seeds items
