A small core-banking system with a decision layer, built after a one-month observation internship in a bank branch in Tangier, Morocco.
The branch runs an internal application its staff call SIOB — Système d'Information des Opérations Bancaires. From the outside it looks like a form with a lot of fields. What makes it a banking system is not the form: it is the three controls wrapped around every sensitive operation, and the fact that the numbers on the manager's dashboard are the same numbers the teller typed in.
SIOB-Lite reproduces that, small but complete:
- Separation of duties (maker–checker) — the agent who initiates a sensitive operation cannot be the one who validates it. Nothing is posted to an account until a second agent signs off.
- Role-based access control — teller, account manager, branch director and IT administrator all open the same application and see different things, because permissions are a matrix in the code, not screens hidden by CSS.
- Audit trail — every sensitive action is journalled, and the journal is
append-only in the database: a trigger rejects
UPDATEandDELETE, so not even the application can rewrite history.
On top of that operational core sits a decision layer: SQL views aggregate the transactional data into the KPIs a branch director actually looks at — deposits and loan outstandings, portfolio quality, the credit pipeline, helpdesk SLA compliance.
All data in this repository is synthetic, generated locally by a seeded pseudo-random generator. No real customer, colleague, figure or document from the bank appears anywhere in this project.
| Decision dashboard | Teller desk |
|---|---|
![]() |
![]() |
| Validation queue (maker–checker) | Credit file & amortisation |
|---|---|
![]() |
![]() |
More in docs/captures/.
| Layer | Technology |
|---|---|
| Database | PostgreSQL 16 — enums, CHECK constraints, triggers, analytical views |
| API | Node 22, Express 4, TypeScript (strict), Zod, JWT, bcrypt |
| Front end | Vue 3 (Composition API), TypeScript, Pinia, Vue Router, Vite, Chart.js |
| Tests | Vitest — unit + integration against a real PostgreSQL database |
Money is stored and computed as integer centimes (BIGINT), never floats.
0.1 + 0.2 !== 0.3 in IEEE-754, and a bank cannot absorb that.
# 1. Database
docker compose up -d db
# 2. API
cd server
cp .env.example .env
npm install
npm run db:reset # creates the `siob` schema
npm run db:seed # ~180 clients, ~7 000 operations, 72 credit files
npm run dev # http://localhost:4000
# 3. Front end (in another terminal)
cd web
npm install
npm run dev # http://localhost:5173Password for all of them: siob2026
| Matricule | Role | What changes |
|---|---|---|
C001 |
Teller | Can initiate operations, never validate them |
K001 |
Account manager | Adds client onboarding and credit origination |
D001 |
Branch director | Validates operations, advances credit files, reads the audit log |
S001 |
IT administrator | Read-only on the business, full read on the audit log and the helpdesk |
Log in as C001, book a 30 000 MAD external transfer, then log in as D001 to
validate it — and notice that logging back in as C001 will not let you validate
your own operation.
server/src/modules/operations.service.ts
Sensitive operations (any outgoing transfer, any cash movement above the branch
threshold) are stored with status EN_ATTENTE_VALIDATION. No ledger entry is
written and no balance moves until a second user validates. The rule is
enforced three times, on purpose:
- in the UI, which greys out operations you initiated yourself;
- in the service, which raises
SEPARATION_DES_TACHES; - in the database, via
CHECK (validee_par IS NULL OR validee_par <> initiee_par).
A control that exists only in the interface is not a control.
Every posted operation writes ecritures rows (debit/credit) and updates the
account balance, in one transaction. The view v_controle_integrite returns
every account whose stored balance disagrees with the sum of its entries — it
must always return zero rows, and the dashboard displays that check as a
first-class indicator.
server/src/modules/credits.service.ts
A state machine reproducing the circuit described in the branch:
DEMANDE → INSTRUCTION → AVIS_RISQUE → VALIDATION_JURIDIQUE → ACCORDE → DEBLOQUE → SOLDE
└──────────┴──────────────┴───────────────────┴──▶ REJETE
Each transition requires a specific permission, is recorded in credit_etapes
with its actor and timestamp, and cannot skip a step. Disbursement generates the
amortisation schedule and credits the customer account as a traced operation.
server/src/lib/amortissement.ts
Three profiles, matching real products:
- Constant annuity (monthly / quarterly) — consumer and investment loans.
- In fine, after harvest — the agricultural campaign loan. The farmer repays once, when the crop is sold; the repayment follows the season, not the calendar. This is the product that makes an agricultural bank different from any other bank.
The engine works in integer centimes and lets the final instalment absorb the rounding residue, so this invariant holds exactly:
principal = Σ capital instalments (and the final outstanding is 0)
A property test checks it on 500 randomly generated parameter sets.
SQL views (v_kpi_agence, v_operations_par_jour, v_encours_par_type_credit,
v_taux_impayes, v_activite_utilisateur, v_incidents_sla) hold the
definitions. The API serves them, the dashboard draws them. There is exactly one
definition of "outstanding" in the system, and it lives in the database.
Chart colours come from a palette validated for colour-vision deficiency; every series carries a legend and a label, so colour is never the only carrier of meaning.
cd server
createdb siob_test # or: docker compose exec db createdb -U siob siob_test
npm test31 tests over three suites:
amortissement.test.ts— schedule invariants, including a 500-case property testrbac.test.ts— the permission matrix and the double-validation thresholdoperations.integration.test.ts— runs against a real PostgreSQL: maker–checker, provision checks, audit trail, append-only enforcement, ledger integrity
The integration suite deliberately does not mock the database. The most important guarantees of this project live in PostgreSQL; a test with a fake database would prove nothing about them.
siob-lite/
├── server/
│ ├── src/
│ │ ├── db/schema.sql # tables, constraints, triggers, analytical views
│ │ ├── db/seed.ts # deterministic synthetic data generator
│ │ ├── lib/ # amortisation engine, RBAC matrix, audit, money
│ │ ├── middleware/ # JWT auth, permission guard, error translation
│ │ └── modules/ # clients, accounts, operations, credits, dashboard
│ └── tests/
├── web/
│ └── src/
│ ├── views/ # login, dashboard, teller, validation queue, …
│ ├── components/Graphe.vue # Chart.js wrapper with shared chart defaults
│ └── palette.ts # validated visualisation palette
└── docs/
├── architecture.md # design decisions and diagrams
├── rapport-chapitre.md # French write-up for the internship report
└── captures/
Aimad Eddine Slimani — computer engineering student (GINF), ENSA Tanger, Université Abdelmalek Essaâdi.
Built after an observation internship at a bank branch in Tangier, August 2026, as a way of turning what I watched at the counter into something I could build and test myself.



