This directory contains the core application code for Flowlet, an embedded finance platform that exposes payments, wallets, card issuance, and compliance through a unified API. The code is organized into two primary areas: the Python Flask backend services and the machine learning services that power AI-enhanced financial intelligence.
code/
├── backend/ # Core Python microservices and API layer
└── ml_services/ # Machine learning models and AI services
The backend/ directory houses the main application server built with Python and Flask. It follows a modular architecture organized by domain, with clear separation between routes, models, services, and integrations.
| Directory | Purpose |
|---|---|
app.py |
Application entry point with the create_app() factory function |
src/routes/ |
Flask Blueprints defining REST API endpoints for auth, payments, wallets, cards, compliance, and analytics |
src/models/ |
SQLAlchemy ORM models for users, accounts, transactions, cards, and ledger entries |
src/services/ |
Core business logic for payments, cards, wallets, and account management |
src/compliance/ |
KYC/AML engines, regulatory frameworks, and compliance workflows |
src/security/ |
Authentication, encryption, rate limiting, threat prevention, and password security |
src/integrations/ |
Connectors for external systems including banking (Plaid, FDX), payments (Stripe), and currency exchange |
src/analytics/ |
Dashboard services, reporting engines, real-time analytics, and metrics calculation |
src/nocode/ |
Rule engine, workflow builder, and configuration engine for dynamic business logic |
src/gateway/ |
API gateway logic for request routing and external API handling |
src/config/ |
Centralized application settings and security policies |
src/database/ |
Database utilities and connection management |
src/utils/ |
Shared utility functions and helpers |
migrations/ |
Database schema migration files |
tests/ |
Comprehensive test suite covering unit, integration, functional, API, performance, and security testing |
Development server:
cd backend
python run_server.pyWith Docker:
cd backend
docker-compose upRunning tests:
cd backend
./run_tests.shFor full backend documentation, see backend/README.md.
The ml_services/ directory contains the machine learning stack that powers real-time fraud detection, risk assessment, and intelligent financial insights. Models are built with scikit-learn, XGBoost, and LightGBM, exposed as services that the backend can call during transaction processing.
| Directory | Purpose |
|---|---|
ai_models/ |
Core AI model implementations including fraud detection, risk assessment, transaction intelligence, and support chatbot |
fraud_detection/ |
Production fraud detection pipeline with ensemble stacking, anomaly detection, and supervised models |
tests/ |
ML-specific tests for model correctness, fairness, and performance benchmarks |
The fraud detection system uses a stacked ensemble combining XGBoost, LightGBM, and Random Forest models. This architecture achieves strong performance on production transaction data.
| Metric | Value |
|---|---|
| AUC-ROC | 0.987 |
| Precision | 97.3% |
| Recall | 96.1% |
| F1 Score | 96.7% |
| Inference latency (p50) | 8 ms |
ML services are typically invoked by the backend or run as standalone inference workers. Individual models can be tested or trained by running their respective module files directly. For operational deployment, the fraud detection service in fraud_detection/service.py provides the main entry point for real-time scoring requests.
| Layer | Technology |
|---|---|
| Backend language | Python 3.11+ |
| Web framework | Flask + flask-restx |
| ORM | SQLAlchemy |
| Databases | PostgreSQL, Redis |
| Messaging | Kafka / RabbitMQ |
| ML frameworks | scikit-learn, XGBoost, LightGBM |
| Containerization | Docker |
| Testing | pytest, with unit, integration, functional, performance, and security suites |
Both backend and ML services maintain extensive test coverage. The backend test suite is organized by test type under backend/tests/, while ML service tests live under ml_services/tests/. Tests validate correctness, integration contracts, performance benchmarks, and security controls.
- Backend README - Detailed backend architecture, API routes, and configuration
- Project README - High-level project overview, installation guide, and contribution guidelines
- docs/ - Additional documentation including API reference, architecture specs, and ML performance reports