# thilomoi05/prosjekt_host_1 architecture

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

- Interactive diagram: https://gitdiagram.com/thilomoi05/prosjekt_host_1
- Repository: https://github.com/thilomoi05/prosjekt_host_1

## Overview

Beredt is an ASP.NET Core MVC portal connecting public-sector requests with private-sector resource offers during crises. Public users report and locate needs; private users offer resources; administrators approve offers and users, handle requests, and assign resources. Assignments, requests, and event history support the matching workflow. The README documents the map, address search, account management, dashboards, and role-based access. Sampled sources confirm key controller-to-repository and service-to-repository calls; other feature links below rely on README documentation.

Main entry points: [`Services/IBehovRepository.cs`](https://github.com/thilomoi05/prosjekt_host_1/blob/main/Services/IBehovRepository.cs) (Repository layer), [`Controllers/HomeController.cs`](https://github.com/thilomoi05/prosjekt_host_1/blob/main/Controllers/HomeController.cs) (MVC controllers), [`Controllers/AdminController.cs`](https://github.com/thilomoi05/prosjekt_host_1/blob/main/Controllers/AdminController.cs) (Approvals), [`Services/TildelingTjeneste.cs`](https://github.com/thilomoi05/prosjekt_host_1/blob/main/Services/TildelingTjeneste.cs) (Assignment service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_mvc["MVC controllers<br/>[HomeController.cs]"]
  node_overview["Overview"]
  node_map["Map interface<br/>[kart.js]"]
  node_address["Address search<br/>[sokefelt.js]"]
end

subgraph group_domain["Needs and offers"]
  node_needflow["Need reporting<br/>[BehovController.cs]"]
  node_resourceflow["Resource offers"]
  node_requestflow["Resource requests"]
  node_mapdata["Map data<br/>[KartController.cs]"]
end

subgraph group_matching["Matching and oversight"]
  node_adminflow["Approvals<br/>[AdminController.cs]"]
  node_assignment["Assignment service"]
  node_suggestions["Match suggestions"]
  node_allocationview["Allocation list"]
end

subgraph group_data["Persistence"]
  node_repositories["Repository layer"]
  node_efrepositories["EF repositories"]
  node_dbcontext["EF context"]
  node_database[("MariaDB")]
end

subgraph group_identity["Accounts and security"]
  node_accounts["Account management<br/>[KontoController.cs]"]
  node_identitysetup["Identity setup"]
  node_security["Security middleware"]
end

node_public(("Public actor"))
node_private(("Private actor"))
node_admin(("Administrator"))
node_geonorge["Geonorge address API"]

node_public -->|"uses"| node_mvc
node_private -->|"uses"| node_mvc
node_admin -->|"uses"| node_mvc
node_mvc -.->|"routes to"| node_overview
node_public -->|"reports needs"| node_needflow
node_private -->|"offers resources"| node_resourceflow
node_public -->|"requests resources"| node_requestflow
node_admin -->|"approves"| node_adminflow
node_adminflow -->|"delegates"| node_assignment
node_adminflow -->|"uses suggestions"| node_suggestions
node_public -->|"views map"| node_map
node_map -->|"gets JSON"| node_mapdata
node_mapdata -->|"reads data"| node_repositories
node_address -.->|"searches addresses"| node_geonorge
node_needflow -->|"reads and writes"| node_repositories
node_resourceflow -->|"reads and writes"| node_repositories
node_requestflow -.->|"handles requests"| node_assignment
node_assignment -->|"updates records"| node_repositories
node_overview -->|"reads summaries"| node_repositories
node_allocationview -.->|"reads allocations"| node_repositories
node_repositories -->|"implemented by"| node_efrepositories
node_efrepositories -->|"uses EF"| node_dbcontext
node_dbcontext -->|"persists data"| node_database
node_accounts -->|"uses Identity"| node_database
node_identitysetup -.->|"sets up roles"| node_database
node_mvc -.->|"routes account"| node_accounts

click node_mvc "https://github.com/thilomoi05/prosjekt_host_1/blob/main/Controllers/HomeController.cs"
click node_overview "https://github.com/thilomoi05/prosjekt_host_1/blob/main/Controllers/OversiktController.cs"
click node_map "https://github.com/thilomoi05/prosjekt_host_1/blob/main/wwwroot/js/kart.js"
click node_address "https://github.com/thilomoi05/prosjekt_host_1/blob/main/wwwroot/js/sokefelt.js"
click node_needflow "https://github.com/thilomoi05/prosjekt_host_1/blob/main/Controllers/BehovController.cs"
click node_resourceflow "https://github.com/thilomoi05/prosjekt_host_1/blob/main/Controllers/RessursController.cs"
click node_requestflow "https://github.com/thilomoi05/prosjekt_host_1/blob/main/Controllers/ForesporselController.cs"
click node_mapdata "https://github.com/thilomoi05/prosjekt_host_1/blob/main/Controllers/KartController.cs"
click node_adminflow "https://github.com/thilomoi05/prosjekt_host_1/blob/main/Controllers/AdminController.cs"
click node_assignment "https://github.com/thilomoi05/prosjekt_host_1/blob/main/Services/TildelingTjeneste.cs"
click node_suggestions "https://github.com/thilomoi05/prosjekt_host_1/blob/main/Services/Tildelingsforslag.cs"
click node_allocationview "https://github.com/thilomoi05/prosjekt_host_1/blob/main/Controllers/TildelingController.cs"
click node_repositories "https://github.com/thilomoi05/prosjekt_host_1/blob/main/Services/IBehovRepository.cs"
click node_efrepositories "https://github.com/thilomoi05/prosjekt_host_1/blob/main/Services/EfBehovRepository.cs"
click node_dbcontext "https://github.com/thilomoi05/prosjekt_host_1/blob/main/Data/BeredskapsDbContext.cs"
click node_accounts "https://github.com/thilomoi05/prosjekt_host_1/blob/main/Controllers/KontoController.cs"
click node_identitysetup "https://github.com/thilomoi05/prosjekt_host_1/blob/main/Data/IdentitetOppsett.cs"
click node_security "https://github.com/thilomoi05/prosjekt_host_1/blob/main/Sikkerhet/SikkerhetsheadereMiddleware.cs"

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_mvc,node_overview,node_map,node_address toneBlue
class node_needflow,node_resourceflow,node_requestflow,node_mapdata toneAmber
class node_adminflow,node_assignment,node_suggestions,node_allocationview,node_geonorge toneMint
class node_repositories,node_efrepositories,node_dbcontext,node_database toneRose
class node_accounts,node_identitysetup,node_security,node_public,node_private,node_admin toneIndigo
```

## Components

### Web experience

- [MVC controllers](https://github.com/thilomoi05/prosjekt_host_1/blob/main/Controllers/HomeController.cs): `Controllers/HomeController.cs`
- [Overview](https://github.com/thilomoi05/prosjekt_host_1/blob/main/Controllers/OversiktController.cs): `Controllers/OversiktController.cs`
- [Map interface](https://github.com/thilomoi05/prosjekt_host_1/blob/main/wwwroot/js/kart.js): `wwwroot/js/kart.js`
- [Address search](https://github.com/thilomoi05/prosjekt_host_1/blob/main/wwwroot/js/sokefelt.js): `wwwroot/js/sokefelt.js`

### Needs and offers

- [Need reporting](https://github.com/thilomoi05/prosjekt_host_1/blob/main/Controllers/BehovController.cs): `Controllers/BehovController.cs`
- [Resource offers](https://github.com/thilomoi05/prosjekt_host_1/blob/main/Controllers/RessursController.cs): `Controllers/RessursController.cs`
- [Resource requests](https://github.com/thilomoi05/prosjekt_host_1/blob/main/Controllers/ForesporselController.cs): `Controllers/ForesporselController.cs`
- [Map data](https://github.com/thilomoi05/prosjekt_host_1/blob/main/Controllers/KartController.cs): `Controllers/KartController.cs`

### Matching and oversight

- [Approvals](https://github.com/thilomoi05/prosjekt_host_1/blob/main/Controllers/AdminController.cs): `Controllers/AdminController.cs`
- [Assignment service](https://github.com/thilomoi05/prosjekt_host_1/blob/main/Services/TildelingTjeneste.cs): `Services/TildelingTjeneste.cs`
- [Match suggestions](https://github.com/thilomoi05/prosjekt_host_1/blob/main/Services/Tildelingsforslag.cs): `Services/Tildelingsforslag.cs`
- [Allocation list](https://github.com/thilomoi05/prosjekt_host_1/blob/main/Controllers/TildelingController.cs): `Controllers/TildelingController.cs`

### Persistence

- [Repository layer](https://github.com/thilomoi05/prosjekt_host_1/blob/main/Services/IBehovRepository.cs): `Services/IBehovRepository.cs`
- [EF repositories](https://github.com/thilomoi05/prosjekt_host_1/blob/main/Services/EfBehovRepository.cs): `Services/EfBehovRepository.cs`
- [EF context](https://github.com/thilomoi05/prosjekt_host_1/blob/main/Data/BeredskapsDbContext.cs): `Data/BeredskapsDbContext.cs`
- **MariaDB**

### Accounts and security

- [Account management](https://github.com/thilomoi05/prosjekt_host_1/blob/main/Controllers/KontoController.cs): `Controllers/KontoController.cs`
- [Identity setup](https://github.com/thilomoi05/prosjekt_host_1/blob/main/Data/IdentitetOppsett.cs): `Data/IdentitetOppsett.cs`
- [Security middleware](https://github.com/thilomoi05/prosjekt_host_1/blob/main/Sikkerhet/SikkerhetsheadereMiddleware.cs): `Sikkerhet/SikkerhetsheadereMiddleware.cs`

### Other components

- **Public actor**
- **Private actor**
- **Administrator**
- **Geonorge address API**

## Connections

- Public actor → MVC controllers: uses (evidence: `README.md`)
- Private actor → MVC controllers: uses (evidence: `README.md`)
- Administrator → MVC controllers: uses (evidence: `README.md`)
- MVC controllers → Overview: routes to
- Public actor → Need reporting: reports needs (evidence: `README.md`)
- Private actor → Resource offers: offers resources (evidence: `README.md`)
- Public actor → Resource requests: requests resources (evidence: `README.md`)
- Administrator → Approvals: approves (evidence: `README.md`)
- Approvals → Assignment service: delegates (evidence: `Controllers/AdminController.cs`)
- Approvals → Match suggestions: uses suggestions (evidence: `Controllers/AdminController.cs`)
- Public actor → Map interface: views map (evidence: `README.md`)
- Map interface → Map data: gets JSON (evidence: `README.md`)
- Map data → Repository layer: reads data (evidence: `Controllers/KartController.cs`)
- Address search → Geonorge address API: searches addresses (evidence: `README.md`)
- Need reporting → Repository layer: reads and writes (evidence: `Controllers/BehovController.cs`)
- Resource offers → Repository layer: reads and writes (evidence: `Controllers/RessursController.cs`)
- Resource requests → Assignment service: handles requests
- Assignment service → Repository layer: updates records (evidence: `Services/TildelingTjeneste.cs`)
- Overview → Repository layer: reads summaries (evidence: `Controllers/OversiktController.cs`)
- Allocation list → Repository layer: reads allocations
- Repository layer → EF repositories: implemented by (evidence: `Program.cs`)
- EF repositories → EF context: uses EF (evidence: `Services/EfBehovRepository.cs`)
- EF context → MariaDB: persists data (evidence: `README.md`)
- Account management → MariaDB: uses Identity (evidence: `README.md`)
- Identity setup → MariaDB: sets up roles
- MVC controllers → Account management: routes account
