A modern, secure banking application featuring multi-layered authentication, behavioral analytics, and ML-powered fraud detection. Built with FastAPI backend and React TypeScript frontend.
- FIDO2/WebAuthn Authentication: Biometric and hardware security key support
- Seed Key Recovery: BIP39 mnemonic-based account restoration
- Multi-Factor Authentication: Phone number verification with Twilio OTP
- Device Verification: Comprehensive device fingerprinting and validation
- Behavioral Analytics: Real-time keystroke dynamics and mouse pattern analysis
- Fraud Detection: Deep learning models for transaction anomaly detection
- Adaptive Learning: User-specific behavioral models that improve over time
- Anomaly Detection: Real-time identification of suspicious user behavior
- Secure Transactions: End-to-end encrypted transaction processing
- Account Management: Multiple account types and comprehensive management
- Transaction History: Detailed transaction logs with fraud scoring
- Location Tracking: Geographic verification for enhanced security
bank-app-backend/
โโโ app/
โ โโโ api/api_v1/endpoints/ # REST API endpoints
โ โโโ core/ # Configuration and security
โ โโโ db/models/ # SQLAlchemy database models
โ โโโ schemas/ # Pydantic data validation schemas
โ โโโ services/ # Business logic layer
โ โโโ ml_models/ # Trained ML models and artifacts
โโโ main.py # FastAPI application entry point
โโโ requirements.txt # Python dependencies
โโโ docker-compose.yml # Container orchestration
bank-app-frontend/
โโโ src/
โ โโโ components/ # Reusable UI components
โ โโโ pages/ # Application pages/routes
โ โโโ context/ # React context providers
โ โโโ services/ # API communication layer
โ โโโ providers/ # Global state providers
โ โโโ utils/ # Utility functions and helpers
โโโ package.json # Node.js dependencies
โโโ vite.config.ts # Vite build configuration
- Python 3.12+
- Node.js 18+
- PostgreSQL database
- Twilio account (for SMS verification)
-
Clone and navigate to backend:
cd bank-app-backend -
Install Python dependencies:
pip install -r requirements.txt
-
Configure environment variables:
cp .env.example .env # Edit .env with your configuration -
Required environment variables:
PROJECT_NAME="Advanced Banking App" DATABASE_URL="postgresql://user:password@localhost/bankdb" BACKEND_CORS_ORIGINS="http://localhost:5173" RP_ID="localhost" RP_NAME="Advanced Banking App" ORIGIN="http://localhost:5173" TWILIO_ACCOUNT_SID="your_twilio_sid" TWILIO_AUTH_TOKEN="your_twilio_token" TWILIO_VERIFY_SERVICE_SID="your_verify_service_sid" TWILIO_PHONE_NUMBER="your_twilio_phone" PRIVATE_KEY="your_encryption_key" JWT_SECRET="your_jwt_secret"
-
Run the backend:
python main.py
The API will be available at
http://localhost:8000
-
Navigate to frontend:
cd bank-app-frontend -
Install dependencies:
npm install # or bun install -
Configure environment:
cp .env.local.example .env.local # Edit with your backend URL -
Start development server:
npm run dev # or bun devThe application will be available at
http://localhost:5173
- Framework: FastAPI (Python 3.12)
- Database: PostgreSQL with SQLAlchemy ORM
- Authentication: FIDO2/WebAuthn, JWT tokens
- ML/AI: PyTorch, scikit-learn, pandas
- Security: Cryptography, eth-account
- Communication: Twilio (SMS/OTP)
- Validation: Pydantic
- Framework: React 18 with TypeScript
- Build Tool: Vite
- UI Components: Radix UI + shadcn/ui
- Styling: Tailwind CSS
- State Management: React Context + Providers
- Routing: React Router DOM
- Cryptography: Noble crypto libraries
- Charts: Recharts
- Phone Verification: SMS OTP via Twilio
- FIDO2 Registration: Biometric or hardware security keys
- Seed Key Generation: BIP39 mnemonic phrases for recovery
- Device Fingerprinting: Hardware and software characteristics
- Keystroke Dynamics: Timing patterns between keystrokes
- Mouse Trajectory Analysis: Movement patterns and click behavior
- Typing Speed Monitoring: Words per minute analysis
- Error Pattern Recognition: Correction frequency and patterns
- Autoencoder Models: Anomaly detection in transaction patterns
- Classification Models: Binary fraud prediction
- User-Specific Models: Personalized behavioral baselines
- Real-time Scoring: Immediate fraud risk assessment
POST /api/v1/register/fido-start- Start FIDO2 registrationPOST /api/v1/register/fido-seedkey- Complete FIDO2 + seed key registrationPOST /api/v1/login/fido-start- Initiate FIDO2 loginPOST /api/v1/login/fido-finish- Complete FIDO2 login
POST /api/v1/analytics/behavior- Submit behavioral dataPOST /api/v1/ml-analytics/verify-behavior- ML anomaly detectionPOST /api/v1/ml-analytics/train-model- Train user-specific models
POST /api/v1/transactions/create- Create new transactionGET /api/v1/transactions/history- Transaction historyPOST /api/v1/transactions/verify- Fraud detection
POST /api/v1/restore/phone-start- Start account recoveryPOST /api/v1/restore/fido-seedkey- Complete recovery with seed phrase
# Backend tests
cd bank-app-backend
python -m pytest
# Frontend tests
cd bank-app-frontend
npm test# Backend linting
flake8 app/
black app/
# Frontend linting
npm run lint# Create migration
alembic revision --autogenerate -m "description"
# Apply migrations
alembic upgrade headdocker-compose up --build# Development
docker-compose -f docker-compose.dev.yml up
# Production
docker-compose -f docker-compose.prod.yml up# Train user-specific behavioral models
curl -X POST "http://localhost:8000/api/v1/ml-analytics/train-model" \
-H "Content-Type: application/json" \
-d '{"customer_unique_id": "user-uuid", "force_retrain": false}'The system includes pre-trained models for:
- Autoencoder:
app/ml_models/autoencoder_best.pth - Classifier:
app/ml_models/classifier_best.pth - Feature Scalers:
app/ml_models/scaler_*.pkl
The application is fully responsive and supports:
- Progressive Web App (PWA) capabilities
- Touch-based biometric authentication
- Mobile-optimized UI components
- Adaptive layouts for various screen sizes
- FIDO2 Configuration: Relying Party ID and origin validation
- Encryption Keys: AES-GCM for sensitive data encryption
- JWT Settings: Token expiration and signing algorithms
- Rate Limiting: API endpoint protection
- Model Paths: Configurable model storage locations
- Training Thresholds: Minimum data requirements for training
- Anomaly Sensitivity: Adjustable confidence thresholds
- Retraining Schedule: Automatic model updates
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
For support and questions:
- Issues: GitHub Issues tracker
- Documentation:
/docsfolder - API Docs:
http://localhost:8000/docs(when running)
- Multi-currency support
- Advanced ML model interpretability
- Real-time fraud alerts
- API rate limiting and throttling
- Advanced analytics dashboard
- Mobile native applications
Built with โค๏ธ for secure, intelligent banking