# keremclp/santiye-defter architecture

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

- Interactive diagram: https://gitdiagram.com/keremclp/santiye-defter
- Repository: https://github.com/keremclp/santiye-defter

## Overview

Şantiye Hesap is a multi-company construction-finance web product for tracking income, expenses, agreements, receivables, payables, and due dates. Users enter through the React application, authenticate, and use its domain pages and API client to perform work against the Express REST API; shared schemas and finance functions support both sides. The API also provides separate platform-owner administration, reporting/export, and document storage. Some domain routes and services are unsampled, so their presence is represented by supported subsystem paths without speculative internal call chains.

Main entry points: [`apps/web/src/routes.tsx`](https://github.com/keremclp/santiye-defter/blob/main/apps/web/src/routes.tsx) (Routes and guards), [`apps/web/src/api/client.ts`](https://github.com/keremclp/santiye-defter/blob/main/apps/web/src/api/client.ts) (API client), [`apps/api/src/routes/company-data.ts`](https://github.com/keremclp/santiye-defter/blob/main/apps/api/src/routes/company-data.ts) (Company domain API), [`apps/api/src/app.ts`](https://github.com/keremclp/santiye-defter/blob/main/apps/api/src/app.ts) (HTTP application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_web_routes["Routes and guards<br/>[routes.tsx]"]
  node_web_auth["Login pages<br/>[LoginPage.tsx]"]
  node_web_records["Finance workspaces"]
  node_web_agreements["Agreements and dues"]
  node_web_documents["Document uploads<br/>[useUploadQueue.ts]"]
  node_web_reports["Reports and exports<br/>[ReportsPage.tsx]"]
  node_web_admin["Owner administration<br/>[AdminHomePage.tsx]"]
  node_web_client["API client<br/>[client.ts]"]
end

subgraph group_api["API and domain"]
  node_api_app["HTTP application<br/>[app.ts]"]
  node_api_auth["Customer authentication<br/>[customer-auth.ts]"]
  node_api_platform["Platform auth and management<br/>[platform-auth.ts]"]
  node_api_company["Company domain API<br/>[company-data.ts]"]
  node_api_reports["Report generation<br/>[full-export.ts]"]
  node_api_docs["Document service<br/>[documents.ts]"]
  node_api_state["Service access rules<br/>[service-state.ts]"]
end

subgraph group_shared["Shared finance logic"]
  node_shared_finance["Finance calculations"]
  node_shared_contracts["Shared domain and schemas<br/>[domain.ts]"]
end

subgraph group_infra["Persistence and integrations"]
  node_db_models[("Company data models")]
  node_object_storage[("S3-compatible storage<br/>[storage.ts]")]
end

node_customer(("Company user"))
node_mongo[("MongoDB")]
node_s3[("S3 / MinIO storage")]

node_customer -->|"opens"| node_web_routes
node_web_routes -->|"routes to"| node_web_auth
node_web_routes -->|"routes to"| node_web_records
node_web_routes -->|"routes to"| node_web_agreements
node_web_routes -->|"routes to"| node_web_documents
node_web_routes -->|"routes to"| node_web_reports
node_web_routes -->|"routes to"| node_web_admin
node_web_auth -.->|"requests through"| node_web_client
node_web_records -.->|"requests through"| node_web_client
node_web_agreements -->|"requests through"| node_web_client
node_web_documents -->|"uploads through"| node_web_client
node_web_reports -.->|"requests through"| node_web_client
node_web_admin -.->|"requests through"| node_web_client
node_web_client -->|"sends HTTP"| node_api_app
node_api_app -->|"registers"| node_api_auth
node_api_app -->|"registers"| node_api_company
node_api_app -->|"registers"| node_api_platform
node_api_company -->|"uses auth service"| node_api_auth
node_api_auth -->|"reads and writes"| node_db_models
node_api_platform -->|"reads and writes"| node_db_models
node_api_platform -->|"uses customer auth"| node_api_auth
node_api_company -.->|"checks access"| node_api_state
node_api_company -.->|"uses calculations"| node_shared_finance
node_api_company -.->|"uses contracts"| node_shared_contracts
node_api_reports -.->|"stores exports"| node_object_storage
node_api_docs -.->|"stores documents"| node_object_storage
node_object_storage -->|"accesses"| node_s3
node_db_models -.->|"persists in"| node_mongo

click node_web_routes "https://github.com/keremclp/santiye-defter/blob/main/apps/web/src/routes.tsx"
click node_web_auth "https://github.com/keremclp/santiye-defter/blob/main/apps/web/src/features/auth/LoginPage.tsx"
click node_web_records "https://github.com/keremclp/santiye-defter/blob/main/apps/web/src/features/transactions/TransactionForm.tsx"
click node_web_agreements "https://github.com/keremclp/santiye-defter/blob/main/apps/web/src/features/agreements/AgreementDetailPage.tsx"
click node_web_documents "https://github.com/keremclp/santiye-defter/blob/main/apps/web/src/features/documents/useUploadQueue.ts"
click node_web_reports "https://github.com/keremclp/santiye-defter/blob/main/apps/web/src/features/reports/ReportsPage.tsx"
click node_web_admin "https://github.com/keremclp/santiye-defter/blob/main/apps/web/src/features/admin/AdminHomePage.tsx"
click node_web_client "https://github.com/keremclp/santiye-defter/blob/main/apps/web/src/api/client.ts"
click node_api_app "https://github.com/keremclp/santiye-defter/blob/main/apps/api/src/app.ts"
click node_api_auth "https://github.com/keremclp/santiye-defter/blob/main/apps/api/src/services/customer-auth.ts"
click node_api_platform "https://github.com/keremclp/santiye-defter/blob/main/apps/api/src/services/platform-auth.ts"
click node_api_company "https://github.com/keremclp/santiye-defter/blob/main/apps/api/src/routes/company-data.ts"
click node_api_reports "https://github.com/keremclp/santiye-defter/blob/main/apps/api/src/reports/full-export.ts"
click node_api_docs "https://github.com/keremclp/santiye-defter/blob/main/apps/api/src/services/documents.ts"
click node_api_state "https://github.com/keremclp/santiye-defter/blob/main/apps/api/src/services/service-state.ts"
click node_shared_finance "https://github.com/keremclp/santiye-defter/tree/main/packages/shared/src/finance"
click node_shared_contracts "https://github.com/keremclp/santiye-defter/blob/main/packages/shared/src/domain.ts"
click node_db_models "https://github.com/keremclp/santiye-defter/tree/main/apps/api/src/models"
click node_object_storage "https://github.com/keremclp/santiye-defter/blob/main/apps/api/src/lib/storage.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_web_routes,node_web_auth,node_web_records,node_web_agreements,node_web_documents,node_web_reports,node_web_admin,node_web_client,node_customer toneBlue
class node_api_app,node_api_auth,node_api_platform,node_api_company,node_api_reports,node_api_docs,node_api_state,node_mongo,node_s3 toneAmber
class node_shared_finance,node_shared_contracts toneMint
class node_db_models,node_object_storage toneRose
```

## Components

### Web application

- [Routes and guards](https://github.com/keremclp/santiye-defter/blob/main/apps/web/src/routes.tsx): `apps/web/src/routes.tsx`
- [Login pages](https://github.com/keremclp/santiye-defter/blob/main/apps/web/src/features/auth/LoginPage.tsx): `apps/web/src/features/auth/LoginPage.tsx`
- [Finance workspaces](https://github.com/keremclp/santiye-defter/blob/main/apps/web/src/features/transactions/TransactionForm.tsx): `apps/web/src/features/transactions/TransactionForm.tsx`
- [Agreements and dues](https://github.com/keremclp/santiye-defter/blob/main/apps/web/src/features/agreements/AgreementDetailPage.tsx): `apps/web/src/features/agreements/AgreementDetailPage.tsx`
- [Document uploads](https://github.com/keremclp/santiye-defter/blob/main/apps/web/src/features/documents/useUploadQueue.ts): `apps/web/src/features/documents/useUploadQueue.ts`
- [Reports and exports](https://github.com/keremclp/santiye-defter/blob/main/apps/web/src/features/reports/ReportsPage.tsx): `apps/web/src/features/reports/ReportsPage.tsx`
- [Owner administration](https://github.com/keremclp/santiye-defter/blob/main/apps/web/src/features/admin/AdminHomePage.tsx): `apps/web/src/features/admin/AdminHomePage.tsx`
- [API client](https://github.com/keremclp/santiye-defter/blob/main/apps/web/src/api/client.ts): `apps/web/src/api/client.ts`

### API and domain

- [HTTP application](https://github.com/keremclp/santiye-defter/blob/main/apps/api/src/app.ts): `apps/api/src/app.ts`
- [Customer authentication](https://github.com/keremclp/santiye-defter/blob/main/apps/api/src/services/customer-auth.ts): `apps/api/src/services/customer-auth.ts`
- [Platform auth and management](https://github.com/keremclp/santiye-defter/blob/main/apps/api/src/services/platform-auth.ts): `apps/api/src/services/platform-auth.ts`
- [Company domain API](https://github.com/keremclp/santiye-defter/blob/main/apps/api/src/routes/company-data.ts): `apps/api/src/routes/company-data.ts`
- [Report generation](https://github.com/keremclp/santiye-defter/blob/main/apps/api/src/reports/full-export.ts): `apps/api/src/reports/full-export.ts`
- [Document service](https://github.com/keremclp/santiye-defter/blob/main/apps/api/src/services/documents.ts): `apps/api/src/services/documents.ts`
- [Service access rules](https://github.com/keremclp/santiye-defter/blob/main/apps/api/src/services/service-state.ts): `apps/api/src/services/service-state.ts`

### Shared finance logic

- [Finance calculations](https://github.com/keremclp/santiye-defter/tree/main/packages/shared/src/finance): `packages/shared/src/finance`
- [Shared domain and schemas](https://github.com/keremclp/santiye-defter/blob/main/packages/shared/src/domain.ts): `packages/shared/src/domain.ts`

### Persistence and integrations

- [Company data models](https://github.com/keremclp/santiye-defter/tree/main/apps/api/src/models): `apps/api/src/models`
- [S3-compatible storage](https://github.com/keremclp/santiye-defter/blob/main/apps/api/src/lib/storage.ts): `apps/api/src/lib/storage.ts`

### Other components

- **Company user**
- **MongoDB**
- **S3 / MinIO storage**

## Connections

- Company user → Routes and guards: opens (evidence: `apps/web/src/routes.tsx`)
- Routes and guards → Login pages: routes to (evidence: `apps/web/src/routes.tsx`)
- Routes and guards → Finance workspaces: routes to (evidence: `apps/web/src/routes.tsx`)
- Routes and guards → Agreements and dues: routes to (evidence: `apps/web/src/routes.tsx`)
- Routes and guards → Document uploads: routes to (evidence: `apps/web/src/routes.tsx`)
- Routes and guards → Reports and exports: routes to (evidence: `apps/web/src/routes.tsx`)
- Routes and guards → Owner administration: routes to (evidence: `apps/web/src/routes.tsx`)
- Login pages → API client: requests through
- Finance workspaces → API client: requests through
- Agreements and dues → API client: requests through (evidence: `apps/web/src/features/agreements/AgreementDetailPage.tsx`)
- Document uploads → API client: uploads through (evidence: `apps/web/src/features/documents/useUploadQueue.ts`)
- Reports and exports → API client: requests through
- Owner administration → API client: requests through
- API client → HTTP application: sends HTTP (evidence: `README.md`)
- HTTP application → Customer authentication: registers (evidence: `apps/api/src/app.ts`)
- HTTP application → Company domain API: registers (evidence: `apps/api/src/app.ts`)
- HTTP application → Platform auth and management: registers (evidence: `apps/api/src/app.ts`)
- Company domain API → Customer authentication: uses auth service (evidence: `apps/api/src/app.ts`)
- Customer authentication → Company data models: reads and writes (evidence: `apps/api/src/services/customer-auth.ts`)
- Platform auth and management → Company data models: reads and writes (evidence: `apps/api/src/services/platform-auth.ts`)
- Platform auth and management → Customer authentication: uses customer auth (evidence: `apps/api/src/services/platform-auth.ts`)
- Company domain API → Service access rules: checks access
- Company domain API → Finance calculations: uses calculations
- Company domain API → Shared domain and schemas: uses contracts
- Report generation → S3-compatible storage: stores exports
- Document service → S3-compatible storage: stores documents
- S3-compatible storage → S3 / MinIO storage: accesses (evidence: `apps/api/src/lib/storage.ts`)
- Company data models → MongoDB: persists in
