FastAPI backend for real-time AML monitoring with AI-powered document analysis.
✅ Ready to Run - No external dependencies required!
- Using in-memory mock data (no MongoDB needed yet)
- Using simulated AI responses (no Groq API needed yet)
- Fully functional REST API
- CORS configured for frontend integration
- Dashboard API: Summary statistics, alerts, transaction volumes
- Alert Management: Detailed alert information, remediation
- Transaction Analysis: Volume trends, historical data
- Audit Trail: Complete activity logging
- Mock AI Agents: Simulated multi-agent analysis
- Python 3.9+ installed
- pip package manager
- Navigate to the backend directory:
cd backend- Create a virtual environment:
python -m venv venv
# On Windows:
venv\Scripts\activate
# On Mac/Linux:
source venv/bin/activate- Install dependencies:
pip install -r requirements.txt- Run the server:
python main.pyOr using uvicorn directly:
uvicorn main:app --reload --host 0.0.0.0 --port 8000- Open your browser:
- API: http://localhost:8000
- Interactive Docs: http://localhost:8000/docs
- Alternative Docs: http://localhost:8000/redoc
GET /api/alerts/summary- Dashboard KPIs and statisticsGET /api/alerts/active- List of active alertsGET /api/alerts/{alert_id}- Detailed alert informationPOST /api/alerts/{alert_id}/remediate- Mark alert as remediated
GET /api/transactions/volume- Transaction volume trendGET /api/transactions/history/{client_id}- Client transaction history
GET /api/audit-trail/{alert_id}- Audit trail for specific alert
GET /- API informationGET /health- Health check
backend/
├── main.py # FastAPI application entry point
├── config.py # Configuration settings
├── requirements.txt # Python dependencies
├── models/
│ └── schemas.py # Pydantic models
├── services/
│ ├── database.py # Database service (mock)
│ └── mock_data.py # Mock data for development
└── api/
└── routes/
├── alerts.py # Alert endpoints
├── transactions.py # Transaction endpoints
└── audit.py # Audit trail endpoints
# Get dashboard summary
curl http://localhost:8000/api/alerts/summary
# Get active alerts
curl http://localhost:8000/api/alerts/active
# Get specific alert details
curl http://localhost:8000/api/alerts/ALT-788
# Get transaction volume
curl http://localhost:8000/api/transactions/volumeVisit http://localhost:8000/docs to use the built-in Swagger UI for testing all endpoints.
The backend is configured to accept requests from http://localhost:3000 by default.
To test with the frontend:
- Start the backend:
python main.py(runs on port 8000) - Start the frontend:
cd frontend && npm run dev(runs on port 3000) - Frontend will automatically connect to the backend API
When ready to add MongoDB:
# Install MongoDB dependencies
pip install motor pymongo
# Update .env file
MONGODB_URL=mongodb://localhost:27017
DATABASE_NAME=julius_baer_amlThen uncomment the MongoDB code in services/database.py
When ready to add Groq AI:
# Install Groq
pip install groq
# Update .env file
GROQ_API_KEY=your_actual_groq_api_keyCreate agent files in agents/ directory for real AI analysis.
For real-time alerts:
pip install websocketsAdd WebSocket endpoint in main.py for live updates.
Create a .env file (optional for now):
CORS_ORIGINS=http://localhost:3000- The API auto-reloads when you make changes (using
--reloadflag) - Check logs in the terminal for debugging
- Use
/docsendpoint to explore and test all APIs - Mock data is defined in
services/mock_data.py- customize as needed
When ready for production:
- Add MongoDB connection
- Add Groq API integration
- Add authentication/authorization
- Configure environment variables
- Use production ASGI server (Gunicorn + Uvicorn)
- Set up proper logging and monitoring
Proprietary - Julius Baer