Türkçe README · Deutsche README
BankApp is a full-stack educational banking sample for individual and corporate credit applications.
Backend: .NET 10 Clean Architecture + CQRS (MediatR), Modular Monolith (Identity / Customers / Credit / Notification), Domain Events + Outbox, Idempotency-Key, Saga, SignalR.
Frontend: React (Vite + TypeScript) with TR / EN / DE i18n and live credit notifications (SignalR).
Local stack: Docker Compose (SQL Server, Redis, Seq, RabbitMQ, Vault lab, Keycloak lab, ELK, WebApi, client).
Docs: Roadmap · Tech learning · Learning library · Architecture notes · History · Changelog · Test notes · Infra
- Demo logins
- Features
- Screenshots (EN)
- Tech stack
- Solution structure
- Architecture diagrams
- Domain model
- Business rules
- API overview
- Lab tools
- SmartEnum
- Data seeding
- Getting started
- Example requests
Shared password: Demo123!. Roughly 1 manager + 3 staff per branch (top-up seed).
| Role | Example email | Branch |
|---|---|---|
| SuperAdmin | [email protected] |
— |
| Manager | manager.ist@ / manager.tr@ (ANK) / manager.ber@ / manager.nyc@ / [email protected] |
IST / ANK / BER / NYC / CHI |
| Staff | staff.tr@, staff.ank@, staff.de@, staff.nyc@, staff.chi@ (+ .analyst / .rm / .ops variants) |
same |
| Customer | customer.tr@ / customer.en@ / [email protected] (+ customer@) |
by locale |
Legacy aliases still work: staff@, manager@, manager.en@, staff.en@, …
Roles: Customer, BankStaff, BankManager, SuperAdmin (manager also has BankStaff; SuperAdmin can CRUD branches).
- Individual / corporate customers (TPT), credit types & sub-types, applications
- JWT auth + RBAC; public individual registration with email confirmation (RabbitMQ)
- Approve / reject / cancel (status change — not soft-delete for cancel)
- Editable customer decision letters (approve/reject templates; stored in
notes) - Domain Events + Transactional Outbox (credit lifecycle →
domain-eventsqueue) - Idempotency-Key (create / approve / reject / cancel; Redis, 24h)
- Saga / Process Manager (
CreditApplicationSagas; Created → decision → onboarding stubs) - SignalR (
/hubs/credit-applications; staff + customer groups; publish after Outbox consumer) - Decision letter email / SMS (lab) — after approve/reject, queues
decision-letter+decision-letter-sms→ Seq/log (no SMTP/SMS gateway) - Rate limiting — policies
auth/write/fixed(429); health + SignalR exempt - Vault lab — JWT
SecurityKey(+ dual-keySecurityKeyPrevious) overlay fromsecret/bankapp; rotate script; env fallback - Keycloak lab — Compose realm; dual JwtBearer + claim enrich; SPA PKCE (“Sign in with Keycloak”); Google/GitHub IdP script (off without secrets)
- Branch model + DoA (
Branch.MaxApprovalAmount+ currency; position × branch cap) ApproveGateMode(None/Soft/Hard) + document soft/hard gate- Application document upload (lab: identity / income / other; PDF/JPEG/PNG ≤5 MB; App_Data)
- ELK lab — ES live search/facets (applications, staff, customers, credit types); Seq remains for logs
- Payment plan (amortization) + PDF export/print
- Dashboard summary + Admin Tailwind dashboard (
/dashboard) - Staff management, profile + avatar (≤ 2 MB); credit type CRUD (BankManager)
- Serilog → Seq, Redis cache, FluentValidation, ProblemDetails
- OpenTelemetry → collector → Tempo / Prometheus / Grafana
- Login / register / email confirm, applications, customers, credit types, staff, branches, profile
- Stats strip, FX ticker, accessibility panel (theme / font size / contrast)
- Privacy / cookie banner; locale switcher TR / EN / DE
- Idempotency-Key (UUID) on credit write requests
- SignalR: application-status toast + list/detail refresh; missing-doc badge
- Application detail: document upload / list / download (Pending); ES filter/facets (manager)
- Payment plan: collapsible installment table, PDF download and print
- Staff decision forms: reloadable approve/reject message templates
- GitHub Actions: restore/build WebApi, run unit + integration tests, build React client
- Docker Compose stack (
infra/) for local multi-service runs (healthchecked chain)
- xUnit Application.UnitTests (domain rules, saga, handlers)
- xUnit WebApi.IntegrationTests (API + auth/credit flows)
- Client production build (
tsc+ Vite) in CI
UI captures under docs/assets/screenshots/en/ (English locale for now).
Role walkthroughs: Customer · Bank staff · Bank manager · SuperAdmin
Login & privacy banner — Sign-in with TR/EN/DE switcher, remember-me, demo credentials on the card, and cookie/privacy consent before using the SPA.
Dark theme login — Same login card with accessibility dark theme.
Register — Individual customer self-registration form.
Keycloak login — SPA “Sign in with Keycloak” / IdP hosted login.
403 Permission denied — Cross-role / cross-branch denial surface.
Accessibility panel — Floating controls for light/dark theme, font scale, and high contrast (persisted in the browser).
Customer — Welcome by display name; own application counters. More: customer gallery.
Bank staff — Global stats, FX ticker, SignalR lifecycle toasts. More: staff gallery.
Bank manager — Same overview with staff + credit-type admin. More: manager gallery.
SuperAdmin — Cross-branch admin + Branches CRUD. More: SuperAdmin gallery.
Docker Compose — Full lab stack (SQL, Redis, Seq, RabbitMQ, Vault, Keycloak, ELK, OTel, Prometheus, Grafana, WebApi, client).
Scalar API reference — Interactive OpenAPI UI for WebApi (/scalar/v1).
Seq — Structured application logs (Serilog), correlatable with TraceId when OTel is on.
Redis Insight — Cache browser for the Compose Redis instance (:5540).
Prometheus & Grafana — Metrics scrape + dashboards/traces UI (:9090 / :3001).
RabbitMQ — Queues for email confirmation, domain-events (Outbox consumer), decision-letter and decision-letter-sms (lab).
Vault (lab) — Dev-mode KV secret/bankapp; WebApi startup overlay (JWT current + previous dual-key).
Keycloak admin — Realm / users console (:8180).
Kibana — Elasticsearch Discover / Lens over bankapp-credit-applications and bankapp-logs-*.
| Area | Technology |
|---|---|
| API | .NET 10, ASP.NET Core, MediatR, FluentValidation, AutoMapper, EF Core 10 |
| Domain | AggregateRoot, Domain Events (CreditApplication*), Ardalis SmartEnum (name) |
| DB / cache / logs | SQL Server, Redis, Serilog + Seq |
| Observability | OpenTelemetry (OTLP) → collector → Tempo + Prometheus + Grafana :3001 |
| Messaging | RabbitMQ (email-confirmation, domain-events, decision-letter, decision-letter-sms) + Outbox |
| Idempotency | Header Idempotency-Key + Redis (credit write APIs, 24h) |
| Saga | CreditApplicationProcessManager + table CreditApplicationSagas |
| Realtime | SignalR hub /hubs/credit-applications (JWT access_token) |
| Secrets (lab) | HashiCorp Vault dev (overlay + dual-key rotate); optional Raft overlay :8210+ |
| Auth | JWT + roles; Keycloak lab (dual JwtBearer + SPA PKCE) |
| Search (lab) | Elasticsearch (applications / staff / customers / credit types) + Kibana |
| Client | React, Vite, TypeScript, Tailwind (admin dashboard), react-i18next, SignalR |
| Docs (Dev) | OpenAPI + Scalar (/scalar/v1) |
| Test / CI | xUnit (Application + WebApi.IntegrationTests), GitHub Actions |
| Seed | Bogus — per-branch customer/staff/application top-up |
| Infra | Docker Compose (infra/) — healthchecked service chain |
BankApp/
├── BankApp.slnx
├── README.md / README.tr.md / README.de.md
├── client/ # React SPA
├── docs/ # roadmap, tech learning, architecture notes, changelog, history
├── infra/ # docker-compose, .env.example, scripts/vault-seed.sh
├── tests/ # Application.UnitTests, WebApi.IntegrationTests
└── src/
├── WebApi/ # Host + Modules/{Identity,Customers,Credit,Notification}
├── Application/ # Modules/{Identity,Customers,Credit,Notification} + shared Services
├── Domain/ # Entities, Events, SmartEnums, CreditApplicationSaga
├── Persistence/ # DbContext (outbox harvest), migrations, repositories, seed
└── Core/ # Entity, AggregateRoot, paging, security helpers, pipelines
Dependency direction: WebApi → Application / Persistence → Domain / Core.
flowchart TB
Client[React client]
WebApi[WebApi]
Application[Application]
Persistence[Persistence]
Domain[Domain]
Core[Core]
Client --> WebApi
WebApi --> Application
WebApi --> Persistence
Application --> Domain
Application --> Core
Persistence --> Application
Persistence --> Domain
Persistence --> Core
Domain --> Core
sequenceDiagram
participant Client
participant Controller
participant MediatR
participant Validation as RequestValidationBehavior
participant Handler
participant Rules as BusinessRules
participant Repo as Repository / EF Core
participant Db as SQL Server
Client->>Controller: HTTP + JWT
Controller->>MediatR: Send(Request)
MediatR->>Validation: FluentValidation
Validation->>Handler: Handle
Handler->>Rules: Domain checks
Handler->>Repo: Query / command
Repo->>Db: SQL
Db-->>Repo: Data
Repo-->>Handler: Entity / page
Handler-->>Controller: Response DTO
Controller-->>Client: JSON / ProblemDetails
stateDiagram-v2
[*] --> Pending: Create
Pending --> Approved: Approve
Pending --> Rejected: Reject
Pending --> Cancelled: Cancel
Pending --> Pending: Update (Pending only)
Approved --> [*]
Rejected --> [*]
Cancelled --> [*]
| Entity | Notes |
|---|---|
| Customer | Shared: number, email, phone, address, IsActive, soft-delete |
| IndividualCustomer | Name, national id, DOB, gender, … |
| CorporateCustomer | Company, tax, authorized person, … |
| Entity | Role |
|---|---|
| CreditType | Product (category, risk, currency, locale, active) |
| CreditSubType | Package (amount/term ranges, rates) |
| CreditApplication | Request + status + decision fields |
| Flag | Meaning |
|---|---|
IsActive |
Business: usable for new operations |
IsDeleted |
Technical soft delete (DeletedDate) |
Application cancel sets status to Cancelled via dedicated command (not soft-delete).
- Unique national id / tax / registration / customer number / email (per rules).
- Soft delete of customers: BankManager only; customer must be inactive and have no open Pending/Approved applications.
- Unique codes; amount/term range consistency.
- New applications require active parent credit type and sub-type.
- Category match: individual ↔ Individual, corporate ↔ Corporate.
- Manager-only mutating APIs for credit types (create / update / delete / set active).
- Amount/term within sub-type package (and packaging constraints where applied).
- Only Pending can be updated, approved, rejected, or cancelled.
Most endpoints require JWT (Authorization: Bearer …) except login / public register / confirm-email.
Credit writes (POST create/approve/reject/cancel): required header Idempotency-Key.
| Controller | Highlights |
|---|---|
| Auth | POST login, register, register-individual, confirm-email |
| IndividualCustomers / CorporateCustomers | CRUD + inactive / deleted lists |
| CreditTypes | List/get; mutate + PUT {id}/active (manager) |
| CreditSubTypes | CRUD |
| CreditApplications | approve / reject / cancel (+ Idempotency-Key); payment-plan; payment-plan/export?format=pdf |
| Dashboard | GET summary |
| StaffUsers | List / create / update (manager); ES search |
| Branches | Branch CRUD (SuperAdmin); DoA cap + currency |
| Profile | Get mine; update staff profile; upload avatar |
Interactive details: Scalar UI.
How to watch the stack (Scalar, Seq, Redis Insight, RabbitMQ, Grafana, Vault, Keycloak, Kibana, SQL, Docker) — setup, Compose DNS, cautions, best practices → docs/learning/tr/24-lab-tools.md (Turkish chapter; URLs match this README).
Short debug chain: Scalar request → Redis Insight / RabbitMQ → Seq logs → (optional) Grafana traces.
Stored and serialized by name (e.g. "Pending"), not integer ordinals.
| Type | Values (examples) |
|---|---|
CreditCategory |
Individual, Corporate |
CreditRiskLevel |
Low, Medium, High |
CreditApplicationStatus |
Pending, Approved, Rejected, Cancelled |
Gender |
Female, Male, PreferNotToSay |
PersonTitle |
Dr, Prof |
StaffPosition |
CreditAnalyst, RelationshipManager, BranchOfficer, RiskOfficer, OperationsSpecialist, BranchManager |
Runs when configured (Database__RunSeed, typical in Docker / Development). Top-up strategy: fill up to targets if short.
| Seed | Approx. target |
|---|---|
| Branches | 5 (IST / ANK / BER / NYC / CHI) + DoA cap/currency |
| Individual customers | 12 / branch (~60) |
| Corporate customers | 8 / branch (~40) |
| Credit types / subs | 16 types + packaged sub-types (TRY/USD/EUR) |
| Credit applications | ~100 (mixed status; fake docs on Pending) |
| Identity | ~1 manager + 3 staff / branch; SuperAdmin; customers |
Note: Seed creates only BranchSeed.DemoBranches. Manually added branches (e.g. DOR-01) may receive customer top-up but no staff map. Remove or deactivate orphans via SuperAdmin → Branches UI.
# from repo root
copy infra\.env.example infra\.env
docker compose -f infra/docker-compose.yml --env-file infra/.env up -d --buildSee infra/README.md for volumes, ports, and teardown.
Prerequisites: .NET 10 SDK, SQL Server (or Docker SQL), Node.js 20+, Redis/Seq optional.
dotnet ef database update --project src/Persistence/Persistence.csproj --startup-project src/WebApi/WebApi.csproj
dotnet run --project src/WebApi/WebApi.csprojcd client
copy .env.example .env
npm install
npm run devConfigure ConnectionStrings__BankingConnectionString and JWT TokenOptions__SecurityKey via appsettings / User Secrets / env.
dotnet test tests/Application.UnitTests/Application.UnitTests.csproj
dotnet test tests/WebApi.IntegrationTests/WebApi.IntegrationTests.csprojGitHub Actions (.github/workflows/ci.yml) runs backend build + both test projects and the React client build on push/PR to main/master.
POST /api/Auth/login
Content-Type: application/json
{
"email": "[email protected]",
"password": "Demo123!"
}Use returned access token as Authorization: Bearer <token>.
POST /api/CreditApplications
Authorization: Bearer <token>
Content-Type: application/json
{
"creditSubTypeId": "<guid>",
"requestedAmount": 50000,
"requestedTermMonths": 24,
"monthlyIncome": 45000,
"existingDebtAmount": 5000,
"purpose": "Personal expenses",
"notes": null
}POST /api/CreditApplications/{id}/approve
Authorization: Bearer <token>
Content-Type: application/json
{
"approvedAmount": 45000,
"approvedTermMonths": 24,
"approvedInterestRate": 2.45,
"notes": "Approved with conditions"
}POST /api/CreditApplications/{id}/cancel
Authorization: Bearer <token>
Content-Type: application/json
{}Educational Clean Architecture + full-stack credit workflow sample.
Adapt connection strings, secrets, and hardening before any production use.





















