# burnzero1/burnzero-site architecture

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

- Interactive diagram: https://gitdiagram.com/burnzero1/burnzero-site
- Repository: https://github.com/burnzero1/burnzero-site

## Overview

Burn Zero is a Next.js marketing site for a carbon-compliance platform, with demo lead capture and embeddable FleetMagic ad units with event tracking. The main visitor flow leads from the landing page to a demo request, which is validated and emailed; ad impressions and engagement are captured and forwarded to analytics integrations. The landing page advertises emissions records, certificate verification, reconciliation, PDF evidence, and on-chain proof, but no implementation of those platform workflows appears in the sampled runtime code. Ad asset internals were not sampled, so their tracking-script wiring is based only on the documented capability.

Main entry points: [`app/api/ad-event/route.ts`](https://github.com/burnzero1/burnzero-site/blob/main/app/api/ad-event/route.ts) (Ad event endpoint), [`app/request-demo/DemoRequestForm.tsx`](https://github.com/burnzero1/burnzero-site/blob/main/app/request-demo/DemoRequestForm.tsx) (Demo form), [`app/api/request-demo/route.ts`](https://github.com/burnzero1/burnzero-site/blob/main/app/api/request-demo/route.ts) (Demo endpoint), [`app/inicio/page.tsx`](https://github.com/burnzero1/burnzero-site/blob/main/app/inicio/page.tsx) (Landing page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_site["Marketing site"]
  node_landing["Landing page<br/>[page.tsx]"]
  node_route["Root rewrite<br/>[middleware.ts]"]
end

subgraph group_leads["Demo requests"]
  node_demo_page["Demo page<br/>[page.tsx]"]
  node_demo_form["Demo form"]
  node_demo_api["Demo endpoint<br/>[route.ts]"]
end

subgraph group_ads["Ad units and analytics"]
  node_ad_showcase["Ad unit showcase<br/>[page.tsx]"]
  node_ad_assets["Ad creative files"]
  node_tracker["Ad tracker<br/>[ad-track.js]"]
  node_ad_api["Ad event endpoint<br/>[route.ts]"]
  node_event_parser["Event validation<br/>[ad-analytics.ts]"]
  node_analytics_info["Analytics guidance<br/>[page.tsx]"]
end

node_visitor(("Site visitor"))
node_resend{{"Resend email API"}}
node_ad_host(("FleetMagic host"))
node_posthog{{"PostHog"}}
node_webhook{{"Optional webhook"}}

node_visitor -->|"requests root"| node_route
node_route -->|"rewrites to"| node_landing
node_visitor -->|"views"| node_landing
node_landing -->|"links to demo"| node_demo_page
node_visitor -->|"opens"| node_demo_page
node_demo_page -->|"renders"| node_demo_form
node_visitor -->|"submits details"| node_demo_form
node_demo_form -->|"posts request"| node_demo_api
node_demo_api -->|"sends email"| node_resend
node_demo_api -->|"returns status"| node_demo_form
node_ad_host -->|"embeds units"| node_ad_assets
node_visitor -->|"views examples"| node_ad_showcase
node_ad_showcase -->|"embeds files"| node_ad_assets
node_ad_assets -.->|"tracks engagement"| node_tracker
node_tracker -->|"posts events"| node_ad_api
node_ad_api -->|"validates payload"| node_event_parser
node_ad_api -.->|"forwards events"| node_posthog
node_ad_api -.->|"forwards events"| node_webhook
node_visitor -->|"views setup guidance"| node_analytics_info

click node_landing "https://github.com/burnzero1/burnzero-site/blob/main/app/inicio/page.tsx"
click node_route "https://github.com/burnzero1/burnzero-site/blob/main/middleware.ts"
click node_demo_page "https://github.com/burnzero1/burnzero-site/blob/main/app/request-demo/page.tsx"
click node_demo_form "https://github.com/burnzero1/burnzero-site/blob/main/app/request-demo/DemoRequestForm.tsx"
click node_demo_api "https://github.com/burnzero1/burnzero-site/blob/main/app/api/request-demo/route.ts"
click node_ad_showcase "https://github.com/burnzero1/burnzero-site/blob/main/app/ads/page.tsx"
click node_ad_assets "https://github.com/burnzero1/burnzero-site/tree/main/public/ads"
click node_tracker "https://github.com/burnzero1/burnzero-site/blob/main/public/ads/ad-track.js"
click node_ad_api "https://github.com/burnzero1/burnzero-site/blob/main/app/api/ad-event/route.ts"
click node_event_parser "https://github.com/burnzero1/burnzero-site/blob/main/lib/ad-analytics.ts"
click node_analytics_info "https://github.com/burnzero1/burnzero-site/blob/main/app/ads/analytics/page.tsx"

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_landing,node_route toneBlue
class node_demo_page,node_demo_form,node_demo_api toneAmber
class node_ad_showcase,node_ad_assets,node_tracker,node_ad_api,node_event_parser,node_analytics_info,node_resend,node_webhook toneMint
class node_visitor,node_ad_host,node_posthog toneIndigo
```

## Components

### Marketing site

- [Landing page](https://github.com/burnzero1/burnzero-site/blob/main/app/inicio/page.tsx): `app/inicio/page.tsx`
- [Root rewrite](https://github.com/burnzero1/burnzero-site/blob/main/middleware.ts): `middleware.ts`

### Demo requests

- [Demo page](https://github.com/burnzero1/burnzero-site/blob/main/app/request-demo/page.tsx): `app/request-demo/page.tsx`
- [Demo form](https://github.com/burnzero1/burnzero-site/blob/main/app/request-demo/DemoRequestForm.tsx): `app/request-demo/DemoRequestForm.tsx`
- [Demo endpoint](https://github.com/burnzero1/burnzero-site/blob/main/app/api/request-demo/route.ts): `app/api/request-demo/route.ts`

### Ad units and analytics

- [Ad unit showcase](https://github.com/burnzero1/burnzero-site/blob/main/app/ads/page.tsx): `app/ads/page.tsx`
- [Ad creative files](https://github.com/burnzero1/burnzero-site/tree/main/public/ads): `public/ads`
- [Ad tracker](https://github.com/burnzero1/burnzero-site/blob/main/public/ads/ad-track.js): `public/ads/ad-track.js`
- [Ad event endpoint](https://github.com/burnzero1/burnzero-site/blob/main/app/api/ad-event/route.ts): `app/api/ad-event/route.ts`
- [Event validation](https://github.com/burnzero1/burnzero-site/blob/main/lib/ad-analytics.ts): `lib/ad-analytics.ts`
- [Analytics guidance](https://github.com/burnzero1/burnzero-site/blob/main/app/ads/analytics/page.tsx): `app/ads/analytics/page.tsx`

### Other components

- **Site visitor**
- **Resend email API**
- **FleetMagic host**
- **PostHog**
- **Optional webhook**

## Connections

- Site visitor → Root rewrite: requests root
- Root rewrite → Landing page: rewrites to
- Site visitor → Landing page: views
- Landing page → Demo page: links to demo
- Site visitor → Demo page: opens
- Demo page → Demo form: renders
- Site visitor → Demo form: submits details
- Demo form → Demo endpoint: posts request
- Demo endpoint → Resend email API: sends email
- Demo endpoint → Demo form: returns status
- FleetMagic host → Ad creative files: embeds units
- Site visitor → Ad unit showcase: views examples
- Ad unit showcase → Ad creative files: embeds files
- Ad creative files → Ad tracker: tracks engagement
- Ad tracker → Ad event endpoint: posts events
- Ad event endpoint → Event validation: validates payload
- Ad event endpoint → PostHog: forwards events
- Ad event endpoint → Optional webhook: forwards events
- Site visitor → Analytics guidance: views setup guidance
