A recommendation system built with FastAPI and Next.js, featuring machine learning capabilities for book recommendations.
- ML Pipeline with collaborative filtering, content-based filtering, and neural embeddings
- Real-time FastAPI backend with caching
- Next.js 15 frontend with TypeScript and Tailwind CSS
- Cold start handling for new users
- Interactive learning from user feedback
- Python 3.8+
- Node.js 18+
- npm or yarn
Automated (Recommended):
# Windows
setup.bat
# Linux/macOS
./setup.shManual:
# Backend
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
python src/backend/app/integrated_server.py
# Frontend
cd frontend
npm install
npm run dev- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
recsys/
├── frontend/ # Next.js TypeScript app
├── src/backend/ # FastAPI backend
├── scripts/ # Testing utilities
├── data/ # Data storage
├── models/ # ML models (generated)
├── docker-compose.yml # Container setup
└── requirements.txt # Dependencies
# Run tests
make test
# Build production
make build
# Docker deployment
docker-compose up -dGET /api/health- Health checkGET /api/feed/home- Personalized recommendationsGET /api/feed/explore- Discovery feedPOST /api/interactions- User interactionsGET /api/users/{id}/preferences- User preferences
Hybrid approach combining:
- Collaborative Filtering - User-item patterns
- Content-Based Filtering - Book metadata
- Neural Embeddings - Deep learning representations
- Cold Start Handling - New user preference discovery
DATABASE_URL=sqlite:///./data/data.db
API_HOST=0.0.0.0
API_PORT=8000
NEXT_PUBLIC_API_URL=http://localhost:8000- Frontend: Next.js with server-side rendering
- Backend: FastAPI with async support
- ML: Scikit-learn and FAISS for recommendations
- Storage: SQLite for development, PostgreSQL for production
- Caching: In-memory with TTL support
- Sub-100ms API response times
- 1000+ concurrent users support
- Automatic model retraining
- Efficient similarity search with FAISS