# syl-rutvik/ai-testcase architecture

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

- Interactive diagram: https://gitdiagram.com/syl-rutvik/ai-testcase
- Repository: https://github.com/syl-rutvik/ai-testcase

## Overview

This is a web-based QA suite that turns natural-language requirements into structured positive, negative, and boundary test cases, then supports review, export, and saved history. Users enter through the React application; generation requests reach the Express API and test-case controller, which uses Gemini when configured and an NLP fallback, while authentication, plans, administration, and history are separate domain capabilities. The repository documents hybrid SQLite/MongoDB persistence. Some frontend and backend modules are unsampled, so their documented capabilities are shown without speculative internal call chains.

Main entry points: [`frontend/src/App.jsx`](https://github.com/syl-rutvik/ai-testcase/blob/master/frontend/src/App.jsx) (Application shell), [`backend/routes/testCaseRoutes.js`](https://github.com/syl-rutvik/ai-testcase/blob/master/backend/routes/testCaseRoutes.js) (API routes), [`backend/db/dbService.js`](https://github.com/syl-rutvik/ai-testcase/blob/master/backend/db/dbService.js) (Database adapter), [`backend/controllers/testCaseController.js`](https://github.com/syl-rutvik/ai-testcase/blob/master/backend/controllers/testCaseController.js) (Test synthesis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["React client"]
  node_app["Application shell<br/>[App.jsx]"]
  node_generator_ui["Requirement entry<br/>[GeneratorPage.jsx]"]
  node_dashboard["QA dashboard<br/>[DashboardPage.jsx]"]
  node_case_table["Test case review<br/>[TestCaseTable.jsx]"]
  node_exports["Export tools<br/>[ExportToolbar.jsx]"]
  node_traceability["Traceability matrix"]
  node_pricing["Plan selection<br/>[PricingModal.jsx]"]
  node_admin_ui["Admin portal"]
  node_history_ui["Suite history<br/>[HistoryPage.jsx]"]
  node_api_config["API endpoint config<br/>[apiConfig.js]"]
end

subgraph group_api["API and domains"]
  node_api_server["Express API<br/>[server.js]"]
  node_routes["API routes<br/>[testCaseRoutes.js]"]
  node_auth_gate["JWT and RBAC<br/>[authMiddleware.js]"]
  node_auth_domain["Authentication<br/>[authController.js]"]
  node_plans_domain["Plans and credits<br/>[plansController.js]"]
  node_admin_domain["User governance<br/>[adminController.js]"]
  node_history_domain["History archive"]
  node_presets_domain["Requirement presets"]
end

subgraph group_generation["Test synthesis"]
  node_generator["Test synthesis"]
  node_gemini["Google Gemini"]
  node_nlp_fallback["NLP fallback engine"]
end

subgraph group_persistence["Hybrid persistence"]
  node_db_service["Database adapter<br/>[dbService.js]"]
  node_sqlite[("SQLite store<br/>[database.js]")]
  node_mongo[("MongoDB Atlas<br/>[mongo.js]")]
end

node_qa_user(("QA user"))

node_qa_user -->|"uses"| node_app
node_app -->|"renders"| node_generator_ui
node_app -->|"renders"| node_dashboard
node_app -->|"renders"| node_case_table
node_app -->|"renders"| node_exports
node_exports -->|"opens"| node_traceability
node_app -->|"renders"| node_admin_ui
node_app -->|"renders"| node_history_ui
node_app -->|"uses endpoint"| node_api_config
node_app -->|"posts generation"| node_api_server
node_pricing -->|"uses endpoint"| node_api_config
node_api_server -->|"mounts"| node_routes
node_routes -->|"routes generation"| node_generator
node_routes -->|"guards routes"| node_auth_gate
node_routes -->|"routes auth"| node_auth_domain
node_routes -->|"routes plans"| node_plans_domain
node_routes -->|"routes admin"| node_admin_domain
node_routes -->|"routes history"| node_history_domain
node_routes -->|"routes presets"| node_presets_domain
node_generator -.->|"generates with"| node_gemini
node_generator -.->|"falls back to"| node_nlp_fallback
node_auth_domain -->|"reads and writes"| node_db_service
node_plans_domain -->|"uses"| node_db_service
node_admin_domain -->|"uses"| node_db_service
node_history_domain -->|"uses"| node_db_service
node_presets_domain -->|"uses"| node_db_service
node_generator -->|"checks quotas"| node_db_service
node_db_service -->|"routes offline"| node_sqlite
node_db_service -->|"routes cloud"| node_mongo

click node_app "https://github.com/syl-rutvik/ai-testcase/blob/master/frontend/src/App.jsx"
click node_generator_ui "https://github.com/syl-rutvik/ai-testcase/blob/master/frontend/src/components/GeneratorPage.jsx"
click node_dashboard "https://github.com/syl-rutvik/ai-testcase/blob/master/frontend/src/pages/DashboardPage.jsx"
click node_case_table "https://github.com/syl-rutvik/ai-testcase/blob/master/frontend/src/components/TestCaseTable.jsx"
click node_exports "https://github.com/syl-rutvik/ai-testcase/blob/master/frontend/src/components/ExportToolbar.jsx"
click node_traceability "https://github.com/syl-rutvik/ai-testcase/blob/master/frontend/src/components/TraceabilityMatrixModal.jsx"
click node_pricing "https://github.com/syl-rutvik/ai-testcase/blob/master/frontend/src/components/PricingModal.jsx"
click node_admin_ui "https://github.com/syl-rutvik/ai-testcase/blob/master/frontend/src/pages/AdminPortalPage.jsx"
click node_history_ui "https://github.com/syl-rutvik/ai-testcase/blob/master/frontend/src/pages/HistoryPage.jsx"
click node_api_config "https://github.com/syl-rutvik/ai-testcase/blob/master/frontend/src/config/apiConfig.js"
click node_api_server "https://github.com/syl-rutvik/ai-testcase/blob/master/backend/server.js"
click node_routes "https://github.com/syl-rutvik/ai-testcase/blob/master/backend/routes/testCaseRoutes.js"
click node_auth_gate "https://github.com/syl-rutvik/ai-testcase/blob/master/backend/middleware/authMiddleware.js"
click node_auth_domain "https://github.com/syl-rutvik/ai-testcase/blob/master/backend/controllers/authController.js"
click node_plans_domain "https://github.com/syl-rutvik/ai-testcase/blob/master/backend/controllers/plansController.js"
click node_admin_domain "https://github.com/syl-rutvik/ai-testcase/blob/master/backend/controllers/adminController.js"
click node_history_domain "https://github.com/syl-rutvik/ai-testcase/blob/master/backend/controllers/historyController.js"
click node_presets_domain "https://github.com/syl-rutvik/ai-testcase/blob/master/backend/controllers/presetsController.js"
click node_generator "https://github.com/syl-rutvik/ai-testcase/blob/master/backend/controllers/testCaseController.js"
click node_nlp_fallback "https://github.com/syl-rutvik/ai-testcase/blob/master/backend/controllers/testCaseController.js"
click node_db_service "https://github.com/syl-rutvik/ai-testcase/blob/master/backend/db/dbService.js"
click node_sqlite "https://github.com/syl-rutvik/ai-testcase/blob/master/backend/db/database.js"
click node_mongo "https://github.com/syl-rutvik/ai-testcase/blob/master/backend/db/mongo.js"

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_generator_ui,node_dashboard,node_case_table,node_exports,node_traceability,node_pricing,node_admin_ui,node_history_ui,node_api_config,node_qa_user toneBlue
class node_api_server,node_routes,node_auth_gate,node_auth_domain,node_plans_domain,node_admin_domain,node_history_domain,node_presets_domain toneAmber
class node_generator,node_gemini,node_nlp_fallback toneMint
class node_db_service,node_sqlite,node_mongo toneRose
```

## Components

### React client

- [Application shell](https://github.com/syl-rutvik/ai-testcase/blob/master/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Requirement entry](https://github.com/syl-rutvik/ai-testcase/blob/master/frontend/src/components/GeneratorPage.jsx): `frontend/src/components/GeneratorPage.jsx`
- [QA dashboard](https://github.com/syl-rutvik/ai-testcase/blob/master/frontend/src/pages/DashboardPage.jsx): `frontend/src/pages/DashboardPage.jsx`
- [Test case review](https://github.com/syl-rutvik/ai-testcase/blob/master/frontend/src/components/TestCaseTable.jsx): `frontend/src/components/TestCaseTable.jsx`
- [Export tools](https://github.com/syl-rutvik/ai-testcase/blob/master/frontend/src/components/ExportToolbar.jsx): `frontend/src/components/ExportToolbar.jsx`
- [Traceability matrix](https://github.com/syl-rutvik/ai-testcase/blob/master/frontend/src/components/TraceabilityMatrixModal.jsx): `frontend/src/components/TraceabilityMatrixModal.jsx`
- [Plan selection](https://github.com/syl-rutvik/ai-testcase/blob/master/frontend/src/components/PricingModal.jsx): `frontend/src/components/PricingModal.jsx`
- [Admin portal](https://github.com/syl-rutvik/ai-testcase/blob/master/frontend/src/pages/AdminPortalPage.jsx): `frontend/src/pages/AdminPortalPage.jsx`
- [Suite history](https://github.com/syl-rutvik/ai-testcase/blob/master/frontend/src/pages/HistoryPage.jsx): `frontend/src/pages/HistoryPage.jsx`
- [API endpoint config](https://github.com/syl-rutvik/ai-testcase/blob/master/frontend/src/config/apiConfig.js): `frontend/src/config/apiConfig.js`

### API and domains

- [Express API](https://github.com/syl-rutvik/ai-testcase/blob/master/backend/server.js): `backend/server.js`
- [API routes](https://github.com/syl-rutvik/ai-testcase/blob/master/backend/routes/testCaseRoutes.js): `backend/routes/testCaseRoutes.js`
- [JWT and RBAC](https://github.com/syl-rutvik/ai-testcase/blob/master/backend/middleware/authMiddleware.js): `backend/middleware/authMiddleware.js`
- [Authentication](https://github.com/syl-rutvik/ai-testcase/blob/master/backend/controllers/authController.js): `backend/controllers/authController.js`
- [Plans and credits](https://github.com/syl-rutvik/ai-testcase/blob/master/backend/controllers/plansController.js): `backend/controllers/plansController.js`
- [User governance](https://github.com/syl-rutvik/ai-testcase/blob/master/backend/controllers/adminController.js): `backend/controllers/adminController.js`
- [History archive](https://github.com/syl-rutvik/ai-testcase/blob/master/backend/controllers/historyController.js): `backend/controllers/historyController.js`
- [Requirement presets](https://github.com/syl-rutvik/ai-testcase/blob/master/backend/controllers/presetsController.js): `backend/controllers/presetsController.js`

### Test synthesis

- [Test synthesis](https://github.com/syl-rutvik/ai-testcase/blob/master/backend/controllers/testCaseController.js): `backend/controllers/testCaseController.js`
- **Google Gemini**
- [NLP fallback engine](https://github.com/syl-rutvik/ai-testcase/blob/master/backend/controllers/testCaseController.js): `backend/controllers/testCaseController.js`

### Hybrid persistence

- [Database adapter](https://github.com/syl-rutvik/ai-testcase/blob/master/backend/db/dbService.js): `backend/db/dbService.js`
- [SQLite store](https://github.com/syl-rutvik/ai-testcase/blob/master/backend/db/database.js): `backend/db/database.js`
- [MongoDB Atlas](https://github.com/syl-rutvik/ai-testcase/blob/master/backend/db/mongo.js): `backend/db/mongo.js`

### Other components

- **QA user**

## Connections

- QA user → Application shell: uses (evidence: `frontend/src/App.jsx`)
- Application shell → Requirement entry: renders (evidence: `frontend/src/App.jsx`)
- Application shell → QA dashboard: renders (evidence: `frontend/src/App.jsx`)
- Application shell → Test case review: renders (evidence: `frontend/src/App.jsx`)
- Application shell → Export tools: renders (evidence: `frontend/src/App.jsx`)
- Export tools → Traceability matrix: opens (evidence: `frontend/src/components/ExportToolbar.jsx`)
- Application shell → Admin portal: renders (evidence: `frontend/src/App.jsx`)
- Application shell → Suite history: renders (evidence: `frontend/src/App.jsx`)
- Application shell → API endpoint config: uses endpoint (evidence: `frontend/src/App.jsx`)
- Application shell → Express API: posts generation (evidence: `frontend/src/App.jsx`)
- Plan selection → API endpoint config: uses endpoint (evidence: `frontend/src/components/PricingModal.jsx`)
- Express API → API routes: mounts (evidence: `backend/server.js`)
- API routes → Test synthesis: routes generation (evidence: `backend/routes/testCaseRoutes.js`)
- API routes → JWT and RBAC: guards routes (evidence: `backend/routes/testCaseRoutes.js`)
- API routes → Authentication: routes auth (evidence: `backend/routes/testCaseRoutes.js`)
- API routes → Plans and credits: routes plans (evidence: `backend/routes/testCaseRoutes.js`)
- API routes → User governance: routes admin (evidence: `backend/routes/testCaseRoutes.js`)
- API routes → History archive: routes history (evidence: `backend/routes/testCaseRoutes.js`)
- API routes → Requirement presets: routes presets (evidence: `backend/routes/testCaseRoutes.js`)
- Test synthesis → Google Gemini: generates with (evidence: `README.md`)
- Test synthesis → NLP fallback engine: falls back to (evidence: `README.md`)
- Authentication → Database adapter: reads and writes (evidence: `backend/controllers/authController.js`)
- Plans and credits → Database adapter: uses (evidence: `backend/controllers/plansController.js`)
- User governance → Database adapter: uses (evidence: `backend/controllers/adminController.js`)
- History archive → Database adapter: uses (evidence: `backend/controllers/historyController.js`)
- Requirement presets → Database adapter: uses (evidence: `backend/controllers/presetsController.js`)
- Test synthesis → Database adapter: checks quotas (evidence: `backend/controllers/testCaseController.js`)
- Database adapter → SQLite store: routes offline (evidence: `backend/db/dbService.js`)
- Database adapter → MongoDB Atlas: routes cloud (evidence: `backend/db/dbService.js`)
