The Middle East's first zero-effort micro-investment and spending & habits tracker Platform.
Turn your spare change into a growing portfolio, automatically, the moment you spend.
Track every transaction, understand your spending habits, get AI-powered advice, and replace bad habits with wealth-building ones.
- π‘ What is Fakka?
- β¨ Features
- ποΈ Architecture Overview
- βοΈ Technical Design Notes
- π οΈ Tech Stack
- π Getting Started
- π Project Structure
- π Environment Variables
- π° Monetization Model
- π§ͺ Running Tests
- π Available Scripts
- π Security & Compliance
- πΊοΈ Roadmap
Fakka (ΩΩΨ©) is a Sharia-compliant micro-investment and tracker for Spending & Habits that automatically rounds up every purchase you make to the nearest pound and invests the difference, the spare change you never notice, into a diversified portfolio of Gold, Index Funds, and High-Risk assets.
You buy a coffee for EGP 47. Fakka rounds it up to EGP 50, sweeps the EGP 3 in spare change, deducts a tiny platform fee, and immediately allocates it into your portfolio. No decision required. No minutes wasted. Your wealth builds itself.
The Middle East and North Africa (MENA) region has one of the highest unbanked and under-invested populations in the world. Millions of people lack access to wealth-building tools that are taken for granted in the West.
- No similar product exists in the Middle East. Fakka is the first of its kind in the region.
- Sharia-compliant by design, no interest (Riba), no speculation, following Mudarabah (profit-sharing) principles.
- No financial literacy required. Zero minutes needed to start building wealth, just spend as you normally do.
- Designed for families and communities, not just individuals.
- Register once. Link your bank account once and Fakka handles the rest, forever.
- Automatic Round-Up Engine: Every transaction is rounded up to the nearest step. Spare change is swept and invested automatically without any user interaction.
- No time investment required. Your portfolio grows in the background while you live your life.
- Full transaction history with merchant-level breakdown.
- Spending pattern analysis: Fakka identifies your recurring habits (coffee, cigarettes, dining out) and shows you their true long-term cost.
- AI-powered emotional nudges: Personalized insights generated by Azure OpenAI that reveal the opportunity cost of bad habits and celebrate your progress.
- The AI Emotional Engine monitors your merchant tags and surfaces patterns you didn't know you had.
- Every time you spend on a tracked habit, you see exactly how much wealth you could have built instead.
- Positive reinforcement mechanics to keep you motivated and invested (literally).
- Define a personal financial goal (e.g., EGP 50,000 for a car down payment).
- Fakka tracks your progress and automatically routes your round-ups toward it.
- Visual goal progress dashboard with real-time updates.
- Shared Profiles: Create a group with family or friends under one unified digital wallet.
- Every member's transactions contribute to the shared portfolio, multiplying the compounding power.
- Mutual Goals: Set a collective target, a family vacation, an emergency fund, a property, and work toward it together automatically.
- One wallet, many contributors, unlimited potential.
- Sharia-compliant asset allocation (24/75/1 rule):
- 24% Gold, Inflation hedge, stable store of value.
- 75% Index Funds, Broad market exposure, long-term compounding.
- 1% High-Risk, High upside for the fearless portion of your portfolio.
- Risk profiles (Conservative, Default, Aggressive) let power users customize their allocation.
- Real-time portfolio valuation via live price feeds.
- No hidden fees. Fakka charges:
- A small Fund Fee (0.5% β 0.01%) on deposits, decreasing as your AUM grows.
- A Profit Fee (1.5% β 1%) only on gains, never on your capital.
- You only pay more when you earn more. We win when you win.
- Full ledger visibility, every fee is shown as a separate, auditable line item.
- Live balance updates pushed instantly via Server-Sent Events (SSE).
- Watch your portfolio grow in real time with every sweep.
- Price feed updates reflect current market valuations of your holdings.
Fakka's backend is a NestJS monolith with a clean, domain-driven architecture designed for financial precision.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Fakka Backend β
β β
β ββββββββββββββββββ ββββββββββββββββ ββββββββββββββββββ β
β β Bank Webhook ββββΆβ Round-Up ββββΆβ Fee Engine β β
β β Gateway β β Engine β β (0.5% Fund) β β
β β [MockBankAPI] β ββββββββββββββββ ββββββββββββββββββ β
β ββββββββββββββββββ β β
β βΌ β
β ββββββββββββββββββ ββββββββββββββββ ββββββββββββββββββ β
β β AI Emotional β β Ledger βββββ Asset Allocatorβ β
β β Engine β β (Audit) β β 24/75/1 Rule β β
β ββββββββββββββββββ ββββββββββββββββ ββββββββββββββββββ β
β β β β
β βΌ βΌ β
β ββββββββββββββββββ ββββββββββββββββββ β
β β SSE Service β β Digital Wallet β β
β β (Live Push) β β (BigInt / OCC) β β
β ββββββββββββββββββ βββββββββ¬βββββββββ β
β β β
β βΌ β
β ββββββββββββββββββ β
β β Investment β β
β β Engine β β
β β [MockExchangeAPIβ β
β β for pricing] β β
β ββββββββββββββββββ β
β β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Note on Mocked APIs: For development and demo purposes, both the Bank and Exchange integrations are mocked:
MockBankAPIβ simulates open banking webhooks (transaction events) and fund collection requests.MockExchangeAPIβ simulates live market prices for Gold, Index Funds, and High-Risk assets using a compound growth model (~40% APY). These will be replaced with real open banking and exchange connections in production.
| Principle | Implementation |
|---|---|
| Financial Precision | All monetary values stored as BigInt (Piasters), never floats |
| Sharia Compliance | Mudarabah model: profit-sharing fees, no interest |
| Audit Trail | Double-entry ledger for every financial movement |
| Concurrency Safety | Optimistic Concurrency Control (OCC) on DigitalWallet |
| Anti-Corruption Layer | Ports & Adapters pattern isolating domain from bank/exchange APIs |
| Event-Driven | @nestjs/event-emitter decouples modules, no circular dependencies |
| Domain Safety | Money Value Object for all arithmetic, no raw math allowed |
All monetary values in Fakka are stored in the database as BigInt (smallest currency unit β Piasters for EGP, i.e. 1 EGP = 100 Piasters). This completely eliminates floating-point rounding errors.
Inside the application domain, money is never treated as a raw number. Instead, it is always wrapped in a Money Value Object with the following shape:
class Money {
amount: bigint; // e.g. 4700n = EGP 47.00
currency: Currency; // e.g. Currency.EGP
denomination: major | minor; // e.g. 100 (100 piasters = 1 EGP)
// Dedicated, safe arithmetic methods
add(other: Money): Money;
subtract(other: Money): Money;
multiply(bps: bigint): Money; // uses Basis Points for rate math
isGreaterThan(other: Money): boolean;
toHuman(): string; // "47.00 EGP"
}Raw arithmetic directly on
BigIntornumberis strictly forbidden in the domain layer. All financial math goes through these dedicatedMoneymethods, enforced by code review and linting.
High-frequency events (multiple simultaneous round-ups, concurrent deposits, parallel price feed updates) can cause wallet balances to become inconsistent if not handled carefully. Fakka prevents this with Optimistic Concurrency Control (OCC):
- Every
DigitalWalletrow carries aversioninteger. - Any update to a wallet must include a
WHERE version = :currentVersionclause. - If two concurrent operations try to update the same wallet simultaneously, only one will succeed β the other will detect the version mismatch and retry.
- This guarantees no double-credits, no double-debits, and no silent data corruption under load, without the performance penalty of pessimistic row-level locks.
| Layer | Technology |
|---|---|
| Runtime | Node.js 20 |
| Framework | NestJS 11 |
| Database | PostgreSQL (via Prisma 7) |
| ORM | Prisma Client (BigInt-safe) |
| AI Engine | Azure OpenAI (GPT) |
| Real-Time | Server-Sent Events (SSE) |
| Validation | class-validator + class-transformer |
| Scheduling | @nestjs/schedule (cron jobs) |
| Deployment | Docker β Azure Container Apps |
Make sure you have the following installed:
- Node.js v20+
- npm v10+
- PostgreSQL v15+ (running locally or via Docker)
- Docker (optional, for containerized setup)
git clone <repo-url>
cd backendnpm installCopy the example environment file and fill in your values:
cp .env.example .envSee the Environment Variables section for the full reference.
Run Prisma migrations to create all tables:
npm run db:migrate:devThis will:
- Apply all schema migrations to your PostgreSQL database.
- Generate the Prisma client with full TypeScript types.
If you just want to push the schema without creating a migration file (e.g., for rapid prototyping):
npm run prisma:pushBrowse your database visually:
npm run prisma:studioDevelopment mode (with hot reload):
npm run start:devProduction mode (after build):
npm run build
npm run start:prodThe API will be available at:
http://localhost:8000/api/v1
Build and run the container:
docker build -t fakka-backend .
docker run -p 8000:3000 --env-file .env fakka-backendbackend/
βββ src/
β βββ app/ # App module & bootstrapping
β βββ common/ # Shared infrastructure
β β βββ constants/ # BPS rates, allocation rules
β β βββ domain/ # Money Value Object, Currency Registry
β β βββ events/ # Typed event payloads
β β βββ filters/ # GlobalExceptionFilter
β β βββ helpers/ # Response envelope (ok())
β β βββ interfaces/ # I_BANK_PROVIDER, I_EXCHANGE_PROVIDER ports
β β βββ repositories/ # BaseRepository (ACL)
β βββ database/ # Prisma service & configuration
β βββ external-api/ # Mock Bank & Exchange API adapters
β βββ modules/
β βββ ai-insights/ # AI emotional engine (Azure OpenAI)
β βββ bank-integration/ # Webhook gateway + funds collection
β βββ exchange-integration/# MockExchangeAPI adapter
β βββ fee/ # Fee Engine (fund fee + profit fee)
β βββ investment/ # Asset allocation + redemption
β βββ ledger/ # Double-entry ledger service
β βββ price-feed/ # Market price scheduler & broadcaster
β βββ profiles/ # Profile + User aggregate root
β βββ realtime/ # SSE service
β βββ roundup-engine/ # Round-up calculator + sweep orchestrator
β βββ transaction/ # Transaction event ingestion
β βββ users/ # User settings & risk profiles
β βββ wallet/ # Digital wallet + positions
βββ prisma/
β βββ schema.prisma # Full DB schema (BigInt-safe)
β βββ migrations/ # Versioned SQL migrations
βββ docs/ # Architecture & feature documentation
β βββ DEVELOPER_GUIDELINES.md
β βββ architecture-decisions/
β βββ entities.md
β βββ fees.md
β βββ user-stories.md
β βββ ...
βββ infra/ # Azure / deployment infrastructure
βββ .env.example # Environment template
βββ Dockerfile # Multi-stage production build
βββ package.json
All configuration is driven by environment variables. Copy .env.example to get started:
cp .env.example .env.env.example:
# βββ Server ββββββββββββββββββββββββββββββββββββββββββββββββ
# Enviroment
NODE_ENV=development
# App
HOST=http://localhost
PORT=5001
API_VERSION=api/v1
BASE_URL=http://localhost:5001/api/v1
DB_URI=postgresql://postgres:postgres@host:port/DataBase
# System API URLs
SYSTEM_TRANSACTION_WEBHOOK_ROUTE=bank-integrations/transaction-webhook
# External Bank API URLs
MOCK_BANK_ROUTE=mock-bank
MOCK_BANK_SIMULATE_TRANSACTION=mock-bank/simulate-transaction
MOCK_BANK_DEBIT_ROUTE=mock-bank/debits
MOCK_BANK_DEPOSIT_ROUTE=mock-bank/deposits
# External Exchange API URLs
MOCK_EXCHANGE_ROUTE=mock-exchange
MOCK_EXCHANGE_PRICES=mock-exchange/prices
MOCK_EXCHANGE_BUY=mock-exchange/buy
MOCK_EXCHANGE_SELL=mock-exchange/sell
MOCK_EXCHANGE_SET_PRICES=mock-exchange/set-prices
# Default values - Major unit
DEFAULT_ROUND_UP_STEP=10
# GitHub Models
GITHUB_TOKEN=ghp_Fakka-your-token-here
AI_MODEL=gpt-4.1Fakka operates on a Mudarabah (profit-sharing) model, fully Sharia-compliant:
| Portfolio Size | Fee |
|---|---|
| Up to EGP 1,000 | 0.5% |
| Up to EGP 10,000 | 0.4% |
| Up to EGP 100,000 | 0.3% |
| Up to EGP 1,000,000 | 0.2% |
| Up to EGP 10,000,000 | 0.1% |
| Up to EGP 100,000,000 | 0.05% |
| Beyond | 0.01% |
| Profit Level | Fee |
|---|---|
| Up to EGP 10,000 | 1.5% |
| Up to EGP 100,000 | 1.4% |
| Up to EGP 1,000,000 | 1.3% |
| Up to EGP 10,000,000 | 1.2% |
| Up to EGP 100,000,000 | 1.1% |
| Beyond | 1.0% |
We only win when you win. No profit for Fakka unless your portfolio grows.
# Unit tests
npm run test
# Watch mode
npm run test:watch
# Coverage report
npm run test:cov
# End-to-end tests
npm run test:e2e| Script | Description |
|---|---|
npm run start:dev |
Start with hot reload (development) |
npm run start:prod |
Start production build |
npm run build |
Compile TypeScript to dist/ |
npm run lint |
Lint and auto-fix with ESLint |
npm run format |
Format with Prettier |
npm run db:migrate:dev |
Run Prisma migrations (dev) |
npm run db:migrate:prod |
Deploy migrations (prod) |
npm run prisma:generate |
Regenerate Prisma client |
npm run prisma:push |
Push schema without migration |
npm run prisma:studio |
Open Prisma Studio GUI |
npm run test |
Run unit tests |
npm run test:cov |
Run tests with coverage report |
- BigInt-only arithmetic, no floating-point errors in financial calculations.
- Optimistic Concurrency Control (OCC), prevents race conditions on wallet updates.
- Double-entry ledger, every piastre is accounted for; balances are always reconcilable.
- Idempotency keys on all financial operations, safe retries, no double-charges.
- Anti-Corruption Layer, domain logic is completely isolated from external bank/exchange APIs.
- Sharia Compliance, Mudarabah profit-sharing; no Riba (interest).
- Live Open Banking integration (beyond MockBankAPI)
- Mobile app (iOS & Android)
- Expanded asset classes (Sukuk, REITs)
- Goal-based savings plans with automatic rebalancing
- Multi-currency support (SAR, AED, KWD)
- MENA regional expansion (Saudi Arabia, UAE, Kuwait)
- Regulatory licensing (Egyptian Financial Regulatory Authority)
Tantaropic, Building the future of wealth in the Middle East.
Proprietary. All rights reserved Β© 2026 Tantaropic.
Built with β€οΈ for the people of the Middle East.
ΩΩΩΨ© Ψ΅ΨΊΩΨ±Ψ©Ψ Ψ«Ψ±ΩΨ© ΩΨ¨ΩΨ±Ψ©, Small change, big wealth.