A comprehensive financial services platform built with FastAPI backend and Next.js frontend, featuring integrated monitoring and observability.
Amoni Kevin - GitHub
- FastAPI - Modern Python web framework
- SQLAlchemy - Database ORM
- Alembic - Database migrations
- Pydantic - Data validation
- Prometheus - Metrics collection
- SQLite/PostgreSQL - Database
- Next.js 14 - React framework
- TypeScript - Type safety
- Tailwind CSS - Styling
- React Hook Form - Form management
- Prometheus - Metrics collection and storage
- Grafana - Visualization and dashboards
- Docker - Containerization for monitoring services
- Python 3.8+
- Node.js 18+
- Docker (optional, for monitoring services)
-
Clone the repository
git clone <repository-url> cd Mkiba
-
Start the complete development environment
# Windows start-development.bat # This will automatically: # - Check system requirements # - Start monitoring services (if Docker is available) # - Launch backend server (FastAPI) # - Launch frontend server (Next.js)
-
Access the services
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/api/docs
- Metrics Endpoint: http://localhost:8000/metrics
- Prometheus: http://localhost:9090 (if Docker available)
- Grafana: http://localhost:3001 (admin/admin, if Docker available)
If you prefer manual setup or need to troubleshoot:
cd mkiba-backend
# Create virtual environment
python -m venv venv
venv\Scripts\activate # Windows
# source venv/bin/activate # Linux/Mac
# Install dependencies
pip install -r requirements/dev.txt
# Setup environment
cp .env.example .env
# Edit .env with your configuration
# Run migrations
alembic upgrade head
# Start server
uvicorn app.main:app --host 0.0.0.0 --port 8000 --reloadcd mkiba-frontend
# Install dependencies
npm install
# Setup environment
cp .env.example .env.local
# Edit .env.local with your configuration
# Start development server
npm run devcd monitoring
# Start monitoring stack
docker-compose -f docker-compose.monitoring.yml up -d
# Or use the convenience script
start-monitoring.batThe platform includes comprehensive monitoring capabilities:
- HTTP Request Metrics: Request count, duration, status codes
- Application Metrics: Active requests, response times
- System Metrics: Memory usage, CPU utilization
- Business Metrics: Transaction counts, user activities
- MKiba Overview: Main application dashboard
- HTTP Request Rate: Request volume and patterns
- Response Time Percentiles: Performance analysis
- Error Rate Monitoring: Error tracking and alerting
- Service Health: Overall system status
Pre-configured alerts for:
- Backend service downtime
- High response times (>2s)
- Error rates above 5%
- High system resource usage
cd mkiba-backend
pytest tests/ -vcd mkiba-frontend
npm test
npm run test:e2eDATABASE_URL=sqlite:///./mkiba_dev.db
SECRET_KEY=your-secret-key
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=30
ENVIRONMENT=developmentNEXT_PUBLIC_API_URL=http://localhost:8000
NEXT_PUBLIC_APP_NAME=MKiba- Prometheus:
monitoring/prometheus/prometheus.yml - Grafana:
monitoring/grafana/ - Alerts:
monitoring/prometheus/alert_rules.yml
Mkiba/
βββ mkiba-backend/ # FastAPI backend
β βββ app/
β β βββ api/ # API routes
β β βββ core/ # Core functionality
β β βββ models/ # Database models
β β βββ schemas/ # Pydantic schemas
β β βββ services/ # Business logic
β βββ tests/ # Backend tests
β βββ requirements/ # Python dependencies
βββ mkiba-frontend/ # Next.js frontend
β βββ src/
β β βββ app/ # App router pages
β β βββ components/ # React components
β β βββ lib/ # Utilities
β βββ tests/ # Frontend tests
βββ monitoring/ # Monitoring stack
β βββ prometheus/ # Prometheus config
β βββ grafana/ # Grafana dashboards
β βββ docker-compose.monitoring.yml
βββ start-development.bat # Development startup script
βββ stop-development.bat # Development shutdown script
-
Backend Deployment
cd mkiba-backend docker build -t mkiba-backend . docker run -p 8000:8000 mkiba-backend
-
Frontend Deployment
cd mkiba-frontend npm run build npm start -
Monitoring Deployment
cd monitoring docker-compose -f docker-compose.monitoring.yml up -d
- Development: Local SQLite, hot reload enabled
- Staging: PostgreSQL, reduced logging
- Production: PostgreSQL, optimized settings, SSL enabled
-
Start Development Environment
start-development.bat
-
Make Changes
- Backend changes auto-reload with
--reloadflag - Frontend changes auto-reload with Next.js hot reload
- Backend changes auto-reload with
-
Monitor Changes
- Check metrics at http://localhost:8000/metrics
- View dashboards at http://localhost:3001
-
Run Tests
# Backend cd mkiba-backend && pytest # Frontend cd mkiba-frontend && npm test
-
Stop Development Environment
stop-development.bat
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Add tests for new functionality
- Ensure all tests pass
- Update documentation as needed
- Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Backend: Follow PEP 8, use Black formatter
- Frontend: Follow ESLint rules, use Prettier formatter
- Commits: Use conventional commit messages
This project is licensed under the MIT License - see the LICENSE file for details.
-
Port Already in Use
# Kill processes on ports 3000, 8000 stop-development.bat -
Docker Not Running
- Start Docker Desktop
- Monitoring services will be disabled if Docker unavailable
-
Database Issues
cd mkiba-backend alembic upgrade head -
Node Modules Issues
cd mkiba-frontend rm -rf node_modules package-lock.json npm install
- Check the API Documentation
- Review Monitoring Documentation
- Open an issue for bugs or feature requests
The platform includes built-in performance monitoring:
- Response Time Tracking: P50, P95, P99 percentiles
- Error Rate Monitoring: 4xx and 5xx error tracking
- Resource Usage: Memory and CPU monitoring
- Custom Business Metrics: Transaction volumes, user engagement
Access real-time dashboards at http://localhost:3001 when monitoring services are running.