# erickwendel/typebot-docker architecture

> Architecture diagram of the GitHub repository erickwendel/typebot-docker, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/erickwendel/typebot-docker
- Repository: https://github.com/erickwendel/typebot-docker

## Overview

##### Project Type and Purpose
- This is a Docker-based deployment orchestrator for Typebot, focused on containerizing Typebot services behind Traefik with SSL termination and multi-port exposure.

##### File Structure Analysis
- Top level:
- `.env` – environment variables driving service URLs, DB, secrets
- `docker-compose.yaml` – service definitions for Traefik, Typebot, DB, storage
- `traefik.yml` – Traefik-specific configuration (entrypoints, certificates)
- `scripts/` – helper scripts (`install-docker.sh`, `upload.sh`) for setup and deployment
- `ref.txt` – reference notes (likely architecture hints)
- No application source code here—the repo is purely infrastructure as code.

##### Key README Insights
- Multi-port mapping for “builder” (admin UI) and “viewer” (end-user UI)
- External systems: PostgreSQL (via `DATABASE_URL`), optional MinIO/AWS S3 for asset storage

##### Main Components
a. User Clients
- Browser (Typebot Builder)
- Browser (Typebot Viewer)
b. Reverse Proxy & Certificate Manager
- Traefik container
- Let’s Encrypt ACME (automatic cert generation)
c. Typebot Services
- Typebot Builder container (Next.js app)
- Typebot Viewer container (Next.js or static site)
d. Data Stores
- PostgreSQL container or external RDS
- Object storage (MinIO container or AWS S3)
e. Deployment Orchestration
- Docker Engine & Docker Compose
- Setup scripts (install-docker.sh, upload.sh)

##### Relationships and Interactions
- HTTP(S) → Traefik → appropriate service based on hostname & port
- Builder host → Builder container
- Viewer host → Viewer container
- Typebot services ↔ PostgreSQL (SQL over the Docker network)
- Typebot services ↔ Object storage (S3 API)
- Traefik ↔ Let’s Encrypt ACME servers for cert retrieval
- Docker Compose orchestrates container lifecycle

##### Architectural Patterns and Principles
- Reverse-proxy pattern for SSL termination and routing
- Infrastructure-as-code via Docker Compose and declarative YAML
- Separation of concerns: routing, application, data layers
- Environment-based configuration using `.env`

##### Essential Elements
- Clear component labels (e.g., “Traefik Reverse Proxy”, “Typebot Builder”, “PostgreSQL DB”)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Edge / Ingress Layer
    subgraph "Edge / Ingress"
        direction TB
        ClientBuilder["Browser (Typebot Builder)"]:::client
        ClientViewer["Browser (Typebot Viewer)"]:::client
        Traefik["Traefik Reverse Proxy\n(entrypoints 80/443)"]:::routing
        ACME["Let's Encrypt ACME"]:::routing
    end

    %% Application Tier
    subgraph "Application Tier"
        direction TB
        Builder["Typebot Builder Container\n(Next.js)"]:::app
        Viewer["Typebot Viewer Container\n(Next.js/Static)"]:::app
    end

    %% Data Tier
    subgraph "Data Tier"
        direction TB
        Postgres[(PostgreSQL DB)]:::data
        Storage[(MinIO / AWS S3)]:::data
    end

    %% Orchestration & Config
    subgraph "Orchestration & Config"
        direction TB
        DockerCompose["docker-compose.yaml"]:::orchestration
        EnvFile[".env"]:::config
        TraefikConfig["traefik.yml"]:::config
        InstallScript["install-docker.sh"]:::orchestration
        UploadScript["upload.sh"]:::orchestration
        Reference["ref.txt"]:::config
        Readme["README.md"]:::config
    end

    %% Connections
    ClientBuilder -->|HTTPS| Traefik
    ClientViewer -->|HTTPS| Traefik
    Traefik -->|routes to builder| Builder
    Traefik -->|routes to viewer| Viewer
    Traefik -->|obtains certs| ACME
    Builder -->|SQL over network| Postgres
    Viewer -->|SQL over network| Postgres
    Builder -->|S3 API| Storage
    Viewer -->|S3 API| Storage
    DockerCompose -->|orchestrates| Traefik
    DockerCompose -->|orchestrates| Builder
    DockerCompose -->|orchestrates| Viewer
    DockerCompose -->|orchestrates| Postgres
    DockerCompose -->|orchestrates| Storage
    DockerCompose -->|uses config| EnvFile
    DockerCompose -->|uses config| TraefikConfig
    InstallScript -->|provisions Docker| DockerCompose
    UploadScript -->|deploy assets| Storage

    %% Click events
    click EnvFile "https://github.com/erickwendel/typebot-docker/blob/main/.env"
    click DockerCompose "https://github.com/erickwendel/typebot-docker/blob/main/docker-compose.yaml"
    click TraefikConfig "https://github.com/erickwendel/typebot-docker/blob/main/traefik.yml"
    click InstallScript "https://github.com/erickwendel/typebot-docker/blob/main/scripts/install-docker.sh"
    click UploadScript "https://github.com/erickwendel/typebot-docker/blob/main/scripts/upload.sh"
    click Reference "https://github.com/erickwendel/typebot-docker/blob/main/ref.txt"
    click Readme "https://github.com/erickwendel/typebot-docker/blob/main/README.md"

    %% Styles
    classDef client fill:#FFF0F0,stroke:#F00,stroke-width:1px
    classDef routing fill:#D0E8FF,stroke:#009,stroke-width:1px
    classDef app fill:#D0FFD6,stroke:#090,stroke-width:1px
    classDef data fill:#FFE4B3,stroke:#F90,stroke-width:1px
    classDef orchestration fill:#E0E0E0,stroke:#666,stroke-width:1px
    classDef config fill:#F5F5F5,stroke:#999,stroke-width:1px
```
