A Full-Stack Advertisement Recommendation Platform featuring Personalized Ad Delivery, Real-Time Analytics, Progressive Web App Support, A/B Testing, and Multi-Armed Bandit Learning.
MABlytic is a modern advertisement recommendation system that demonstrates the complete lifecycle of personalized advertising. The platform combines user profiling, advertisement targeting, interaction tracking, analytics, and reinforcement learning concepts into a deployable full-stack web application.
The system currently utilizes user preference matching and Thompson Sampling based Multi-Armed Bandit learning to improve advertisement selection through user engagement data.
Website: https://mablytic.web.app
Repository: https://github.com/Rajlohith/mablytic
MABlytic was designed to explore how recommendation systems can improve advertisement relevance and engagement while providing a practical implementation of:
- Personalized Advertisement Delivery
- User Preference Modeling
- Click Through Rate Analytics
- A/B Advertisement Testing
- Progressive Web Applications
- Push Notifications
- Multi-Armed Bandit Learning
- Thompson Sampling
The project serves as both a production-ready web application and a research platform for studying adaptive recommendation systems.
- User Registration
- Secure Authentication
- User Profiles
- Interest-Based Preferences
- Category-Based Ad Matching
- Personalized Feed Generation
- User Preference Filtering
- Thompson Sampling Ad Selection
- Advertisement View Tracking
- Advertisement Click Tracking
- CTR Calculation
- Performance Monitoring
- User Management Dashboard
- Advertisement Management
- Analytics Dashboard
- Historical Interaction Logs
- Installable Application
- Service Worker Support
- Offline Capability
- App Manifest
- Responsive Design
- Push Notifications
- Firebase Hosting Support
- Render Deployment Support
- Neon PostgreSQL Integration
- GitHub Actions Workflow
| Layer | Technology |
|---|---|
| Backend Framework | FastAPI |
| Programming Language | Python 3.11 |
| ORM | SQLAlchemy |
| Database (Development) | SQLite |
| Database (Production) | PostgreSQL (Neon) |
| Frontend | HTML5 |
| Styling | Tailwind CSS + CSS3 |
| Client Logic | Vanilla JavaScript (ES6+) |
| Authentication | SHA-256 Password Hashing |
| Recommendation Engine | Thompson Sampling (Multi-Armed Bandit) |
| Analytics | CTR Tracking & Interaction Logging |
| Progressive Web App | Service Worker + Web App Manifest |
| Cloud Database | Neon PostgreSQL |
| Frontend Hosting | Firebase Hosting |
| Backend Hosting | Render |
| CI/CD | GitHub Actions |
| Version Control | Git & GitHub |
+------------------+
| Users |
+--------+---------+
|
v
+--------------------------+
| Frontend PWA |
| HTML / CSS / JavaScript |
+------------+-------------+
|
v
+--------------------------+
| FastAPI Backend |
+------------+-------------+
|
+-----------------------+-----------------------+
| |
v v
+----------------------+ +----------------------+
| Recommendation Engine| | Analytics Engine |
| Preference Matching | | CTR Tracking |
| Thompson Sampling | | Performance Metrics |
+----------------------+ +----------------------+
| |
+-----------------------+-----------------------+
|
v
+--------------------------+
| SQLite / PostgreSQL DB |
+--------------------------+
+----------------------+
| Users |
+----------+-----------+
|
v
+----------------------+
| Firebase Hosting |
| Frontend PWA |
+----------+-----------+
|
v
+----------------------+
| Render |
| FastAPI Backend |
+----------+-----------+
|
v
+----------------------+
| Neon PostgreSQL |
| Persistent Database |
+----------------------+
| Component | Service |
|---|---|
| Frontend Hosting | Firebase Hosting |
| Backend Hosting | Render |
| Database | Neon PostgreSQL |
| CI/CD | GitHub Actions |
| Version Control | GitHub |
MABlytic uses SQLite during local development and Neon PostgreSQL in production.
Since Render instances use ephemeral storage, local SQLite databases do not persist across service restarts or redeployments. To ensure reliable data persistence and production scalability, Neon PostgreSQL is used as the primary cloud database.
Benefits include:
- Persistent cloud storage
- PostgreSQL compatibility
- Automatic backups
- High availability
- Production-grade reliability
mablytic/
│
├── .github/
│ └── workflows/
│ ├── firebase-hosting-merge.yml
│ └── firebase-hosting-pull-request.yml
│
├── backend/
│ ├── __init__.py
│ ├── ad_serving.py
│ ├── database.py
│ ├── main.py
│ ├── models.py
│ ├── schemas.py
│ ├── seed_data.py
│ ├── requirements.txt
│ └── ad_recommender.db
│
├── frontend/
│ ├── icons/
│ │ ├── icon-72.png
│ │ ├── icon-96.png
│ │ ├── icon-128.png
│ │ ├── icon-144.png
│ │ ├── icon-152.png
│ │ ├── icon-192.png
│ │ ├── icon-384.png
│ │ └── icon-512.png
│ │
│ ├── 404.html
│ ├── admin.html
│ ├── app.js
│ ├── feed.html
│ ├── icon_generator.html
│ ├── index.html
│ ├── manifest.json
│ ├── register.html
│ ├── robots.txt
│ ├── style.css
│ └── sw.js
│
├── .firebaserc
├── .gitignore
├── firebase.json
├── LICENSE
├── README.md
├── requirements.txt
└── skills-lock.json
- User registers an account.
- User selects personal interests.
- Preferences are stored in the database.
- Advertisements are categorized by topic.
- Matching advertisements are identified.
- Thompson Sampling evaluates candidate advertisements.
- Advertisement is delivered to the user.
- Views and clicks are recorded.
- Analytics engine updates performance metrics.
- Future recommendations adapt using engagement history.
MABlytic incorporates Multi-Armed Bandit learning through Thompson Sampling.
Maximize user engagement while continuously learning advertisement effectiveness.
Click → Success
View Without Click → Failure
Beta(α, β)
α = Clicks + 1
β = Failures + 1
For every advertisement, a probability distribution is maintained.
Advertisements with higher expected engagement gradually receive more exposure while still allowing exploration of new advertisements.
| Column | Description |
|---|---|
| id | Primary Key |
| username | Unique Username |
| User Email | |
| age | User Age |
| gender | User Gender |
| preferences | User Interests |
| password_hash | SHA-256 Password Hash |
| Column | Description |
|---|---|
| id | Primary Key |
| title | Advertisement Title |
| category | Advertisement Category |
| variant | A/B Testing Variant |
| Column | Description |
|---|---|
| id | Primary Key |
| user_id | User Reference |
| ad_id | Advertisement Reference |
| interaction_type | View or Click |
| timestamp | Event Timestamp |
cd backend
pip install -r requirements.txt
uvicorn main:app --reload --port 8000Populate sample data:
python seed_data.pyBackend URL:
http://127.0.0.1:8000
API Documentation:
http://127.0.0.1:8000/docs
cd frontend
python -m http.server 8081Frontend URL:
http://127.0.0.1:8081
| Role | Username | Password |
|---|---|---|
| Admin | admin | Admin123 |
| User | alice | Tech12 |
| User | bobfit | Fit456 |
| User | carol | Food78 |
| User | davidg | Game12 |
| User | emmaed | Book34 |
- Installable Web Application
- Offline Access
- Service Worker Support
- Application Manifest
- Background Caching
- Push Notifications
- Mobile-Friendly Design
- App Shortcuts
Firebase Hosting
firebase deploy --only hostingRender Deployment
Neon PostgreSQL
Production Architecture:
Firebase Hosting
│
▼
Render FastAPI Backend
│
▼
Neon PostgreSQL
- Backend API Structure
- SQLAlchemy Models
- Authentication System
- CRUD Operations
- Login System
- Registration Workflow
- Personalized Feed
- Admin Dashboard
- Manifest Configuration
- Service Worker Integration
- Offline Support
- Installability
- Firebase Hosting
- Render Backend
- Neon PostgreSQL Integration
- Production API Integration
- Preference Matching
- Advertisement Analytics
- Thompson Sampling
- Multi-Armed Bandit Learning
- Full FastAPI Backend Architecture
- Progressive Web App Support
- Firebase Hosting Integration
- Render Backend Deployment
- Neon PostgreSQL Integration
- PostgreSQL Compatibility
- Thompson Sampling Integration
- Multi-Armed Bandit Recommendation Engine
- Advertisement Analytics Dashboard
- Automated Firebase Deployment Workflows
This project can be used to study:
- Recommendation Systems
- Multi-Armed Bandits
- Reinforcement Learning
- Online Learning Algorithms
- Click Through Rate Optimization
- User Personalization
- Digital Advertising Platforms
Licensed under the Apache License 2.0.
Website: https://mablytic.web.app
Repository: https://github.com/Rajlohith/mablytic