# neondatabase/examples architecture

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

- Interactive diagram: https://gitdiagram.com/neondatabase/examples
- Repository: https://github.com/neondatabase/examples

## Overview

This repository is a collection of independent Neon example applications and starter projects, not one unified runtime. A developer chooses an example, configures its database connection, and runs that application. The graph preserves the README’s AI, bot, and getting-started branches, while sampled realtime examples show more detailed paths for collaborative chat, live todos, and MCP contacts. Edges are limited to relationships visible in excerpts, the source index, or the README; unsampled internals are represented at their enclosing directories.

Main entry points: [`realtime/guides-chat-app/backend/server.ts`](https://github.com/neondatabase/examples/blob/main/realtime/guides-chat-app/backend/server.ts) (Chat API), [`realtime/guides-chat-app/frontend/main.tsx`](https://github.com/neondatabase/examples/blob/main/realtime/guides-chat-app/frontend/main.tsx) (Chat app startup), [`realtime/with-react/src/server.ts`](https://github.com/neondatabase/examples/blob/main/realtime/with-react/src/server.ts) (Todo API), [`realtime/guides-chat-app/frontend/api.ts`](https://github.com/neondatabase/examples/blob/main/realtime/guides-chat-app/frontend/api.ts) (Chat API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_examples["Example starters"]
  node_getting_started["Neon getting started"]
  node_mcp_contacts["Contacts MCP<br/>[index.ts]"]
  node_mcp_database[("Contacts database<br/>[schema.ts]")]
end

subgraph group_realtime["Realtime apps"]
  node_guides_chat_ui["Chat interface<br/>[ChatApp.tsx]"]
  node_chat_startup["Chat app startup<br/>[main.tsx]"]
  node_chat_api_client["Chat API client<br/>[api.ts]"]
  node_chat_collections["Message collection<br/>[collections.ts]"]
  node_chat_api["Chat API<br/>[server.ts]"]
  node_chat_auth["Chat authentication<br/>[auth.ts]"]
  node_chat_queries["Chat live queries<br/>[queries.ts]"]
  node_chat_realtime["Realtime service setup<br/>[realtime.ts]"]
  node_chat_db["Chat database access<br/>[db.ts]"]
  node_chat_schema[("Chat data model<br/>[schema.ts]")]
  node_react_todos["Live todo interface<br/>[App.tsx]"]
  node_react_api["Todo API<br/>[server.ts]"]
  node_react_db["Todo database access<br/>[db.ts]"]
  node_react_schema[("Todo data model<br/>[schema.ts]")]
end

subgraph group_ai["AI applications"]
  node_ai_examples["Search and RAG starters"]
end

subgraph group_bots["Messaging bots"]
  node_bot_examples["Messaging bot starters"]
end

node_developer(("Developer"))

node_developer -->|"chooses example"| node_getting_started
node_developer -->|"chooses example"| node_ai_examples
node_developer -->|"chooses example"| node_bot_examples
node_developer -.->|"uses starter"| node_mcp_contacts
node_developer -.->|"uses app"| node_guides_chat_ui
node_chat_startup -->|"renders"| node_guides_chat_ui
node_chat_startup -->|"fetches queries"| node_chat_api_client
node_chat_startup -->|"creates collection"| node_chat_collections
node_chat_collections -->|"calls mutations"| node_chat_api_client
node_chat_api_client -->|"sends requests"| node_chat_api
node_chat_api -->|"checks identity"| node_chat_auth
node_chat_api -->|"seals queries"| node_chat_queries
node_chat_api -->|"seals queries"| node_chat_realtime
node_chat_api -->|"reads and writes"| node_chat_db
node_chat_api -->|"queries tables"| node_chat_schema
node_chat_queries -->|"queries"| node_chat_db
node_chat_db -->|"loads schema"| node_chat_schema
node_react_todos -->|"sends mutations"| node_react_api
node_react_api -->|"reads and writes"| node_react_db
node_react_api -->|"queries todos"| node_react_schema
node_react_db -->|"loads schema"| node_react_schema
node_mcp_contacts -->|"reads and writes"| node_mcp_database

click node_getting_started "https://github.com/neondatabase/examples/tree/main/neon-getting-started"
click node_mcp_contacts "https://github.com/neondatabase/examples/blob/main/with-mcp/src/index.ts"
click node_mcp_database "https://github.com/neondatabase/examples/blob/main/with-mcp/src/db/schema.ts"
click node_guides_chat_ui "https://github.com/neondatabase/examples/blob/main/realtime/guides-chat-app/frontend/ChatApp.tsx"
click node_chat_startup "https://github.com/neondatabase/examples/blob/main/realtime/guides-chat-app/frontend/main.tsx"
click node_chat_api_client "https://github.com/neondatabase/examples/blob/main/realtime/guides-chat-app/frontend/api.ts"
click node_chat_collections "https://github.com/neondatabase/examples/blob/main/realtime/guides-chat-app/frontend/collections.ts"
click node_chat_api "https://github.com/neondatabase/examples/blob/main/realtime/guides-chat-app/backend/server.ts"
click node_chat_auth "https://github.com/neondatabase/examples/blob/main/realtime/guides-chat-app/backend/auth.ts"
click node_chat_queries "https://github.com/neondatabase/examples/blob/main/realtime/guides-chat-app/backend/queries.ts"
click node_chat_realtime "https://github.com/neondatabase/examples/blob/main/realtime/guides-chat-app/backend/realtime.ts"
click node_chat_db "https://github.com/neondatabase/examples/blob/main/realtime/guides-chat-app/backend/db.ts"
click node_chat_schema "https://github.com/neondatabase/examples/blob/main/realtime/guides-chat-app/backend/schema.ts"
click node_react_todos "https://github.com/neondatabase/examples/blob/main/realtime/with-react/web/src/App.tsx"
click node_react_api "https://github.com/neondatabase/examples/blob/main/realtime/with-react/src/server.ts"
click node_react_db "https://github.com/neondatabase/examples/blob/main/realtime/with-react/src/db.ts"
click node_react_schema "https://github.com/neondatabase/examples/blob/main/realtime/with-react/src/schema.ts"
click node_ai_examples "https://github.com/neondatabase/examples/tree/main/ai"
click node_bot_examples "https://github.com/neondatabase/examples/tree/main/bots"

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_getting_started,node_mcp_contacts,node_mcp_database toneBlue
class node_guides_chat_ui,node_chat_startup,node_chat_api_client,node_chat_collections,node_chat_api,node_chat_auth,node_chat_queries,node_chat_realtime,node_chat_db,node_chat_schema,node_react_todos,node_react_api,node_react_db,node_react_schema toneAmber
class node_ai_examples toneMint
class node_bot_examples toneRose
class node_developer toneIndigo
```

## Components

### Example starters

- [Neon getting started](https://github.com/neondatabase/examples/tree/main/neon-getting-started): `neon-getting-started`
- [Contacts MCP](https://github.com/neondatabase/examples/blob/main/with-mcp/src/index.ts): `with-mcp/src/index.ts`
- [Contacts database](https://github.com/neondatabase/examples/blob/main/with-mcp/src/db/schema.ts): `with-mcp/src/db/schema.ts`

### Realtime apps

- [Chat interface](https://github.com/neondatabase/examples/blob/main/realtime/guides-chat-app/frontend/ChatApp.tsx): `realtime/guides-chat-app/frontend/ChatApp.tsx`
- [Chat app startup](https://github.com/neondatabase/examples/blob/main/realtime/guides-chat-app/frontend/main.tsx): `realtime/guides-chat-app/frontend/main.tsx`
- [Chat API client](https://github.com/neondatabase/examples/blob/main/realtime/guides-chat-app/frontend/api.ts): `realtime/guides-chat-app/frontend/api.ts`
- [Message collection](https://github.com/neondatabase/examples/blob/main/realtime/guides-chat-app/frontend/collections.ts): `realtime/guides-chat-app/frontend/collections.ts`
- [Chat API](https://github.com/neondatabase/examples/blob/main/realtime/guides-chat-app/backend/server.ts): `realtime/guides-chat-app/backend/server.ts`
- [Chat authentication](https://github.com/neondatabase/examples/blob/main/realtime/guides-chat-app/backend/auth.ts): `realtime/guides-chat-app/backend/auth.ts`
- [Chat live queries](https://github.com/neondatabase/examples/blob/main/realtime/guides-chat-app/backend/queries.ts): `realtime/guides-chat-app/backend/queries.ts`
- [Realtime service setup](https://github.com/neondatabase/examples/blob/main/realtime/guides-chat-app/backend/realtime.ts): `realtime/guides-chat-app/backend/realtime.ts`
- [Chat database access](https://github.com/neondatabase/examples/blob/main/realtime/guides-chat-app/backend/db.ts): `realtime/guides-chat-app/backend/db.ts`
- [Chat data model](https://github.com/neondatabase/examples/blob/main/realtime/guides-chat-app/backend/schema.ts): `realtime/guides-chat-app/backend/schema.ts`
- [Live todo interface](https://github.com/neondatabase/examples/blob/main/realtime/with-react/web/src/App.tsx): `realtime/with-react/web/src/App.tsx`
- [Todo API](https://github.com/neondatabase/examples/blob/main/realtime/with-react/src/server.ts): `realtime/with-react/src/server.ts`
- [Todo database access](https://github.com/neondatabase/examples/blob/main/realtime/with-react/src/db.ts): `realtime/with-react/src/db.ts`
- [Todo data model](https://github.com/neondatabase/examples/blob/main/realtime/with-react/src/schema.ts): `realtime/with-react/src/schema.ts`

### AI applications

- [Search and RAG starters](https://github.com/neondatabase/examples/tree/main/ai): `ai`

### Messaging bots

- [Messaging bot starters](https://github.com/neondatabase/examples/tree/main/bots): `bots`

### Other components

- **Developer**

## Connections

- Developer → Neon getting started: chooses example (evidence: `README.md`)
- Developer → Search and RAG starters: chooses example (evidence: `README.md`)
- Developer → Messaging bot starters: chooses example (evidence: `README.md`)
- Developer → Contacts MCP: uses starter
- Developer → Chat interface: uses app
- Chat app startup → Chat interface: renders (evidence: `realtime/guides-chat-app/frontend/main.tsx`)
- Chat app startup → Chat API client: fetches queries (evidence: `realtime/guides-chat-app/frontend/main.tsx`)
- Chat app startup → Message collection: creates collection (evidence: `realtime/guides-chat-app/frontend/main.tsx`)
- Message collection → Chat API client: calls mutations (evidence: `realtime/guides-chat-app/frontend/collections.ts`)
- Chat API client → Chat API: sends requests (evidence: `realtime/guides-chat-app/frontend/api.ts`)
- Chat API → Chat authentication: checks identity (evidence: `realtime/guides-chat-app/backend/server.ts`)
- Chat API → Chat live queries: seals queries (evidence: `realtime/guides-chat-app/backend/server.ts`)
- Chat API → Realtime service setup: seals queries (evidence: `realtime/guides-chat-app/backend/server.ts`)
- Chat API → Chat database access: reads and writes (evidence: `realtime/guides-chat-app/backend/server.ts`)
- Chat API → Chat data model: queries tables (evidence: `realtime/guides-chat-app/backend/server.ts`)
- Chat live queries → Chat database access: queries (evidence: `realtime/guides-chat-app/backend/queries.ts`)
- Chat database access → Chat data model: loads schema (evidence: `realtime/guides-chat-app/backend/db.ts`)
- Live todo interface → Todo API: sends mutations (evidence: `realtime/with-react/web/src/App.tsx`)
- Todo API → Todo database access: reads and writes (evidence: `realtime/with-react/src/server.ts`)
- Todo API → Todo data model: queries todos (evidence: `realtime/with-react/src/server.ts`)
- Todo database access → Todo data model: loads schema (evidence: `realtime/with-react/src/db.ts`)
- Contacts MCP → Contacts database: reads and writes (evidence: `with-mcp/src/index.ts`)
