Files
accounting-system/.claude/CLAUDE.md
Yaojia Wang f319c6e772 Code fixed
2026-02-13 10:31:54 +01:00

3.7 KiB

FiscalFlow - Multi-Accounting System Invoice Processing Platform

Invoice OCR platform integrating with accounting systems (Fortnox, Visma, Hogia). Scans invoices, matches suppliers, generates vouchers, and imports into connected accounting software.

Tech Stack

  • Backend: .NET 10 (C# 14), ASP.NET Core Web API, EF Core, PostgreSQL, Redis
  • Frontend: React 18 + TypeScript + Vite + TailwindCSS + Zustand
  • Patterns: DDD Lite, CQRS (MediatR), Repository + Unit of Work, Domain Events
  • Libraries: FluentValidation, AutoMapper, Serilog, Polly, JWT Bearer

Solution Structure

backend/FiscalFlow.sln
  src/FiscalFlow.Api/              -- Controllers, middleware, Swagger
  src/FiscalFlow.Application/      -- CQRS commands/queries, DTOs, validators
  src/FiscalFlow.Core/             -- Domain entities, value objects, events, interfaces
  src/FiscalFlow.Infrastructure/   -- EF Core repos, event store, blob storage, OCR client
  src/FiscalFlow.Integrations/     -- IAccountingSystem providers (Fortnox, Visma...)
  tests/FiscalFlow.UnitTests/      -- xUnit + Moq + FluentAssertions
  tests/FiscalFlow.IntegrationTests/
frontend/                          -- React SPA (Vite dev server :5173)
docs/                              -- Architecture, API, DB schema docs (Chinese)

Compiler Constraints

Directory.Build.props enforces globally -- all code must satisfy:

  • TreatWarningsAsErrors enabled -- zero warnings allowed
  • Nullable enabled -- all reference types are non-nullable by default, use ? for nullable
  • StyleCop.Analyzers -- code style enforced at build time
  • EnforceCodeStyleInBuild enabled

Layer Dependencies (strict)

Core          -- zero external NuGet deps, no project references
Application   -- references Core only. MediatR, AutoMapper, FluentValidation
Infrastructure-- references Application. EF Core, Npgsql, Polly, Azure Storage, Identity
Integrations  -- references Core only. HttpClient-based provider implementations
Api           -- references Application, Infrastructure, Integrations. Serilog, Swashbuckle
UnitTests     -- references Application, Core. xUnit, Moq, FluentAssertions
IntegrationTests -- references Api. WebApplicationFactory, Testcontainers.PostgreSql

Commands

# Infrastructure
docker-compose up -d   # PostgreSQL + Redis

# Backend (from backend/)
dotnet restore && dotnet build
dotnet run --project src/FiscalFlow.Api
dotnet test
dotnet test tests/FiscalFlow.UnitTests
dotnet test --collect:"XPlat Code Coverage"   # with coverage

# EF Core migrations (from backend/)
dotnet ef migrations add <Name> --project src/FiscalFlow.Infrastructure --startup-project src/FiscalFlow.Api
dotnet ef database update --project src/FiscalFlow.Infrastructure --startup-project src/FiscalFlow.Api

# Frontend (from frontend/)
npm install && npm run dev
npm run build
npm run lint

Architecture

  • Provider Pattern: IAccountingSystem interface in FiscalFlow.Integrations/Accounting/. New providers implement this interface and register via DI. Factory: IAccountingSystemFactory.Create("fortnox")
  • CQRS: Commands/queries dispatched by MediatR with pipeline behaviors for validation and logging
  • Domain Events: Raised by aggregates, dispatched by EF Core interceptor, stored in DomainEvents table (JSONB payload) for audit trail
  • Invoice Lifecycle: Upload -> OCR -> SupplierMatch -> VoucherGenerate -> Import

dotnet-skills Routing

  • Code quality: modern-csharp-coding-standards, api-design, type-design-performance
  • Data access: efcore-patterns, database-performance
  • DI / config: dependency-injection-patterns, microsoft-extensions-configuration
  • Quality gates: dotnet-slopwatch (after new/refactored code), crap-analysis (after test changes)