Skip to content

rett-europe/opentreasury

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

52 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

OpenTreasury

Open-source treasury management application for NGOs. Helps administrative staff track bank transactions, income, and expenses with categories, subcategories, and tags for proper financial oversight.

Designed to be extensible β€” any non-profit organization can fork, configure, and deploy to their own Azure subscription.

Architecture

Layer Technology Hosting
Frontend Angular 19+, Angular Material, MSAL Angular Azure Static Web Apps (Free)
Backend Python FastAPI, async Cosmos DB SDK Azure App Service B1
Database Azure Cosmos DB NoSQL (Serverless) ~€1-5/month
Auth Microsoft Entra ID (your tenant) Employees only
IaC Bicep GitHub Actions

Estimated monthly cost: ~€20-25

graph TD
    Users["πŸ‘€ Users"] -->|HTTPS| SWA
    SWA -->|"Bearer token"| API
    API -->|"async SDK"| Cosmos
    API -.->|secrets| KV
    API -.->|telemetry| AI

    SWA["Azure Static Web Apps<br/>Angular SPA + Entra ID Login<br/><i>Free tier</i>"]
    API["App Service B1<br/>Python FastAPI<br/>+ Managed Identity"]
    KV["Key Vault"]
    AI["App Insights"]

    subgraph CosmosDB["Cosmos DB NoSQL Β· Serverless"]
        T["transactions"]
        C["categories"]
        R["reference_data"]
        A["audit_log"]
    end
    Cosmos --- T
    Cosmos --- C
    Cosmos --- R
    Cosmos --- A
    Cosmos["Cosmos DB Account"]

    style Users fill:#f3e5f5,stroke:#ce93d8,color:#4a148c
    style SWA fill:#e8d5f5,stroke:#b39ddb,color:#4a148c
    style API fill:#d7c4e8,stroke:#9575cd,color:#311b92
    style Cosmos fill:#c5e1a5,stroke:#aed581,color:#33691e
    style CosmosDB fill:#f1f8e9,stroke:#c5e1a5,color:#33691e
    style T fill:#fff9c4,stroke:#fff176,color:#f57f17
    style C fill:#fff9c4,stroke:#fff176,color:#f57f17
    style R fill:#fff9c4,stroke:#fff176,color:#f57f17
    style A fill:#fff9c4,stroke:#fff176,color:#f57f17
    style KV fill:#fce4ec,stroke:#f48fb1,color:#880e4f
    style AI fill:#e0f7fa,stroke:#80deea,color:#006064
Loading

Project Structure

opentreasury/
β”œβ”€β”€ frontend/          Angular 19 app (standalone components, MSAL auth)
β”œβ”€β”€ api/               Python FastAPI backend
β”‚   └── tests/         Backend test suite (pytest)
β”œβ”€β”€ infra/             Bicep IaC (Cosmos DB, App Service, SWA, Key Vault, App Insights)
β”‚   β”œβ”€β”€ modules/       Reusable Bicep modules
β”‚   └── parameters/    Environment-specific parameter files (dev, prod)
β”œβ”€β”€ docs/              Architecture docs, feature specs, security reviews
β”œβ”€β”€ scripts/           Azure setup and teardown scripts
β”œβ”€β”€ .github/workflows/ CI/CD pipelines + Squad automation
└── .squad/            AI team state (Squad coordination)

Deploy to Your Azure

OpenTreasury is built for any organization to run on their own Azure subscription. Your data stays in your account β€” you own it completely.

Estimated cost: €15-25/month for a small organization.

What you'll need:

  • An Azure subscription
  • Admin access to your Microsoft Entra ID tenant
  • A private GitHub repository

Get started:

  1. Copy the contents of deploy-template/ to a new private repo
  2. Follow the step-by-step Deployment Guide
  3. Run the setup script, configure GitHub, and trigger the workflow β€” done!

Most organizations are up and running in about an hour.

Prerequisites

  • Node.js 20+
  • Python 3.11+
  • Angular CLI (npm install -g @angular/cli)
  • Azure CLI (for deployment)

Quick Start

Frontend (with mock data β€” no backend needed)

cd frontend
npm install
npx ng serve

Open http://localhost:4200 β€” logs in as a mock Admin user with 25 sample transactions.

The frontend runs with mock data by default (useMocks: true in environment.ts). All API calls are intercepted and return realistic sample data. To connect to a real backend, see Connecting Frontend to Backend.

Backend

cd api
python -m venv .venv
# Windows:
.venv\Scripts\activate
# macOS/Linux:
source .venv/bin/activate

pip install -r requirements.txt
cp .env.example .env
# Edit .env with your Azure credentials

uvicorn app.main:app --reload --port 8000

API docs at http://localhost:8000/api/docs (Swagger UI, dev only β€” disabled in production).

Connecting Frontend to Backend

In frontend/src/environments/environment.ts, set:

useMocks: false,
apiBaseUrl: 'http://localhost:8000/api',

And configure the MSAL settings with your Entra ID app registration.

Environment Variables (Backend)

Variable Description Example
AZURE_TENANT_ID Entra ID tenant xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
AZURE_CLIENT_ID Backend app registration client ID xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
COSMOS_ENDPOINT Cosmos DB account endpoint https://cosmos-opentreasury.documents.azure.com:443/
COSMOS_DATABASE_NAME Database name opentreasury

Features

MVP

  • βœ… Transaction entry with categories, subcategories, and tags
  • βœ… Multi-account support (4 bank accounts + PayPal)
  • βœ… "Guardar y Nuevo" flow for fast daily data entry (~15s per transaction)
  • βœ… Transaction search and filtering (account, date, category, tag, text)
  • βœ… Category/subcategory management
  • βœ… Tag management
  • βœ… Bank account management
  • βœ… Excel/CSV import from bank exports
  • βœ… Excel export for accounting firm
  • βœ… Dashboard with account balances and monthly summary
  • βœ… Multi-language support (Spanish + English)
  • βœ… RBAC: Admin (full access) / Viewer (read-only)
  • βœ… Audit trail on all changes
  • βœ… Soft deletes (financial data is never permanently lost)

Planned

  • Invoice file attachments
  • PowerBI analytics integration
  • Multi-currency support

RBAC

Role Access
Admin Full read/write. Manages transactions, categories, tags, accounts.
Viewer Read-only. Views transactions, reports, exports. Board members.

Roles are assigned via Entra ID app roles.

Cosmos DB Containers

Container Partition Key Purpose
transactions /partitionKey ("YYYY-MM") Financial transactions
categories /id Categories with embedded subcategories
reference_data /type Tags + bank accounts
audit_log /entityType Audit trail (7-year TTL)

License

Apache License 2.0 β€” see LICENSE.

Contributing

See CONTRIBUTING.md for development setup, code style, and PR process.

Documentation

About

Financial clarity for NGOs, transparent finance for organizations that matter.

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors