A comprehensive full-stack web application for analyzing MTN Mobile Money (MoMo) transaction data. This platform provides real-time insights, interactive visualizations, and detailed transaction analysis for mobile payment data.
- Features
- Technology Stack
- Project Structure
- Installation
- Configuration
- API Documentation
- Database Schema
- Frontend Components
- Security
- Development
- Deployment
- Contributing
- License
- Real-time transaction monitoring and analysis
- Interactive charts using Chart.js
- Transaction volume visualization
- Distribution analysis by transaction type
- Key metrics overview (total transactions, amounts, trends)
- Comprehensive transaction listing with pagination
- Advanced filtering system by:
- Transaction type
- Date range
- Amount
- User/Phone number
- Detailed transaction view with historical data
- Bar charts for transaction volume analysis
- Pie charts for transaction type distribution
- Time-series analysis
- Custom date range selection
- Export capabilities
- Modern, responsive design
- Intuitive navigation
- Mobile-friendly layout
- Real-time data updates
- Interactive components
- Framework: Flask 2.0+
- Database: MySQL (Aiven Cloud Database)
- ORM: SQLAlchemy
- API: RESTful Architecture
- Security: CORS, SSL/TLS
- Documentation: OpenAPI/Swagger
- HTML5/CSS3: Modern layout and responsive design
- JavaScript: ES6+ features
- Charts: Chart.js for data visualization
- API Integration: Fetch API
- Styling: Custom CSS with responsive design
- Hosting: AWS EC2
- Database: Aiven MySQL Cloud
- Web Server: Nginx
- SSL/TLS: Required for database connections
- Version Control: Git
MoMo-full-stack-application
βββ backend/ # Backend (Flask) application
β βββ app.py # Main Flask application
β βββ config.py # Configuration settings (DB connection)
β βββ models.py # SQLAlchemy models
β βββ database.py # Database initialization
β βββ sms_parser.py # XML Parsing and processing
β βββ data_loader.py # Insert parsed data into MySQL
β βββ routes.py # API routes
β βββ requirements.txt # Required Python libraries
β βββ logs/ # Store logs of ignored/unprocessed messages
β βββ tests/ # Unit tests for backend
β
βββ frontend/ # Frontend dashboard (HTML, CSS, JavaScript)
β βββ index.html # Main dashboard page
β βββ style.css # Stylesheet
β βββ app.js # JavaScript logic for fetching & displaying data
β βββ charts.js # Chart.js integration for visualizations
β βββ assets/ # Images, icons, etc.
β
βββ migrations/ # Database migration files (if needed)
β
βββ data/ # Store provided XML data file
β βββ momo_sms.xml # Sample XML file
β
βββ docs/ # Documentation files
β βββ report.pdf # 2-3 page project report
β
βββ .gitignore # Ignore unnecessary files (logs, venv, etc.)
βββ README.md # Project description & setup instructions
βββ AUTHORS # List of contributors
βββ run.sh # Shell script to start the application
- Clone the repository:
git clone https://github.com/Miranics/MoMo-full-stack-application.git
cd MoMo-full-stack-application- Set up the backend:
cd backend
python -m venv mimi
source mimi/bin/activate # Windows: mimi\Scripts\activate
pip install -r requirements.txt- Configure environment variables:
# Create .env file in backend directory
DB_USER=your_db_user
DB_PASSWORD=your_db_password
DB_HOST=your_db_host
DB_PORT=3306
DB_NAME=your_db_name- Initialize the database:
from backend.database import Base, engine
Base.metadata.create_all(bind=engine)class Config:
SQLALCHEMY_DATABASE_URI = "mysql+pymysql://..."
SQLALCHEMY_TRACK_MODIFICATIONS = False
SSL_ARGS = {"ssl": {"ssl_mode": "REQUIRED"}}const API_BASE_URL = 'http://your-api-domain:8000/api';
const CACHE_DURATION = 5 * 60 * 1000; // 5 minutes cacheGET /api/transactions # Get all transactions
GET /api/transactions/stats # Get transaction statistics
GET /api/users # Get all users
GET /api/health # Health check endpoint
{
"transactions": [
{
"id": 1,
"phone_number": "123456789",
"amount": 1000.00,
"transaction_type": "PAYMENT",
"timestamp": "2024-02-18T15:52:58"
}
]
}CREATE TABLE users (
id INTEGER PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(100) NOT NULL,
phone_number VARCHAR(15) UNIQUE NOT NULL
);CREATE TABLE transactions (
id INTEGER PRIMARY KEY AUTO_INCREMENT,
phone_number VARCHAR(15) NOT NULL,
amount FLOAT NOT NULL,
transaction_type VARCHAR(50) NOT NULL,
timestamp DATETIME NOT NULL,
FOREIGN KEY (phone_number) REFERENCES users(phone_number)
);- Incoming Money
- Payments to Code Holders
- Transfers to Mobile Numbers
- Bank Deposits
- Airtime Bill Payments
- Cash Power Bill Payments
- Third Party Transactions
- Agent Withdrawals
- Bank Transfers
- Internet/Voice Bundles
- Transaction Volume Chart
- Distribution Pie Chart
- Time Series Analysis
- Custom Date Range Selector
- SSL/TLS encryption for database connections
- CORS protection
- Environment variable management
- SQL injection prevention
- Input validation and sanitization
- Rate limiting
- Error handling and logging
# Backend
cd backend
flask run --debug
# Frontend
cd frontend
# Use live server or open HTML files directly# Run Python tests
python -m pytest
# Check API endpoints
curl http://localhost:5000/api/health- Configure EC2 instance
- Set up Nginx
- Configure SSL/TLS
- Set up environment variables
- Run application with gunicorn
mysql -h your-aiven-host -u your-user -p- Fork the repository
- Create feature branch (
git checkout -b feature/AmazingFeature) - Commit changes (
git commit -m 'Add AmazingFeature') - Push to branch (
git push origin feature/AmazingFeature) - Open Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Nanen Miracle - Miranics Akachi David Nwanze d.akachi@alustudent.com Abraham Chan Deng a.garang@alustudent.com Joan Kariza j.kariza@alustudent.com
For support:
- Create an issue in the repository
- Contact: [African Leadership University]
- Documentation: [https://github.com/Miranics/MoMo-full-stack-application/edit/main/README.md]
- MTN for inspiration and support
- Chart.js team for visualization library
- Flask and SQLAlchemy communities
Last updated: 2025-02-18
