Add CLAUDE.md - AI context for aamos-ledger
This commit is contained in:
@@ -0,0 +1,119 @@
|
||||
# CLAUDE.md — aamos-ledger (services/aamos-ledger)
|
||||
> AI-kontext för alla som jobbar med bokföringsmotorn.
|
||||
|
||||
## Vad är detta?
|
||||
|
||||
**aamos-ledger** är LandveX AB:s egenutvecklade bokföringsmotor.
|
||||
- Dubbel bokföring (debet = kredit alltid)
|
||||
- BAS 2024 kontoplan (svensk standard)
|
||||
- SIE4-import och export
|
||||
- Multi-tenant (tenant_id på varje rad)
|
||||
- Full audit trail (ledger_audit_log)
|
||||
- Hermes event-publicering
|
||||
- Auth via JWT (identity-service)
|
||||
|
||||
**Port:** 3250
|
||||
**Tenant:** `landvex`
|
||||
**systemd:** `aamos-ledger`
|
||||
**Path på server:** `/opt/amos/services/aamos-ledger/`
|
||||
|
||||
---
|
||||
|
||||
## Filer
|
||||
|
||||
| Fil | Beskrivning |
|
||||
|-----|-------------|
|
||||
| `index.mjs` | Express-app, alla API-routes |
|
||||
| `schema.sql` | PostgreSQL-schema (kör vid start) |
|
||||
| `schema-reconciliation.sql` | Schema för reconciliation |
|
||||
| `hermes.mjs` | Event-publishing |
|
||||
| `sie4-export.mjs` | SIE4-exportlogik |
|
||||
| `reconciliation.mjs` | Kontoavstämning (E1-004) |
|
||||
| `period-workflow.mjs` | Periodeclose (E1-005) |
|
||||
| `auth.mjs` | JWT-validering |
|
||||
| `seed-bas2024.mjs` | Seed BAS 2024 kontoplan |
|
||||
|
||||
---
|
||||
|
||||
## API
|
||||
|
||||
Tenant sätts via header `X-Tenant-ID: landvex` eller query `?tenant=landvex`.
|
||||
Auth: JWT Bearer token.
|
||||
|
||||
```
|
||||
GET /health
|
||||
GET /api/accounts?tenant=landvex
|
||||
POST /api/journal-entries
|
||||
GET /api/periods?tenant=landvex
|
||||
POST /api/sie4/export
|
||||
GET /api/trial-balance?tenant=landvex
|
||||
POST /api/reconciliation/items
|
||||
POST /api/period-close/initiate
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Principer (OBRYTBARA)
|
||||
|
||||
1. **Determinism** — alla beslut reproducerbara
|
||||
2. **Audit First** — VARJE operation → auditpost
|
||||
3. **Tenant Isolation** — tenant_id filtreras alltid
|
||||
4. **IMMUTABLE journal** — posted = oföränderligt; annullering = ny voided-post
|
||||
5. **Hermes events** — alla ekonomiska händelser publiceras
|
||||
|
||||
---
|
||||
|
||||
## Etapp 1 — Vertikal stängning (pågår 2026-06)
|
||||
|
||||
- [x] Chart of Accounts (BAS 2024)
|
||||
- [x] Journal Entries med audit trail
|
||||
- [x] SIE4-import
|
||||
- [ ] E1-004 Reconciliation Engine
|
||||
- [ ] E1-005 Period Close Workflow
|
||||
- [ ] E1-006 SIE4 Export (komplett)
|
||||
- [ ] Auth mot Identity Service
|
||||
- [ ] E1-008 Vertikal stängning acceptanstest
|
||||
|
||||
---
|
||||
|
||||
## LandveX AB — Nuläge (2026-06-17)
|
||||
|
||||
| Mått | Värde |
|
||||
|------|-------|
|
||||
| Journalposter | ~710 (alla posted) |
|
||||
| Obalanserade | 0 |
|
||||
| Oklassificerade (konto 1689) | ~545 poster / 966 685 kr |
|
||||
| Q1-moms | 202 787 kr OBETALD |
|
||||
| Leon-fordran | 212 922 kr (konto 1610) |
|
||||
| Trygg Bil-avtal | 222 916 kr/mån t.o.m. mars 2027 |
|
||||
|
||||
---
|
||||
|
||||
## UI (Fortnox-klonen)
|
||||
|
||||
- https://landvex.com/ouroboros/finance/ — Fortnox-klonen
|
||||
- https://landvex.com/ouroboros/finance/ledger.html — Verifikatsvy
|
||||
- https://landvex.com/public/cfo-dashboard.html — CFO-dashboard
|
||||
|
||||
Filer: `/opt/amos/public/ouroboros/finance/`
|
||||
|
||||
---
|
||||
|
||||
## Drift
|
||||
|
||||
```bash
|
||||
# Status
|
||||
sudo -n systemctl status aamos-ledger
|
||||
sudo -n journalctl -u aamos-ledger -n 50
|
||||
|
||||
# Restart
|
||||
sudo -n systemctl restart aamos-ledger
|
||||
|
||||
# Health
|
||||
curl -s http://localhost:3250/health
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
*Senast uppdaterad: 2026-06-17*
|
||||
|
||||
Reference in New Issue
Block a user