Files
boc/aamos-ledger-rust
Bernt 05ed037fe8 pilot.landvex.com: HTTPS + Full Stack Verified
- DNS: pilot.landvex.com -> 16.170.83.169
- TLS: Let's Encrypt certificate (expires 2026-09-30)
- Nginx: reverse proxy with SSL termination
- API: https://pilot.landvex.com/api/v1/missions
- UI: https://pilot.landvex.com/
- Upload: POST /api/v1/missions/import (multipart/form-data)

Verified:
 https://pilot.landvex.com/health
 https://pilot.landvex.com/version
 https://pilot.landvex.com/api/v1/missions (list)
 https://pilot.landvex.com/api/v1/missions/:id (get)
 POST /api/v1/missions/import (video upload)
 UI loads with title 'LandveX Intelligence Lab'

Next: Pilot 001 — Break the system!
2026-07-02 17:34:19 +00:00
..

aamos-ledger-rust

En Rust-prototyp för aamos-ledger med följande funktionalitet:

Funktioner

  • Konton (Accounts) - CRUD för konton med kod, namn och kontotyp
  • Verifikat (Journal Entries) - Bokföringsverifikat med journalrader
  • Dubbel bokföring - Debet/kredit-validering
  • Rapporter - Trial balance (saldoöversikt)
  • JWT-autentisering - Skyddade endpoints

Teknikstack

  • tokio - Async runtime
  • axum - Web framework
  • sqlx - PostgreSQL-anslutning med compile-time query checking
  • serde - Serialisering
  • jsonwebtoken - JWT-hantering
  • tracing - Logging

Komma igång

1. PostgreSQL

# Skapa databas
createdb aamos_ledger

2. Miljövariabler

cp .env.example .env
# Redigera .env med dina inställningar

3. Bygg och kör

cargo run

Servern startar på http://0.0.0.0:3000

API Endpoints

Publika endpoints

Metod Endpoint Beskrivning
GET /health Hälsokontroll
POST /login Logga in (username + password)

Skyddade endpoints (kräver JWT)

Metod Endpoint Beskrivning
GET /accounts Lista alla konton
POST /accounts Skapa nytt konto
GET /accounts/:id Hämta konto efter ID
GET /journal-entries Lista verifikat
POST /journal-entries Skapa nytt verifikat
GET /journal-entries/:id Hämta verifikat med rader
GET /trial-balance Saldoöversikt

Exempelanrop

Logga in

curl -X POST http://localhost:3000/login \
  -H "Content-Type: application/json" \
  -d '{"username":"admin","password":"password"}'

Skapa konto

curl -X POST http://localhost:3000/accounts \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <token>" \
  -d '{"code":"7000","name":"Kontorsmaterial","account_type":"Expense"}'

Skapa verifikat

curl -X POST http://localhost:3000/journal-entries \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <token>" \
  -d '{
    "entry_number":"V001",
    "description":"Försäljning kontant",
    "entry_date":"2025-01-15T00:00:00Z",
    "lines":[
      {"account_id":"<kassa-id>","debit":"1000.00","credit":null},
      {"account_id":"<försäljning-id>","debit":null,"credit":"1000.00"}
    ]
  }'

Hämta trial balance

curl http://localhost:3000/trial-balance \
  -H "Authorization: Bearer <token>"

Standardkonton

Databasen seedas med svenska BAS-konton:

  • 1000 Kassa (Tillgång)
  • 1500 Bankkonto (Tillgång)
  • 2000 Leverantörsskulder (Skuld)
  • 2400 Moms skuld (Skuld)
  • 3000 Försäljning (Intäkt)
  • 4000 Varukostnad (Kostnad)
  • 5000 Lönekostnad (Kostnad)
  • 6000 Hyra (Kostnad)