# hazammm/synk architecture

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

- Interactive diagram: https://gitdiagram.com/hazammm/synk
- Repository: https://github.com/hazammm/synk

## Overview

Synk is a team workspace combining chat, issue tracking, project work, time tracking, search, and an AI agent constrained by the signed-in user’s permissions. The principal path is browser request → Next.js route → feature service → shared authorization and PostgreSQL; chat also supports live delivery. The Python agent receives scoped context and calls back through Synk’s tool endpoints. The README documents additional workspace, people, reporting, docs, and code-host capabilities; docs implementation is not present in the supplied tree. Relationships are shown only where the README or provided source index/excerpts support them.

Main entry points: [`src/lib/db.ts`](https://github.com/hazammm/synk/blob/main/src/lib/db.ts) (PostgreSQL via Prisma), [`src/app/api/tickets/route.ts`](https://github.com/hazammm/synk/blob/main/src/app/api/tickets/route.ts) (Next.js app and routes), [`src/lib/permissions.ts`](https://github.com/hazammm/synk/blob/main/src/lib/permissions.ts) (Shared permissions), [`src/features/chat/service.ts`](https://github.com/hazammm/synk/blob/main/src/features/chat/service.ts) (Chat and channels)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_product["Workspace features"]
  node_workspaces["Workspace onboarding<br/>[onboarding.ts]"]
  node_chat["Chat and channels<br/>[service.ts]"]
  node_tickets["Tickets and boards<br/>[service.ts]"]
  node_projects["Projects and access<br/>[service.ts]"]
  node_time["Time tracking<br/>[service.ts]"]
  node_search["Workspace search<br/>[service.ts]"]
  node_reports["Reports and exports<br/>[service.ts]"]
  node_account["Account services<br/>[service.ts]"]
  node_notifications["Notifications<br/>[service.ts]"]
end

subgraph group_platform["Request and access platform"]
  node_web["Next.js app and routes<br/>[route.ts]"]
  node_sessions["Session identity<br/>[session.ts]"]
  node_permissions["Shared permissions<br/>[permissions.ts]"]
  node_validation["Input validation<br/>[validation.ts]"]
  node_database[("PostgreSQL via Prisma<br/>[db.ts]")]
end

subgraph group_agent["AI agent"]
  node_agent_feature["Agent orchestration<br/>[service.ts]"]
  node_agent_runtime["Python agent service<br/>[api.py]"]
  node_tool_routes["Agent tool endpoints<br/>[route.ts]"]
  node_agent_db[("SQLite checkpointer")]
  node_gemini["Google Gemini"]
end

subgraph group_integrations["Live and external services"]
  node_integrations["Code-host integrations<br/>[service.ts]"]
  node_realtime["Live delivery<br/>[realtime.ts]"]
  node_socket["Socket.IO server<br/>[socket.ts]"]
  node_github_bitbucket["GitHub and Bitbucket"]
end

node_browser(("Browser"))

node_browser -->|"HTTP requests"| node_web
node_web -->|"routes onboarding"| node_workspaces
node_web -->|"requires user"| node_sessions
node_web -->|"manages conversations"| node_agent_feature
node_web -->|"routes ticket requests"| node_tickets
node_chat -->|"checks access"| node_permissions
node_tickets -->|"checks access"| node_permissions
node_projects -->|"checks access"| node_permissions
node_time -->|"checks access"| node_permissions
node_search -->|"filters access"| node_permissions
node_chat -->|"reads and writes"| node_database
node_tickets -->|"reads and writes"| node_database
node_projects -->|"reads and writes"| node_database
node_time -->|"reads and writes"| node_database
node_workspaces -->|"reads and writes"| node_database
node_chat -->|"publishes updates"| node_realtime
node_chat -->|"creates alerts"| node_notifications
node_tickets -->|"announces alerts"| node_notifications
node_notifications -->|"notifies users"| node_realtime
node_socket -->|"rechecks recipients"| node_permissions
node_socket -->|"serves live chat"| node_chat
node_web -->|"posts chat context"| node_agent_runtime
node_agent_runtime -->|"calls tools"| node_tool_routes
node_tool_routes -->|"uses feature services"| node_tickets
node_tool_routes -->|"shares access rules"| node_permissions
node_agent_runtime -->|"stores memory"| node_agent_db
node_agent_runtime -->|"queries model"| node_gemini
node_agent_feature -->|"stores transcript"| node_database
node_integrations -->|"connects providers"| node_github_bitbucket
node_integrations -.->|"stores links"| node_database
node_reports -.->|"queries metrics"| node_database
node_account -->|"checks access"| node_permissions
node_account -->|"reads and writes"| node_database
node_web -->|"validates input"| node_validation

click node_web "https://github.com/hazammm/synk/blob/main/src/app/api/tickets/route.ts"
click node_workspaces "https://github.com/hazammm/synk/blob/main/src/features/workspaces/onboarding.ts"
click node_chat "https://github.com/hazammm/synk/blob/main/src/features/chat/service.ts"
click node_tickets "https://github.com/hazammm/synk/blob/main/src/features/tickets/service.ts"
click node_projects "https://github.com/hazammm/synk/blob/main/src/features/projects/service.ts"
click node_time "https://github.com/hazammm/synk/blob/main/src/features/time/service.ts"
click node_search "https://github.com/hazammm/synk/blob/main/src/features/search/service.ts"
click node_reports "https://github.com/hazammm/synk/blob/main/src/features/reports/service.ts"
click node_integrations "https://github.com/hazammm/synk/blob/main/src/features/integrations/service.ts"
click node_account "https://github.com/hazammm/synk/blob/main/src/features/account/service.ts"
click node_agent_feature "https://github.com/hazammm/synk/blob/main/src/features/agent/service.ts"
click node_agent_runtime "https://github.com/hazammm/synk/blob/main/agent/synk_agent/api.py"
click node_tool_routes "https://github.com/hazammm/synk/blob/main/src/app/api/agent-tools/%5Bname%5D/route.ts"
click node_sessions "https://github.com/hazammm/synk/blob/main/src/lib/session.ts"
click node_permissions "https://github.com/hazammm/synk/blob/main/src/lib/permissions.ts"
click node_validation "https://github.com/hazammm/synk/blob/main/src/lib/validation.ts"
click node_database "https://github.com/hazammm/synk/blob/main/src/lib/db.ts"
click node_realtime "https://github.com/hazammm/synk/blob/main/src/lib/realtime.ts"
click node_socket "https://github.com/hazammm/synk/blob/main/src/server/socket.ts"
click node_notifications "https://github.com/hazammm/synk/blob/main/src/features/notifications/service.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_workspaces,node_chat,node_tickets,node_projects,node_time,node_search,node_reports,node_account,node_notifications,node_browser toneBlue
class node_web,node_sessions,node_permissions,node_validation,node_database toneAmber
class node_agent_feature,node_agent_runtime,node_tool_routes,node_agent_db,node_gemini toneMint
class node_integrations,node_realtime,node_socket,node_github_bitbucket toneRose
```

## Components

### Workspace features

- [Workspace onboarding](https://github.com/hazammm/synk/blob/main/src/features/workspaces/onboarding.ts): `src/features/workspaces/onboarding.ts`
- [Chat and channels](https://github.com/hazammm/synk/blob/main/src/features/chat/service.ts): `src/features/chat/service.ts`
- [Tickets and boards](https://github.com/hazammm/synk/blob/main/src/features/tickets/service.ts): `src/features/tickets/service.ts`
- [Projects and access](https://github.com/hazammm/synk/blob/main/src/features/projects/service.ts): `src/features/projects/service.ts`
- [Time tracking](https://github.com/hazammm/synk/blob/main/src/features/time/service.ts): `src/features/time/service.ts`
- [Workspace search](https://github.com/hazammm/synk/blob/main/src/features/search/service.ts): `src/features/search/service.ts`
- [Reports and exports](https://github.com/hazammm/synk/blob/main/src/features/reports/service.ts): `src/features/reports/service.ts`
- [Account services](https://github.com/hazammm/synk/blob/main/src/features/account/service.ts): `src/features/account/service.ts`
- [Notifications](https://github.com/hazammm/synk/blob/main/src/features/notifications/service.ts): `src/features/notifications/service.ts`

### Request and access platform

- [Next.js app and routes](https://github.com/hazammm/synk/blob/main/src/app/api/tickets/route.ts): `src/app/api/tickets/route.ts`
- [Session identity](https://github.com/hazammm/synk/blob/main/src/lib/session.ts): `src/lib/session.ts`
- [Shared permissions](https://github.com/hazammm/synk/blob/main/src/lib/permissions.ts): `src/lib/permissions.ts`
- [Input validation](https://github.com/hazammm/synk/blob/main/src/lib/validation.ts): `src/lib/validation.ts`
- [PostgreSQL via Prisma](https://github.com/hazammm/synk/blob/main/src/lib/db.ts): `src/lib/db.ts`

### AI agent

- [Agent orchestration](https://github.com/hazammm/synk/blob/main/src/features/agent/service.ts): `src/features/agent/service.ts`
- [Python agent service](https://github.com/hazammm/synk/blob/main/agent/synk_agent/api.py): `agent/synk_agent/api.py`
- [Agent tool endpoints](https://github.com/hazammm/synk/blob/main/src/app/api/agent-tools/%5Bname%5D/route.ts): `src/app/api/agent-tools/[name]/route.ts`
- **SQLite checkpointer**
- **Google Gemini**

### Live and external services

- [Code-host integrations](https://github.com/hazammm/synk/blob/main/src/features/integrations/service.ts): `src/features/integrations/service.ts`
- [Live delivery](https://github.com/hazammm/synk/blob/main/src/lib/realtime.ts): `src/lib/realtime.ts`
- [Socket.IO server](https://github.com/hazammm/synk/blob/main/src/server/socket.ts): `src/server/socket.ts`
- **GitHub and Bitbucket**

### Other components

- **Browser**

## Connections

- Browser → Next.js app and routes: HTTP requests (evidence: `README.md`)
- Next.js app and routes → Workspace onboarding: routes onboarding
- Next.js app and routes → Session identity: requires user (evidence: `src/app/api/tickets/route.ts`)
- Next.js app and routes → Agent orchestration: manages conversations
- Next.js app and routes → Tickets and boards: routes ticket requests (evidence: `src/app/api/tickets/route.ts`)
- Chat and channels → Shared permissions: checks access (evidence: `src/features/chat/service.ts`)
- Tickets and boards → Shared permissions: checks access (evidence: `src/features/tickets/service.ts`)
- Projects and access → Shared permissions: checks access (evidence: `src/features/projects/service.ts`)
- Time tracking → Shared permissions: checks access (evidence: `src/features/time/service.ts`)
- Workspace search → Shared permissions: filters access (evidence: `README.md`)
- Chat and channels → PostgreSQL via Prisma: reads and writes (evidence: `src/features/chat/service.ts`)
- Tickets and boards → PostgreSQL via Prisma: reads and writes (evidence: `src/features/tickets/service.ts`)
- Projects and access → PostgreSQL via Prisma: reads and writes (evidence: `src/features/projects/service.ts`)
- Time tracking → PostgreSQL via Prisma: reads and writes (evidence: `src/features/time/service.ts`)
- Workspace onboarding → PostgreSQL via Prisma: reads and writes
- Chat and channels → Live delivery: publishes updates (evidence: `src/features/chat/service.ts`)
- Chat and channels → Notifications: creates alerts (evidence: `src/features/chat/service.ts`)
- Tickets and boards → Notifications: announces alerts (evidence: `src/features/tickets/service.ts`)
- Notifications → Live delivery: notifies users (evidence: `src/features/notifications/service.ts`)
- Socket.IO server → Shared permissions: rechecks recipients (evidence: `README.md`)
- Socket.IO server → Chat and channels: serves live chat (evidence: `README.md`)
- Next.js app and routes → Python agent service: posts chat context (evidence: `README.md`)
- Python agent service → Agent tool endpoints: calls tools (evidence: `README.md`)
- Agent tool endpoints → Tickets and boards: uses feature services (evidence: `README.md`)
- Agent tool endpoints → Shared permissions: shares access rules (evidence: `README.md`)
- Python agent service → SQLite checkpointer: stores memory (evidence: `README.md`)
- Python agent service → Google Gemini: queries model (evidence: `README.md`)
- Agent orchestration → PostgreSQL via Prisma: stores transcript (evidence: `README.md`)
- Code-host integrations → GitHub and Bitbucket: connects providers (evidence: `README.md`)
- Code-host integrations → PostgreSQL via Prisma: stores links (evidence: `src/features/integrations/service.ts`)
- Reports and exports → PostgreSQL via Prisma: queries metrics
- Account services → Shared permissions: checks access (evidence: `src/features/account/service.ts`)
- Account services → PostgreSQL via Prisma: reads and writes (evidence: `src/features/account/service.ts`)
- Next.js app and routes → Input validation: validates input
