# thiyo12/maintainex architecture

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

- Interactive diagram: https://gitdiagram.com/thiyo12/maintainex
- Repository: https://github.com/thiyo12/maintainex

## Overview

Maintainex is represented by a much broader marketplace and operations platform than the README’s cleaning-service summary suggests: the tree includes customer/provider mobile apps, job and quote workflows, payments, real estate, and an extensive admin console. A principal supported workflow is provider quote submission: the API authenticates and rate-limits the provider, resolves company context, requests matching and benchmark pricing, persists a quote revision, checks availability, and notifies the customer. Edges reflect explicit README or SOURCE INDEX evidence; several major tree-visible capabilities are included without speculative connections.

Main entry points: [`app/api/quotes/route.ts`](https://github.com/thiyo12/maintainex/blob/main/app/api/quotes/route.ts) (Quote submission), [`lib/finance/payments/payment-service.ts`](https://github.com/thiyo12/maintainex/blob/main/lib/finance/payments/payment-service.ts) (Payment processing), [`lib/finance/escrow/escrow-service.ts`](https://github.com/thiyo12/maintainex/blob/main/lib/finance/escrow/escrow-service.ts) (Escrow service), [`lib/prisma.ts`](https://github.com/thiyo12/maintainex/blob/main/lib/prisma.ts) (Database access)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experiences"]
  node_customer["Customer mobile app"]
  node_provider["Provider mobile app"]
  node_public["Public website"]
  node_realestate["Real-estate listings"]
end

subgraph group_marketplace["Marketplace workflow"]
  node_quoteapi["Quote submission<br/>[route.ts]"]
  node_matching["Provider matching<br/>[index.ts]"]
  node_markets["Market resolution<br/>[market-engine.ts]"]
  node_pricing["Pricing engine<br/>[engine.ts]"]
  node_jobapi["Job lifecycle APIs"]
  node_jobdomain["Job lifecycle rules<br/>[job-lifecycle.ts]"]
end

subgraph group_finance["Financial operations"]
  node_payments["Payment processing<br/>[payment-service.ts]"]
  node_escrow["Escrow service<br/>[escrow-service.ts]"]
  node_ledger["Double-entry ledger<br/>[ledger-service.ts]"]
  node_payouts["Provider payouts<br/>[payout-engine.ts]"]
end

subgraph group_admin["Administration"]
  node_adminui["Admin console"]
  node_disputes["Dispute operations<br/>[route.ts]"]
  node_adminjobs["Admin job operations<br/>[route.ts]"]
  node_crmsecurity["CRM access controls<br/>[security.ts]"]
end

subgraph group_platform["Shared platform"]
  node_store[("Database access<br/>[prisma.ts]")]
  node_notifications["Notifications"]
  node_money["Money primitives<br/>[money.ts]"]
end

node_actor(("Marketplace users"))

node_actor -.->|"uses"| node_customer
node_actor -.->|"uses"| node_provider
node_customer -.->|"submits requests"| node_quoteapi
node_provider -.->|"submits quotes"| node_quoteapi
node_quoteapi -->|"finds candidates"| node_matching
node_quoteapi -->|"resolves benchmark"| node_pricing
node_quoteapi -->|"resolves market"| node_markets
node_matching -->|"requires job market"| node_markets
node_quoteapi -->|"notifies customer"| node_notifications
node_jobapi -->|"uses lifecycle rules"| node_jobdomain
node_payments -->|"posts transactions"| node_ledger
node_payments -->|"resolves market"| node_markets
node_payments -.->|"funds escrow"| node_escrow
node_escrow -->|"posts transactions"| node_ledger
node_escrow -->|"uses payment service"| node_payments
node_payouts -->|"posts transactions"| node_ledger
node_payouts -->|"converts amounts"| node_money
node_disputes -->|"guards requests"| node_crmsecurity
node_disputes -->|"refunds escrow"| node_escrow
node_adminjobs -->|"guards requests"| node_crmsecurity
node_quoteapi -->|"reads and writes"| node_store
node_payments -->|"reads and writes"| node_store
node_escrow -->|"reads and writes"| node_store
node_ledger -->|"persists entries"| node_store
node_disputes -->|"reads disputes"| node_store

click node_customer "https://github.com/thiyo12/maintainex/tree/main/apps/mobile/app/(customer)"
click node_provider "https://github.com/thiyo12/maintainex/tree/main/apps/mobile/app/(tasker)"
click node_public "https://github.com/thiyo12/maintainex/tree/main/app/(public)"
click node_realestate "https://github.com/thiyo12/maintainex/tree/main/app/api/properties"
click node_quoteapi "https://github.com/thiyo12/maintainex/blob/main/app/api/quotes/route.ts"
click node_matching "https://github.com/thiyo12/maintainex/blob/main/lib/matching/index.ts"
click node_markets "https://github.com/thiyo12/maintainex/blob/main/lib/geography/market-engine.ts"
click node_pricing "https://github.com/thiyo12/maintainex/blob/main/lib/pricing/engine.ts"
click node_jobapi "https://github.com/thiyo12/maintainex/tree/main/app/api/mobile/v2/jobs"
click node_jobdomain "https://github.com/thiyo12/maintainex/blob/main/lib/domain/job-lifecycle.ts"
click node_payments "https://github.com/thiyo12/maintainex/blob/main/lib/finance/payments/payment-service.ts"
click node_escrow "https://github.com/thiyo12/maintainex/blob/main/lib/finance/escrow/escrow-service.ts"
click node_ledger "https://github.com/thiyo12/maintainex/blob/main/lib/finance/ledger/ledger-service.ts"
click node_payouts "https://github.com/thiyo12/maintainex/blob/main/lib/finance/payouts/payout-engine.ts"
click node_adminui "https://github.com/thiyo12/maintainex/tree/main/app/(admin)/admin"
click node_disputes "https://github.com/thiyo12/maintainex/blob/main/app/api/admin/disputes/route.ts"
click node_adminjobs "https://github.com/thiyo12/maintainex/blob/main/app/api/admin/jobs/route.ts"
click node_crmsecurity "https://github.com/thiyo12/maintainex/blob/main/lib/crm/security.ts"
click node_store "https://github.com/thiyo12/maintainex/blob/main/lib/prisma.ts"
click node_notifications "https://github.com/thiyo12/maintainex/blob/main/lib/notifications/notification-service.ts"
click node_money "https://github.com/thiyo12/maintainex/blob/main/lib/shared/money/money.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_customer,node_provider,node_public,node_realestate,node_actor toneBlue
class node_quoteapi,node_matching,node_markets,node_pricing,node_jobapi,node_jobdomain toneAmber
class node_payments,node_escrow,node_ledger,node_payouts toneMint
class node_adminui,node_disputes,node_adminjobs,node_crmsecurity toneRose
class node_store,node_notifications,node_money toneIndigo
```

## Components

### User experiences

- [Customer mobile app](https://github.com/thiyo12/maintainex/tree/main/apps/mobile/app/(customer)): `apps/mobile/app/(customer)`
- [Provider mobile app](https://github.com/thiyo12/maintainex/tree/main/apps/mobile/app/(tasker)): `apps/mobile/app/(tasker)`
- [Public website](https://github.com/thiyo12/maintainex/tree/main/app/(public)): `app/(public)`
- [Real-estate listings](https://github.com/thiyo12/maintainex/tree/main/app/api/properties): `app/api/properties`

### Marketplace workflow

- [Quote submission](https://github.com/thiyo12/maintainex/blob/main/app/api/quotes/route.ts): `app/api/quotes/route.ts`
- [Provider matching](https://github.com/thiyo12/maintainex/blob/main/lib/matching/index.ts): `lib/matching/index.ts`
- [Market resolution](https://github.com/thiyo12/maintainex/blob/main/lib/geography/market-engine.ts): `lib/geography/market-engine.ts`
- [Pricing engine](https://github.com/thiyo12/maintainex/blob/main/lib/pricing/engine.ts): `lib/pricing/engine.ts`
- [Job lifecycle APIs](https://github.com/thiyo12/maintainex/tree/main/app/api/mobile/v2/jobs): `app/api/mobile/v2/jobs`
- [Job lifecycle rules](https://github.com/thiyo12/maintainex/blob/main/lib/domain/job-lifecycle.ts): `lib/domain/job-lifecycle.ts`

### Financial operations

- [Payment processing](https://github.com/thiyo12/maintainex/blob/main/lib/finance/payments/payment-service.ts): `lib/finance/payments/payment-service.ts`
- [Escrow service](https://github.com/thiyo12/maintainex/blob/main/lib/finance/escrow/escrow-service.ts): `lib/finance/escrow/escrow-service.ts`
- [Double-entry ledger](https://github.com/thiyo12/maintainex/blob/main/lib/finance/ledger/ledger-service.ts): `lib/finance/ledger/ledger-service.ts`
- [Provider payouts](https://github.com/thiyo12/maintainex/blob/main/lib/finance/payouts/payout-engine.ts): `lib/finance/payouts/payout-engine.ts`

### Administration

- [Admin console](https://github.com/thiyo12/maintainex/tree/main/app/(admin)/admin): `app/(admin)/admin`
- [Dispute operations](https://github.com/thiyo12/maintainex/blob/main/app/api/admin/disputes/route.ts): `app/api/admin/disputes/route.ts`
- [Admin job operations](https://github.com/thiyo12/maintainex/blob/main/app/api/admin/jobs/route.ts): `app/api/admin/jobs/route.ts`
- [CRM access controls](https://github.com/thiyo12/maintainex/blob/main/lib/crm/security.ts): `lib/crm/security.ts`

### Shared platform

- [Database access](https://github.com/thiyo12/maintainex/blob/main/lib/prisma.ts): `lib/prisma.ts`
- [Notifications](https://github.com/thiyo12/maintainex/blob/main/lib/notifications/notification-service.ts): `lib/notifications/notification-service.ts`
- [Money primitives](https://github.com/thiyo12/maintainex/blob/main/lib/shared/money/money.ts): `lib/shared/money/money.ts`

### Other components

- **Marketplace users**

## Connections

- Marketplace users → Customer mobile app: uses
- Marketplace users → Provider mobile app: uses
- Customer mobile app → Quote submission: submits requests
- Provider mobile app → Quote submission: submits quotes
- Quote submission → Provider matching: finds candidates (evidence: `app/api/quotes/route.ts`)
- Quote submission → Pricing engine: resolves benchmark (evidence: `app/api/quotes/route.ts`)
- Quote submission → Market resolution: resolves market (evidence: `app/api/quotes/route.ts`)
- Provider matching → Market resolution: requires job market (evidence: `lib/matching/index.ts`)
- Quote submission → Notifications: notifies customer (evidence: `app/api/quotes/route.ts`)
- Job lifecycle APIs → Job lifecycle rules: uses lifecycle rules
- Payment processing → Double-entry ledger: posts transactions (evidence: `lib/finance/payments/payment-service.ts`)
- Payment processing → Market resolution: resolves market (evidence: `lib/finance/payments/payment-service.ts`)
- Payment processing → Escrow service: funds escrow (evidence: `lib/finance/escrow/escrow-service.ts`)
- Escrow service → Double-entry ledger: posts transactions (evidence: `lib/finance/escrow/escrow-service.ts`)
- Escrow service → Payment processing: uses payment service (evidence: `lib/finance/escrow/escrow-service.ts`)
- Provider payouts → Double-entry ledger: posts transactions (evidence: `lib/finance/payouts/payout-engine.ts`)
- Provider payouts → Money primitives: converts amounts (evidence: `lib/finance/payouts/payout-engine.ts`)
- Dispute operations → CRM access controls: guards requests (evidence: `app/api/admin/disputes/route.ts`)
- Dispute operations → Escrow service: refunds escrow (evidence: `app/api/admin/disputes/route.ts`)
- Admin job operations → CRM access controls: guards requests (evidence: `lib/crm/security.ts`)
- Quote submission → Database access: reads and writes (evidence: `app/api/quotes/route.ts`)
- Payment processing → Database access: reads and writes (evidence: `lib/finance/payments/payment-service.ts`)
- Escrow service → Database access: reads and writes (evidence: `lib/finance/escrow/escrow-service.ts`)
- Double-entry ledger → Database access: persists entries (evidence: `lib/finance/ledger/ledger-service.ts`)
- Dispute operations → Database access: reads disputes (evidence: `app/api/admin/disputes/route.ts`)
