# vkumar0303/-schoolerp-accounting architecture

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

- Interactive diagram: https://gitdiagram.com/vkumar0303/-schoolerp-accounting
- Repository: https://github.com/vkumar0303/-schoolerp-accounting

## Overview

#### Purpose and Solution Shape
SchoolERP is an early-stage .NET school ERP focused on a double-entry accounting module. The implemented core is a domain-driven accounting model with Entity Framework Core persistence; API, application, contracts, and UI projects are present but largely scaffolding. The solution root is `SchoolERP.slnx`.

#### Runtime Entry Points
Two executable hosts exist:
- ASP.NET Core API: `src/SchoolERP.Api/Program.cs`, configured through `src/SchoolERP.Api/appsettings.json`.
- Blazor web host: `src/SchoolERP.Web/Program.cs`, with root routing/UI in `src/SchoolERP.Web/Components/App.razor` and `src/SchoolERP.Web/Components/Routes.razor`.

The web project currently contains template pages and layout rather than accounting workflows. The API’s exposed endpoint surface cannot be inferred beyond its host bootstrap.

#### Accounting Domain Core
The authoritative business layer is `src/SchoolERP.Domain/Accounting`. It models organizational scope and chart-of-accounts hierarchy:
- Organization and branch ownership: `Organization.cs`, `Branch.cs`.
- Account classification and balances: `LedgerAccount.cs`, `AccountGroup.cs`, `AccountType.cs`.
- A proposed school-specific seed chart: `DefaultSchoolChartOfAccounts.cs`.

Domain entities inherit shared identity/error primitives in `src/SchoolERP.Domain/Shared/Entity.cs` and `DomainException.cs`, keeping accounting invariant enforcement independent of transport and database concerns.

#### Financial Calendar and Posting Lifecycle
Financial control is represented by fiscal years and accounting periods:
- `FinancialYear.cs` and `FinancialYearStatus.cs`
- `AccountingPeriod.cs` and `AccountingPeriodStatus.cs`

Transaction processing centers on vouchers and journal entries:
- Source/approval-facing voucher lifecycle: `Voucher.cs`, `VoucherStatus.cs`, `VoucherType.cs`.
- Double-entry representation and lifecycle: `JournalEntry.cs`, `JournalEntryLine.cs`, `JournalEntryStatus.cs`.
- Posting and reversal orchestration: `AccountingPostingService.cs`, `AccountingReversalService.cs`.

The intended control flow is voucher/journal creation → validation of accounts, balances, period/year status, and entry state → posting via the domain service → reversal through a dedicated domain service rather than editing posted records.

#### Persistence Boundary
`SchoolERP.Infrastructure` owns the EF Core boundary. `src/SchoolERP.Infrastructure/Persistence/SchoolErpDbContext.cs` maps domain entities to relational storage, while the per-aggregate configurations under `Persistence/Configurations` define schema and relationships. `SchoolErpDbContextFactory.cs` supports design-time context creation.

The initial durable schema is captured in:
- `src/SchoolERP.Infrastructure/Migrations/20260805083641_InitialAccountingPersistence.cs`
- `src/SchoolERP.Infrastructure/Migrations/SchoolErpDbContextModelSnapshot.cs`

Database provider and connection details are not visible from the supplied tree; configuration is expected to come from host `appsettings` files.

#### Application and Contract Boundary
`src/SchoolERP.Application` and `src/SchoolERP.Contracts` establish intended boundaries for use cases and transport DTOs, but each currently has only `Class1.cs`. Consequently, hosts should not yet depend on a mature application-command/query layer; the concrete implemented behavior resides in the domain and infrastructure projects.

#### Legacy Discovery and Migration Context
Repository-root reports and scripts support discovery of legacy financial data rather than runtime operation. Key artifacts include `sql/legacy_financial_discovery.sql`, `financial_data_source_map.md`, `receipt_reconciliation_report.md`, and the accounting migration proposal in `docs/legacy_accounting_mapping_proposal.md`. Python scripts such as `process_schema.py` and `generate_reports.py` appear to profile and document source data for future migration planning.

#### Infrastructure and External Dependencies
Material runtime technologies are .NET/ASP.NET Core, Blazor, and EF Core migrations. No deployed infrastructure, identity provider, messaging system, payment gateway, or external SaaS integration is evidenced in the tree. Bootstrap is bundled under `src/SchoolERP.Web/wwwroot/lib/bootstrap` for the web host’s presentation layer.

Main entry points: [`src/SchoolERP.Infrastructure/Persistence/SchoolErpDbContext.cs`](https://github.com/vkumar0303/-schoolerp-accounting/blob/main/src/SchoolERP.Infrastructure/Persistence/SchoolErpDbContext.cs) (EF Core DbContext), [`src/SchoolERP.Domain/Accounting/AccountingPostingService.cs`](https://github.com/vkumar0303/-schoolerp-accounting/blob/main/src/SchoolERP.Domain/Accounting/AccountingPostingService.cs) (Posting service), [`src/SchoolERP.Domain/Accounting`](https://github.com/vkumar0303/-schoolerp-accounting/tree/main/src/SchoolERP.Domain/Accounting) (Accounting model), [`src/SchoolERP.Domain/Accounting/JournalEntry.cs`](https://github.com/vkumar0303/-schoolerp-accounting/blob/main/src/SchoolERP.Domain/Accounting/JournalEntry.cs) (Journal entries)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_hosts["Executable Hosts"]
  node_api["ASP.NET Core API<br/>API host<br/>[Program.cs]"]
  node_api_settings["API settings<br/>host configuration<br/>[appsettings.json]"]
  node_web["Blazor web host<br/>[Program.cs]"]
  node_web_ui["Blazor routes and UI<br/>presentation<br/>[Routes.razor]"]
end

subgraph group_domain["Accounting Domain"]
  node_domain_shared["Domain primitives<br/>shared domain<br/>[Entity.cs]"]
  node_accounting_model{{"Accounting model<br/>domain model<br/>[Accounting]"}}
  node_school_chart["Default school chart<br/>seed chart"]
  node_financial_calendar["Financial calendar<br/>domain model<br/>[FinancialYear.cs]"]
  node_vouchers["Voucher lifecycle<br/>domain aggregate<br/>[Voucher.cs]"]
  node_journal_entries["Journal entries<br/>double-entry aggregate<br/>[JournalEntry.cs]"]
  node_posting{{"Posting service<br/>domain service"}}
  node_reversal{{"Reversal service<br/>domain service"}}
end

subgraph group_persistence["Persistence"]
  node_dbcontext[("EF Core DbContext<br/>persistence boundary")]
  node_entity_mappings["Entity mappings<br/>EF configurations<br/>[Configurations]"]
  node_initial_migration["Initial accounting schema<br/>EF migration"]
end

subgraph group_legacy["Legacy Discovery"]
  node_legacy_sql["Legacy financial discovery<br/>SQL discovery"]
  node_mapping_proposal["Accounting mapping proposal<br/>migration planning"]
end

node_application["Application layer<br/>scaffolded boundary<br/>[Class1.cs]"]
node_contracts["Contracts layer<br/>scaffolded boundary<br/>[Class1.cs]"]

node_api_settings -->|"configures"| node_api
node_web -->|"serves"| node_web_ui
node_accounting_model -->|"inherits primitives"| node_domain_shared
node_school_chart -->|"seeds"| node_accounting_model
node_vouchers -->|"creates journal entries"| node_journal_entries
node_posting -->|"processes"| node_vouchers
node_posting -->|"posts"| node_journal_entries
node_posting -->|"validates accounts"| node_accounting_model
node_posting -->|"checks period status"| node_financial_calendar
node_reversal -->|"reverses"| node_journal_entries
node_dbcontext -->|"persists"| node_accounting_model
node_dbcontext -->|"persists"| node_financial_calendar
node_dbcontext -->|"persists"| node_vouchers
node_dbcontext -->|"persists"| node_journal_entries
node_entity_mappings -->|"configures"| node_dbcontext
node_initial_migration -->|"captures schema"| node_dbcontext
node_legacy_sql -.->|"informs"| node_mapping_proposal

click node_api "https://github.com/vkumar0303/-schoolerp-accounting/blob/main/src/SchoolERP.Api/Program.cs"
click node_api_settings "https://github.com/vkumar0303/-schoolerp-accounting/blob/main/src/SchoolERP.Api/appsettings.json"
click node_web "https://github.com/vkumar0303/-schoolerp-accounting/blob/main/src/SchoolERP.Web/Program.cs"
click node_web_ui "https://github.com/vkumar0303/-schoolerp-accounting/blob/main/src/SchoolERP.Web/Components/Routes.razor"
click node_domain_shared "https://github.com/vkumar0303/-schoolerp-accounting/blob/main/src/SchoolERP.Domain/Shared/Entity.cs"
click node_accounting_model "https://github.com/vkumar0303/-schoolerp-accounting/tree/main/src/SchoolERP.Domain/Accounting"
click node_school_chart "https://github.com/vkumar0303/-schoolerp-accounting/blob/main/src/SchoolERP.Domain/Accounting/DefaultSchoolChartOfAccounts.cs"
click node_financial_calendar "https://github.com/vkumar0303/-schoolerp-accounting/blob/main/src/SchoolERP.Domain/Accounting/FinancialYear.cs"
click node_vouchers "https://github.com/vkumar0303/-schoolerp-accounting/blob/main/src/SchoolERP.Domain/Accounting/Voucher.cs"
click node_journal_entries "https://github.com/vkumar0303/-schoolerp-accounting/blob/main/src/SchoolERP.Domain/Accounting/JournalEntry.cs"
click node_posting "https://github.com/vkumar0303/-schoolerp-accounting/blob/main/src/SchoolERP.Domain/Accounting/AccountingPostingService.cs"
click node_reversal "https://github.com/vkumar0303/-schoolerp-accounting/blob/main/src/SchoolERP.Domain/Accounting/AccountingReversalService.cs"
click node_application "https://github.com/vkumar0303/-schoolerp-accounting/blob/main/src/SchoolERP.Application/Class1.cs"
click node_contracts "https://github.com/vkumar0303/-schoolerp-accounting/blob/main/src/SchoolERP.Contracts/Class1.cs"
click node_dbcontext "https://github.com/vkumar0303/-schoolerp-accounting/blob/main/src/SchoolERP.Infrastructure/Persistence/SchoolErpDbContext.cs"
click node_entity_mappings "https://github.com/vkumar0303/-schoolerp-accounting/tree/main/src/SchoolERP.Infrastructure/Persistence/Configurations"
click node_initial_migration "https://github.com/vkumar0303/-schoolerp-accounting/blob/main/src/SchoolERP.Infrastructure/Migrations/20260805083641_InitialAccountingPersistence.cs"
click node_legacy_sql "https://github.com/vkumar0303/-schoolerp-accounting/blob/main/sql/legacy_financial_discovery.sql"
click node_mapping_proposal "https://github.com/vkumar0303/-schoolerp-accounting/blob/main/docs/legacy_accounting_mapping_proposal.md"

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_api,node_api_settings,node_web,node_web_ui toneBlue
class node_domain_shared,node_accounting_model,node_school_chart,node_financial_calendar,node_vouchers,node_journal_entries,node_posting,node_reversal toneAmber
class node_dbcontext,node_entity_mappings,node_initial_migration toneMint
class node_legacy_sql,node_mapping_proposal toneRose
class node_application,node_contracts toneNeutral
```

## Components

### Executable Hosts

- [ASP.NET Core API](https://github.com/vkumar0303/-schoolerp-accounting/blob/main/src/SchoolERP.Api/Program.cs): API host · Endpoint surface is not yet defined. · `src/SchoolERP.Api/Program.cs`
- [API settings](https://github.com/vkumar0303/-schoolerp-accounting/blob/main/src/SchoolERP.Api/appsettings.json): host configuration · `src/SchoolERP.Api/appsettings.json`
- [Blazor web host](https://github.com/vkumar0303/-schoolerp-accounting/blob/main/src/SchoolERP.Web/Program.cs): web host · Currently serves template UI rather than accounting workflows. · `src/SchoolERP.Web/Program.cs`
- [Blazor routes and UI](https://github.com/vkumar0303/-schoolerp-accounting/blob/main/src/SchoolERP.Web/Components/Routes.razor): presentation · `src/SchoolERP.Web/Components/Routes.razor`

### Accounting Domain

- [Domain primitives](https://github.com/vkumar0303/-schoolerp-accounting/blob/main/src/SchoolERP.Domain/Shared/Entity.cs): shared domain · Entity identity and domain exception primitives. · `src/SchoolERP.Domain/Shared/Entity.cs`
- [Accounting model](https://github.com/vkumar0303/-schoolerp-accounting/tree/main/src/SchoolERP.Domain/Accounting): domain model · Organizations, branches, chart hierarchy, and account balances. · `src/SchoolERP.Domain/Accounting`
- [Default school chart](https://github.com/vkumar0303/-schoolerp-accounting/blob/main/src/SchoolERP.Domain/Accounting/DefaultSchoolChartOfAccounts.cs): seed chart · `src/SchoolERP.Domain/Accounting/DefaultSchoolChartOfAccounts.cs`
- [Financial calendar](https://github.com/vkumar0303/-schoolerp-accounting/blob/main/src/SchoolERP.Domain/Accounting/FinancialYear.cs): domain model · Fiscal-year and accounting-period status controls. · `src/SchoolERP.Domain/Accounting/FinancialYear.cs`
- [Voucher lifecycle](https://github.com/vkumar0303/-schoolerp-accounting/blob/main/src/SchoolERP.Domain/Accounting/Voucher.cs): domain aggregate · Source and approval-facing voucher state. · `src/SchoolERP.Domain/Accounting/Voucher.cs`
- [Journal entries](https://github.com/vkumar0303/-schoolerp-accounting/blob/main/src/SchoolERP.Domain/Accounting/JournalEntry.cs): double-entry aggregate · Journal headers, lines, and entry state. · `src/SchoolERP.Domain/Accounting/JournalEntry.cs`
- [Posting service](https://github.com/vkumar0303/-schoolerp-accounting/blob/main/src/SchoolERP.Domain/Accounting/AccountingPostingService.cs): domain service · Validates and posts balanced entries in open periods. · `src/SchoolERP.Domain/Accounting/AccountingPostingService.cs`
- [Reversal service](https://github.com/vkumar0303/-schoolerp-accounting/blob/main/src/SchoolERP.Domain/Accounting/AccountingReversalService.cs): domain service · Reverses posted records without editing them. · `src/SchoolERP.Domain/Accounting/AccountingReversalService.cs`

### Persistence

- [EF Core DbContext](https://github.com/vkumar0303/-schoolerp-accounting/blob/main/src/SchoolERP.Infrastructure/Persistence/SchoolErpDbContext.cs): persistence boundary · Maps accounting aggregates to relational storage. · `src/SchoolERP.Infrastructure/Persistence/SchoolErpDbContext.cs`
- [Entity mappings](https://github.com/vkumar0303/-schoolerp-accounting/tree/main/src/SchoolERP.Infrastructure/Persistence/Configurations): EF configurations · Per-aggregate schema and relationship mappings. · `src/SchoolERP.Infrastructure/Persistence/Configurations`
- [Initial accounting schema](https://github.com/vkumar0303/-schoolerp-accounting/blob/main/src/SchoolERP.Infrastructure/Migrations/20260805083641_InitialAccountingPersistence.cs): EF migration · `src/SchoolERP.Infrastructure/Migrations/20260805083641_InitialAccountingPersistence.cs`

### Legacy Discovery

- [Legacy financial discovery](https://github.com/vkumar0303/-schoolerp-accounting/blob/main/sql/legacy_financial_discovery.sql): SQL discovery · Profiles legacy financial source data for migration planning. · `sql/legacy_financial_discovery.sql`
- [Accounting mapping proposal](https://github.com/vkumar0303/-schoolerp-accounting/blob/main/docs/legacy_accounting_mapping_proposal.md): migration planning · `docs/legacy_accounting_mapping_proposal.md`

### Other components

- [Application layer](https://github.com/vkumar0303/-schoolerp-accounting/blob/main/src/SchoolERP.Application/Class1.cs): scaffolded boundary · No implemented use-case layer yet. · `src/SchoolERP.Application/Class1.cs`
- [Contracts layer](https://github.com/vkumar0303/-schoolerp-accounting/blob/main/src/SchoolERP.Contracts/Class1.cs): scaffolded boundary · No implemented transport DTOs yet. · `src/SchoolERP.Contracts/Class1.cs`

## Connections

- API settings → ASP.NET Core API: configures
- Blazor web host → Blazor routes and UI: serves
- Accounting model → Domain primitives: inherits primitives
- Default school chart → Accounting model: seeds
- Voucher lifecycle → Journal entries: creates journal entries
- Posting service → Voucher lifecycle: processes
- Posting service → Journal entries: posts
- Posting service → Accounting model: validates accounts
- Posting service → Financial calendar: checks period status
- Reversal service → Journal entries: reverses
- EF Core DbContext → Accounting model: persists
- EF Core DbContext → Financial calendar: persists
- EF Core DbContext → Voucher lifecycle: persists
- EF Core DbContext → Journal entries: persists
- Entity mappings → EF Core DbContext: configures
- Initial accounting schema → EF Core DbContext: captures schema
- Legacy financial discovery → Accounting mapping proposal: informs
