# viscalyx/kravhantering architecture

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

- Interactive diagram: https://gitdiagram.com/viscalyx/kravhantering
- Repository: https://github.com/viscalyx/kravhantering

## Overview

This is a bilingual requirements-management web application. Its main workflow takes requirements from registration and classification through editing, review, approval, versioning, and eventual phase-out; published requirements can also be searched, used in specifications, exported, and tracked through deviations and suggestions. The graph preserves those documented stages and major capabilities, plus AI-assisted authoring, MCP access, administration, and reporting. Workflow relationships are based on the README; source paths identify implementations, but unsampled code is not treated as inspected.

Main entry points: [`app/[locale]/requirements/[id]/page.tsx`](https://github.com/viscalyx/kravhantering/blob/main/app/%5Blocale%5D/requirements/%5Bid%5D/page.tsx) (Approve and publish), [`app/[locale]/requirements/[id]/edit/edit-requirement-client.tsx`](https://github.com/viscalyx/kravhantering/blob/main/app/%5Blocale%5D/requirements/%5Bid%5D/edit/edit-requirement-client.tsx) (Edit requirements), [`app/[locale]/requirements/[id]/_detail/version-state.ts`](https://github.com/viscalyx/kravhantering/blob/main/app/%5Blocale%5D/requirements/%5Bid%5D/_detail/version-state.ts) (Version history), [`lib/reports/data/server.ts`](https://github.com/viscalyx/kravhantering/blob/main/lib/reports/data/server.ts) (Reports)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_lifecycle["Requirement lifecycle"]
  node_register["Register requirements"]
  node_classify["Classify requirements"]
  node_edit["Edit requirements"]
  node_review["Review requirements<br/>[page.tsx]"]
  node_publish["Approve and publish<br/>[page.tsx]"]
  node_version["Version history<br/>[version-state.ts]"]
  node_phaseout["Phase out<br/>[page.tsx]"]
  node_search["Search and filter"]
  node_export["Requirement exports<br/>[route.ts]"]
  node_deviations["Manage deviations"]
  node_suggestions["Improvement suggestions"]
end

subgraph group_specification["Specifications and stewardship"]
  node_usage["Track usage"]
  node_specifications["Requirements specifications"]
  node_stewardship["Requirement stewardship"]
end

subgraph group_capabilities["Authoring and reporting"]
  node_ai["AI-assisted authoring<br/>[route.ts]"]
  node_reports["Reports<br/>[server.ts]"]
  node_mcp["MCP server<br/>[server.ts]"]
end

subgraph group_platform["Application services"]
  node_admin["Administration"]
  node_database[("SQL Server database<br/>[db.ts]")]
end

node_user(("User"))

node_user -->|"registers"| node_register
node_register -->|"classifies"| node_classify
node_classify -->|"edits"| node_edit
node_edit -->|"submits for review"| node_review
node_review -->|"returns for changes"| node_edit
node_review -->|"approves"| node_publish
node_publish -->|"tracks versions"| node_version
node_version -->|"starts new version"| node_edit
node_version -->|"phases out"| node_phaseout
node_publish -->|"makes searchable"| node_search
node_search -->|"exports results"| node_export
node_publish -->|"tracks application"| node_usage
node_publish -->|"links deviations"| node_deviations
node_publish -->|"collects feedback"| node_suggestions
node_usage -->|"reports usage"| node_reports
node_deviations -->|"reports deviations"| node_reports
node_suggestions -->|"reports feedback"| node_reports
node_user -->|"provides input"| node_ai
node_ai -->|"proposes candidates"| node_user
node_user -->|"manages specifications"| node_specifications
node_user -.->|"manages requirements"| node_stewardship

click node_register "https://github.com/viscalyx/kravhantering/blob/main/app/%5Blocale%5D/requirements/new/new-requirement-client.tsx"
click node_classify "https://github.com/viscalyx/kravhantering/blob/main/app/%5Blocale%5D/requirements/%5Bid%5D/edit/edit-requirement-client.tsx"
click node_edit "https://github.com/viscalyx/kravhantering/blob/main/app/%5Blocale%5D/requirements/%5Bid%5D/edit/edit-requirement-client.tsx"
click node_review "https://github.com/viscalyx/kravhantering/blob/main/app/%5Blocale%5D/requirements/%5Bid%5D/page.tsx"
click node_publish "https://github.com/viscalyx/kravhantering/blob/main/app/%5Blocale%5D/requirements/%5Bid%5D/page.tsx"
click node_version "https://github.com/viscalyx/kravhantering/blob/main/app/%5Blocale%5D/requirements/%5Bid%5D/_detail/version-state.ts"
click node_phaseout "https://github.com/viscalyx/kravhantering/blob/main/app/%5Blocale%5D/requirements/%5Bid%5D/page.tsx"
click node_search "https://github.com/viscalyx/kravhantering/blob/main/app/%5Blocale%5D/requirements/requirements-client.tsx"
click node_export "https://github.com/viscalyx/kravhantering/blob/main/app/%5Blocale%5D/requirements/reports/pdf/list/route.ts"
click node_usage "https://github.com/viscalyx/kravhantering/blob/main/app/%5Blocale%5D/specifications/%5BspecificationId%5D/requirements-specification-detail-client.tsx"
click node_deviations "https://github.com/viscalyx/kravhantering/blob/main/app/%5Blocale%5D/requirements/%5Bid%5D/_detail/use-deviation-workflow.ts"
click node_suggestions "https://github.com/viscalyx/kravhantering/blob/main/app/%5Blocale%5D/requirements/%5Bid%5D/_detail/use-suggestion-workflow.ts"
click node_specifications "https://github.com/viscalyx/kravhantering/blob/main/app/%5Blocale%5D/specifications/%5BspecificationId%5D/specification-editor-workflow.ts"
click node_stewardship "https://github.com/viscalyx/kravhantering/blob/main/app/%5Blocale%5D/requirements/stewardship/stewardship-workspace-page.tsx"
click node_ai "https://github.com/viscalyx/kravhantering/blob/main/app/api/ai/generate-requirement-import/route.ts"
click node_reports "https://github.com/viscalyx/kravhantering/blob/main/lib/reports/data/server.ts"
click node_mcp "https://github.com/viscalyx/kravhantering/blob/main/lib/mcp/server.ts"
click node_admin "https://github.com/viscalyx/kravhantering/blob/main/app/%5Blocale%5D/admin/admin-workspace-page.tsx"
click node_database "https://github.com/viscalyx/kravhantering/blob/main/lib/db.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_register,node_classify,node_edit,node_review,node_publish,node_version,node_phaseout,node_search,node_export,node_deviations,node_suggestions,node_user toneBlue
class node_usage,node_specifications,node_stewardship toneAmber
class node_ai,node_reports,node_mcp toneMint
class node_admin,node_database toneRose
```

## Components

### Requirement lifecycle

- [Register requirements](https://github.com/viscalyx/kravhantering/blob/main/app/%5Blocale%5D/requirements/new/new-requirement-client.tsx): `app/[locale]/requirements/new/new-requirement-client.tsx`
- [Classify requirements](https://github.com/viscalyx/kravhantering/blob/main/app/%5Blocale%5D/requirements/%5Bid%5D/edit/edit-requirement-client.tsx): `app/[locale]/requirements/[id]/edit/edit-requirement-client.tsx`
- [Edit requirements](https://github.com/viscalyx/kravhantering/blob/main/app/%5Blocale%5D/requirements/%5Bid%5D/edit/edit-requirement-client.tsx): `app/[locale]/requirements/[id]/edit/edit-requirement-client.tsx`
- [Review requirements](https://github.com/viscalyx/kravhantering/blob/main/app/%5Blocale%5D/requirements/%5Bid%5D/page.tsx): `app/[locale]/requirements/[id]/page.tsx`
- [Approve and publish](https://github.com/viscalyx/kravhantering/blob/main/app/%5Blocale%5D/requirements/%5Bid%5D/page.tsx): `app/[locale]/requirements/[id]/page.tsx`
- [Version history](https://github.com/viscalyx/kravhantering/blob/main/app/%5Blocale%5D/requirements/%5Bid%5D/_detail/version-state.ts): `app/[locale]/requirements/[id]/_detail/version-state.ts`
- [Phase out](https://github.com/viscalyx/kravhantering/blob/main/app/%5Blocale%5D/requirements/%5Bid%5D/page.tsx): `app/[locale]/requirements/[id]/page.tsx`
- [Search and filter](https://github.com/viscalyx/kravhantering/blob/main/app/%5Blocale%5D/requirements/requirements-client.tsx): `app/[locale]/requirements/requirements-client.tsx`
- [Requirement exports](https://github.com/viscalyx/kravhantering/blob/main/app/%5Blocale%5D/requirements/reports/pdf/list/route.ts): `app/[locale]/requirements/reports/pdf/list/route.ts`
- [Manage deviations](https://github.com/viscalyx/kravhantering/blob/main/app/%5Blocale%5D/requirements/%5Bid%5D/_detail/use-deviation-workflow.ts): `app/[locale]/requirements/[id]/_detail/use-deviation-workflow.ts`
- [Improvement suggestions](https://github.com/viscalyx/kravhantering/blob/main/app/%5Blocale%5D/requirements/%5Bid%5D/_detail/use-suggestion-workflow.ts): `app/[locale]/requirements/[id]/_detail/use-suggestion-workflow.ts`

### Specifications and stewardship

- [Track usage](https://github.com/viscalyx/kravhantering/blob/main/app/%5Blocale%5D/specifications/%5BspecificationId%5D/requirements-specification-detail-client.tsx): `app/[locale]/specifications/[specificationId]/requirements-specification-detail-client.tsx`
- [Requirements specifications](https://github.com/viscalyx/kravhantering/blob/main/app/%5Blocale%5D/specifications/%5BspecificationId%5D/specification-editor-workflow.ts): `app/[locale]/specifications/[specificationId]/specification-editor-workflow.ts`
- [Requirement stewardship](https://github.com/viscalyx/kravhantering/blob/main/app/%5Blocale%5D/requirements/stewardship/stewardship-workspace-page.tsx): `app/[locale]/requirements/stewardship/stewardship-workspace-page.tsx`

### Authoring and reporting

- [AI-assisted authoring](https://github.com/viscalyx/kravhantering/blob/main/app/api/ai/generate-requirement-import/route.ts): `app/api/ai/generate-requirement-import/route.ts`
- [Reports](https://github.com/viscalyx/kravhantering/blob/main/lib/reports/data/server.ts): `lib/reports/data/server.ts`
- [MCP server](https://github.com/viscalyx/kravhantering/blob/main/lib/mcp/server.ts): `lib/mcp/server.ts`

### Application services

- [Administration](https://github.com/viscalyx/kravhantering/blob/main/app/%5Blocale%5D/admin/admin-workspace-page.tsx): `app/[locale]/admin/admin-workspace-page.tsx`
- [SQL Server database](https://github.com/viscalyx/kravhantering/blob/main/lib/db.ts): `lib/db.ts`

### Other components

- **User**

## Connections

- User → Register requirements: registers
- Register requirements → Classify requirements: classifies
- Classify requirements → Edit requirements: edits
- Edit requirements → Review requirements: submits for review
- Review requirements → Edit requirements: returns for changes
- Review requirements → Approve and publish: approves
- Approve and publish → Version history: tracks versions
- Version history → Edit requirements: starts new version
- Version history → Phase out: phases out
- Approve and publish → Search and filter: makes searchable
- Search and filter → Requirement exports: exports results
- Approve and publish → Track usage: tracks application
- Approve and publish → Manage deviations: links deviations
- Approve and publish → Improvement suggestions: collects feedback
- Track usage → Reports: reports usage
- Manage deviations → Reports: reports deviations
- Improvement suggestions → Reports: reports feedback
- User → AI-assisted authoring: provides input
- AI-assisted authoring → User: proposes candidates
- User → Requirements specifications: manages specifications
- User → Requirement stewardship: manages requirements
