# rohan28107/schemagit architecture

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

- Interactive diagram: https://gitdiagram.com/rohan28107/schemagit
- Repository: https://github.com/rohan28107/schemagit

## Overview

SchemaGit versions database schemas through a user-facing workflow: import a SQL schema, branch and commit changes, compare branches, merge (resolving conflicts when needed), then apply the selected schema to a live MySQL/TiDB database. The server parses SQL, models and diffs structured snapshots, plans migrations, and executes and verifies changes; Prisma-backed metadata tracks project history. The README also describes online schema change for risky operations. Some subsystems are documented but not fully sampled, so their internal links are omitted where source evidence is unavailable.

Main entry points: [`client/src/App.jsx`](https://github.com/rohan28107/schemagit/blob/main/client/src/App.jsx) (App workflow), [`server/src/routes/projectRoutes.js`](https://github.com/rohan28107/schemagit/blob/main/server/src/routes/projectRoutes.js) (Project routes), [`server/src/engine/schemaEngine.js`](https://github.com/rohan28107/schemagit/blob/main/server/src/engine/schemaEngine.js) (Schema engine), [`client/src/api/projectApi.js`](https://github.com/rohan28107/schemagit/blob/main/client/src/api/projectApi.js) (Project API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["SchemaGit UI"]
  node_app["App workflow<br/>[App.jsx]"]
  node_initializer["Project import"]
  node_branches["Branch manager<br/>[BranchManager.jsx]"]
  node_commitform["Commit form<br/>[CommitForm.jsx]"]
  node_schemaexplorer["Schema explorer<br/>[SchemaExplorer.jsx]"]
  node_diffresults["Diff results<br/>[DiffResults.jsx]"]
  node_conflictui["Conflict resolver"]
  node_mergerequest["Merge request<br/>[MergeRequest.jsx]"]
  node_statusbanner["Status banner"]
end

subgraph group_api["API and Workflow"]
  node_api["Project API client<br/>[projectApi.js]"]
  node_routes["Project routes<br/>[projectRoutes.js]"]
end

subgraph group_schema["Schema Processing"]
  node_parser["SQL parser<br/>[sqlParser.js]"]
  node_schemaengine["Schema engine<br/>[schemaEngine.js]"]
  node_conflicts["Conflict service<br/>[ConflictService.js]"]
  node_execution["Execution engine<br/>[executionEngine.js]"]
end

subgraph group_persistence["Persistence and Database"]
  node_connections["Connection manager"]
  node_metadata[("Schema history<br/>[schema.prisma]")]
end

node_engineer(("Engineer"))
node_live_db[("MySQL / TiDB")]

node_engineer -->|"uses"| node_app
node_app -->|"renders"| node_initializer
node_app -->|"renders"| node_branches
node_app -->|"renders"| node_commitform
node_app -->|"renders"| node_schemaexplorer
node_app -->|"renders"| node_diffresults
node_app -->|"renders"| node_conflictui
node_app -->|"renders"| node_mergerequest
node_app -->|"renders"| node_statusbanner
node_app -->|"calls"| node_api
node_api -->|"sends REST requests"| node_routes
node_routes -->|"reads and writes"| node_metadata
node_routes -->|"parses imports"| node_parser
node_routes -->|"diffs and plans"| node_schemaengine
node_routes -->|"detects conflicts"| node_conflicts
node_routes -->|"opens connections"| node_connections
node_routes -->|"executes plans"| node_execution
node_connections -->|"connects"| node_live_db
node_schemaengine -->|"inspects schema"| node_live_db
node_execution -->|"applies DDL"| node_live_db
node_conflicts -->|"uses schema logic"| node_schemaengine

click node_app "https://github.com/rohan28107/schemagit/blob/main/client/src/App.jsx"
click node_initializer "https://github.com/rohan28107/schemagit/blob/main/client/src/components/ProjectInitializer.jsx"
click node_branches "https://github.com/rohan28107/schemagit/blob/main/client/src/components/BranchManager.jsx"
click node_commitform "https://github.com/rohan28107/schemagit/blob/main/client/src/components/CommitForm.jsx"
click node_schemaexplorer "https://github.com/rohan28107/schemagit/blob/main/client/src/components/SchemaExplorer.jsx"
click node_diffresults "https://github.com/rohan28107/schemagit/blob/main/client/src/components/DiffResults.jsx"
click node_conflictui "https://github.com/rohan28107/schemagit/blob/main/client/src/components/ConflictResolver.jsx"
click node_mergerequest "https://github.com/rohan28107/schemagit/blob/main/client/src/components/MergeRequest.jsx"
click node_statusbanner "https://github.com/rohan28107/schemagit/blob/main/client/src/components/ProjectStatusBanner.jsx"
click node_api "https://github.com/rohan28107/schemagit/blob/main/client/src/api/projectApi.js"
click node_routes "https://github.com/rohan28107/schemagit/blob/main/server/src/routes/projectRoutes.js"
click node_parser "https://github.com/rohan28107/schemagit/blob/main/server/src/engine/sqlParser.js"
click node_schemaengine "https://github.com/rohan28107/schemagit/blob/main/server/src/engine/schemaEngine.js"
click node_conflicts "https://github.com/rohan28107/schemagit/blob/main/server/src/services/ConflictService.js"
click node_execution "https://github.com/rohan28107/schemagit/blob/main/server/src/engine/executionEngine.js"
click node_connections "https://github.com/rohan28107/schemagit/blob/main/server/src/utils/connectionManager.js"
click node_metadata "https://github.com/rohan28107/schemagit/blob/main/server/prisma/schema.prisma"

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_initializer,node_branches,node_commitform,node_schemaexplorer,node_diffresults,node_conflictui,node_mergerequest,node_statusbanner toneBlue
class node_api,node_routes,node_live_db toneAmber
class node_parser,node_schemaengine,node_conflicts,node_execution toneMint
class node_connections,node_metadata toneRose
class node_engineer toneIndigo
```

## Components

### SchemaGit UI

- [App workflow](https://github.com/rohan28107/schemagit/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Project import](https://github.com/rohan28107/schemagit/blob/main/client/src/components/ProjectInitializer.jsx): `client/src/components/ProjectInitializer.jsx`
- [Branch manager](https://github.com/rohan28107/schemagit/blob/main/client/src/components/BranchManager.jsx): `client/src/components/BranchManager.jsx`
- [Commit form](https://github.com/rohan28107/schemagit/blob/main/client/src/components/CommitForm.jsx): `client/src/components/CommitForm.jsx`
- [Schema explorer](https://github.com/rohan28107/schemagit/blob/main/client/src/components/SchemaExplorer.jsx): `client/src/components/SchemaExplorer.jsx`
- [Diff results](https://github.com/rohan28107/schemagit/blob/main/client/src/components/DiffResults.jsx): `client/src/components/DiffResults.jsx`
- [Conflict resolver](https://github.com/rohan28107/schemagit/blob/main/client/src/components/ConflictResolver.jsx): `client/src/components/ConflictResolver.jsx`
- [Merge request](https://github.com/rohan28107/schemagit/blob/main/client/src/components/MergeRequest.jsx): `client/src/components/MergeRequest.jsx`
- [Status banner](https://github.com/rohan28107/schemagit/blob/main/client/src/components/ProjectStatusBanner.jsx): `client/src/components/ProjectStatusBanner.jsx`

### API and Workflow

- [Project API client](https://github.com/rohan28107/schemagit/blob/main/client/src/api/projectApi.js): `client/src/api/projectApi.js`
- [Project routes](https://github.com/rohan28107/schemagit/blob/main/server/src/routes/projectRoutes.js): `server/src/routes/projectRoutes.js`

### Schema Processing

- [SQL parser](https://github.com/rohan28107/schemagit/blob/main/server/src/engine/sqlParser.js): `server/src/engine/sqlParser.js`
- [Schema engine](https://github.com/rohan28107/schemagit/blob/main/server/src/engine/schemaEngine.js): `server/src/engine/schemaEngine.js`
- [Conflict service](https://github.com/rohan28107/schemagit/blob/main/server/src/services/ConflictService.js): `server/src/services/ConflictService.js`
- [Execution engine](https://github.com/rohan28107/schemagit/blob/main/server/src/engine/executionEngine.js): `server/src/engine/executionEngine.js`

### Persistence and Database

- [Connection manager](https://github.com/rohan28107/schemagit/blob/main/server/src/utils/connectionManager.js): `server/src/utils/connectionManager.js`
- [Schema history](https://github.com/rohan28107/schemagit/blob/main/server/prisma/schema.prisma): `server/prisma/schema.prisma`

### Other components

- **Engineer**
- **MySQL / TiDB**

## Connections

- Engineer → App workflow: uses (evidence: `README.md`)
- App workflow → Project import: renders (evidence: `client/src/App.jsx`)
- App workflow → Branch manager: renders (evidence: `client/src/App.jsx`)
- App workflow → Commit form: renders (evidence: `client/src/App.jsx`)
- App workflow → Schema explorer: renders (evidence: `client/src/App.jsx`)
- App workflow → Diff results: renders (evidence: `client/src/App.jsx`)
- App workflow → Conflict resolver: renders (evidence: `client/src/App.jsx`)
- App workflow → Merge request: renders (evidence: `client/src/App.jsx`)
- App workflow → Status banner: renders (evidence: `client/src/App.jsx`)
- App workflow → Project API client: calls (evidence: `client/src/App.jsx`)
- Project API client → Project routes: sends REST requests (evidence: `client/src/api/projectApi.js`)
- Project routes → Schema history: reads and writes (evidence: `server/src/routes/projectRoutes.js`)
- Project routes → SQL parser: parses imports (evidence: `server/src/routes/projectRoutes.js`)
- Project routes → Schema engine: diffs and plans (evidence: `server/src/routes/projectRoutes.js`)
- Project routes → Conflict service: detects conflicts (evidence: `server/src/routes/projectRoutes.js`)
- Project routes → Connection manager: opens connections (evidence: `server/src/routes/projectRoutes.js`)
- Project routes → Execution engine: executes plans (evidence: `README.md`)
- Connection manager → MySQL / TiDB: connects (evidence: `server/src/utils/connectionManager.js`)
- Schema engine → MySQL / TiDB: inspects schema (evidence: `README.md`)
- Execution engine → MySQL / TiDB: applies DDL (evidence: `README.md`)
- Conflict service → Schema engine: uses schema logic (evidence: `server/src/services/ConflictService.js`)
