# shelcia/crm architecture

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

- Interactive diagram: https://gitdiagram.com/shelcia/crm
- Repository: https://github.com/shelcia/crm

## Overview

Tiny CRM is a role-based customer relationship management app: users sign in, enter the admin workspace, and manage customer and operational records through a React frontend backed by a Go REST API and MongoDB. Its major branches include contacts, support tickets, deals, projects, email campaigns, users, company settings, and dashboard reporting. The README documents the backend stack and scheduled SMTP delivery; sampled frontend excerpts show routing, dashboard data retrieval, and board updates. Most backend handlers and several frontend pages were not sampled, so those links are marked unverified.

Main entry points: [`frontend/src/layout/admin/Layout.tsx`](https://github.com/shelcia/crm/blob/master/frontend/src/layout/admin/Layout.tsx) (Admin Workspace), [`frontend/src/services/api.ts`](https://github.com/shelcia/crm/blob/master/frontend/src/services/api.ts) (API Client), [`frontend/src/routes.tsx`](https://github.com/shelcia/crm/blob/master/frontend/src/routes.tsx) (Routes & Access), [`backend/main.go`](https://github.com/shelcia/crm/blob/master/backend/main.go) (Go API Server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend"]
  node_app["React App<br/>[App.tsx]"]
  node_routes["Routes &amp; Access<br/>[routes.tsx]"]
  node_authui["Sign-in &amp; Account<br/>[index.tsx]"]
  node_workspace["Admin Workspace<br/>[Layout.tsx]"]
  node_api["API Client<br/>[api.ts]"]
end

subgraph group_crm["CRM Workflows"]
  node_dashboard["Dashboard<br/>[index.tsx]"]
  node_contacts["Contacts<br/>[index.tsx]"]
  node_tickets["Support Tickets<br/>[index.tsx]"]
  node_pipeline["Deal Pipeline<br/>[index.tsx]"]
  node_projects["Project Boards<br/>[index.tsx]"]
  node_emailsui["Email Campaigns<br/>[index.tsx]"]
  node_usersui["User Administration<br/>[index.tsx]"]
  node_company["Company Profile<br/>[index.tsx]"]
end

subgraph group_backend["Backend Services"]
  node_server["Go API Server<br/>[main.go]"]
  node_auth["Authentication<br/>[auth.go]"]
  node_handlers["Resource Handlers"]
  node_models["CRM Models"]
  node_mongodb[("MongoDB")]
end

subgraph group_messaging["Email Delivery"]
  node_scheduler["Email Scheduler<br/>[email_scheduler.go]"]
  node_smtp["Gmail SMTP"]
  node_templates["Email Templates"]
end

node_user(("CRM User"))

node_user -->|"uses"| node_app
node_app -->|"renders routes"| node_routes
node_routes -->|"routes to"| node_authui
node_routes -->|"routes to"| node_workspace
node_workspace -.->|"hosts pages"| node_dashboard
node_workspace -.->|"hosts pages"| node_contacts
node_workspace -.->|"hosts pages"| node_tickets
node_workspace -.->|"hosts pages"| node_pipeline
node_workspace -.->|"hosts pages"| node_projects
node_workspace -.->|"hosts pages"| node_emailsui
node_workspace -.->|"hosts pages"| node_usersui
node_workspace -.->|"hosts pages"| node_company
node_dashboard -->|"requests stats"| node_api
node_projects -->|"requests board data"| node_api
node_pipeline -.->|"updates deals"| node_api
node_contacts -.->|"manages records"| node_api
node_tickets -.->|"manages tickets"| node_api
node_emailsui -.->|"manages campaigns"| node_api
node_usersui -.->|"manages users"| node_api
node_company -.->|"updates company"| node_api
node_api -.->|"calls REST API"| node_server
node_server -.->|"routes auth"| node_auth
node_server -.->|"routes requests"| node_handlers
node_handlers -.->|"uses models"| node_models
node_models -.->|"persists records"| node_mongodb
node_scheduler -.->|"uses templates"| node_templates
node_scheduler -.->|"sends scheduled mail"| node_smtp

click node_app "https://github.com/shelcia/crm/blob/master/frontend/src/App.tsx"
click node_routes "https://github.com/shelcia/crm/blob/master/frontend/src/routes.tsx"
click node_authui "https://github.com/shelcia/crm/blob/master/frontend/src/pages/auth/login/index.tsx"
click node_workspace "https://github.com/shelcia/crm/blob/master/frontend/src/layout/admin/Layout.tsx"
click node_dashboard "https://github.com/shelcia/crm/blob/master/frontend/src/pages/admin/dashboard/index.tsx"
click node_contacts "https://github.com/shelcia/crm/blob/master/frontend/src/pages/admin/contacts/index.tsx"
click node_tickets "https://github.com/shelcia/crm/blob/master/frontend/src/pages/admin/tickets/index.tsx"
click node_pipeline "https://github.com/shelcia/crm/blob/master/frontend/src/pages/admin/pipeline/index.tsx"
click node_projects "https://github.com/shelcia/crm/blob/master/frontend/src/pages/admin/projects/index.tsx"
click node_emailsui "https://github.com/shelcia/crm/blob/master/frontend/src/pages/admin/emails/templates/index.tsx"
click node_usersui "https://github.com/shelcia/crm/blob/master/frontend/src/pages/admin/users/index.tsx"
click node_company "https://github.com/shelcia/crm/blob/master/frontend/src/pages/admin/add-company/index.tsx"
click node_api "https://github.com/shelcia/crm/blob/master/frontend/src/services/api.ts"
click node_server "https://github.com/shelcia/crm/blob/master/backend/main.go"
click node_auth "https://github.com/shelcia/crm/blob/master/backend/handlers/auth.go"
click node_handlers "https://github.com/shelcia/crm/tree/master/backend/handlers"
click node_models "https://github.com/shelcia/crm/tree/master/backend/models"
click node_scheduler "https://github.com/shelcia/crm/blob/master/backend/scheduler/email_scheduler.go"
click node_templates "https://github.com/shelcia/crm/tree/master/backend/templates"

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_routes,node_authui,node_workspace,node_api,node_user toneBlue
class node_dashboard,node_contacts,node_tickets,node_pipeline,node_projects,node_emailsui,node_usersui,node_company toneAmber
class node_server,node_auth,node_handlers,node_models,node_mongodb toneMint
class node_scheduler,node_smtp,node_templates toneRose
```

## Components

### Frontend

- [React App](https://github.com/shelcia/crm/blob/master/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Routes & Access](https://github.com/shelcia/crm/blob/master/frontend/src/routes.tsx): `frontend/src/routes.tsx`
- [Sign-in & Account](https://github.com/shelcia/crm/blob/master/frontend/src/pages/auth/login/index.tsx): `frontend/src/pages/auth/login/index.tsx`
- [Admin Workspace](https://github.com/shelcia/crm/blob/master/frontend/src/layout/admin/Layout.tsx): `frontend/src/layout/admin/Layout.tsx`
- [API Client](https://github.com/shelcia/crm/blob/master/frontend/src/services/api.ts): `frontend/src/services/api.ts`

### CRM Workflows

- [Dashboard](https://github.com/shelcia/crm/blob/master/frontend/src/pages/admin/dashboard/index.tsx): `frontend/src/pages/admin/dashboard/index.tsx`
- [Contacts](https://github.com/shelcia/crm/blob/master/frontend/src/pages/admin/contacts/index.tsx): `frontend/src/pages/admin/contacts/index.tsx`
- [Support Tickets](https://github.com/shelcia/crm/blob/master/frontend/src/pages/admin/tickets/index.tsx): `frontend/src/pages/admin/tickets/index.tsx`
- [Deal Pipeline](https://github.com/shelcia/crm/blob/master/frontend/src/pages/admin/pipeline/index.tsx): `frontend/src/pages/admin/pipeline/index.tsx`
- [Project Boards](https://github.com/shelcia/crm/blob/master/frontend/src/pages/admin/projects/index.tsx): `frontend/src/pages/admin/projects/index.tsx`
- [Email Campaigns](https://github.com/shelcia/crm/blob/master/frontend/src/pages/admin/emails/templates/index.tsx): `frontend/src/pages/admin/emails/templates/index.tsx`
- [User Administration](https://github.com/shelcia/crm/blob/master/frontend/src/pages/admin/users/index.tsx): `frontend/src/pages/admin/users/index.tsx`
- [Company Profile](https://github.com/shelcia/crm/blob/master/frontend/src/pages/admin/add-company/index.tsx): `frontend/src/pages/admin/add-company/index.tsx`

### Backend Services

- [Go API Server](https://github.com/shelcia/crm/blob/master/backend/main.go): `backend/main.go`
- [Authentication](https://github.com/shelcia/crm/blob/master/backend/handlers/auth.go): `backend/handlers/auth.go`
- [Resource Handlers](https://github.com/shelcia/crm/tree/master/backend/handlers): `backend/handlers`
- [CRM Models](https://github.com/shelcia/crm/tree/master/backend/models): `backend/models`
- **MongoDB**

### Email Delivery

- [Email Scheduler](https://github.com/shelcia/crm/blob/master/backend/scheduler/email_scheduler.go): `backend/scheduler/email_scheduler.go`
- **Gmail SMTP**
- [Email Templates](https://github.com/shelcia/crm/tree/master/backend/templates): `backend/templates`

### Other components

- **CRM User**

## Connections

- CRM User → React App: uses
- React App → Routes & Access: renders routes (evidence: `frontend/src/App.tsx`)
- Routes & Access → Sign-in & Account: routes to (evidence: `frontend/src/routes.tsx`)
- Routes & Access → Admin Workspace: routes to (evidence: `frontend/src/routes.tsx`)
- Admin Workspace → Dashboard: hosts pages
- Admin Workspace → Contacts: hosts pages
- Admin Workspace → Support Tickets: hosts pages
- Admin Workspace → Deal Pipeline: hosts pages
- Admin Workspace → Project Boards: hosts pages
- Admin Workspace → Email Campaigns: hosts pages
- Admin Workspace → User Administration: hosts pages
- Admin Workspace → Company Profile: hosts pages
- Dashboard → API Client: requests stats (evidence: `frontend/src/pages/admin/dashboard/index.tsx`)
- Project Boards → API Client: requests board data (evidence: `frontend/src/pages/admin/projects/index.tsx`)
- Deal Pipeline → API Client: updates deals
- Contacts → API Client: manages records
- Support Tickets → API Client: manages tickets
- Email Campaigns → API Client: manages campaigns
- User Administration → API Client: manages users
- Company Profile → API Client: updates company
- API Client → Go API Server: calls REST API
- Go API Server → Authentication: routes auth
- Go API Server → Resource Handlers: routes requests
- Resource Handlers → CRM Models: uses models
- CRM Models → MongoDB: persists records
- Email Scheduler → Email Templates: uses templates
- Email Scheduler → Gmail SMTP: sends scheduled mail
