- RecAnthology
RecAnthology (Recommended Anthology) is an intelligent, extensible recommendation platform engineered to curate collections of books, movies, and TV shows tailored to user preferences. Leveraging advanced algorithms and continuous user feedback, RecAnthology delivers personalized, dynamic recommendations that optimize content discovery. The most recent release expands media coverage, maximizes performance via caching, and improves user management for system stability.
For a detailed overview of the project's strategic vision, technical milestones, and long-term trajectory, please refer to the ROAD-MAP.md.
- Robust user authentication and authorization powered by JWT
- Flexible rating system for books, movies, and TV shows
- Real-time tracking and modeling of user genre preferences
- Comprehensive API endpoints supporting CRUD operations on users and media assets
- Adaptive, feedback-driven recommendation algorithms
- Integrated caching layer for enhanced throughput and latency reduction
- Automated model testing and error detection
- Strict data validation pipelines
- Backend: Django, Django REST Framework
- Authentication: JWT and Django authentication modules
- Database: PostgreSQL (production); SQLite as a lightweight development alternative (configurable in
settings.py) - Frontend: Django templates using Bootstrap 5 (see
templates/base.html)
RecAnthology's architecture is modular and designed for scalability, maintainability, and extensibility.
- API Layer: Serves all client interactions via RESTful routes.
- Authentication: Stateless JWT ensures secure, scalable user sessions.
- Recommendation Engine: Pluggable, supports both content-based and collaborative filtering modules.
- Service Layer: Encapsulates business logic, data aggregation, scoring, and caching.
- Data Layer: Relational data managed in PostgreSQL, with optional support for Redis-based caching.
- Frontend: Server-rendered templates enable rapid UI prototyping and integration.
- Performance vs. Flexibility: While Django REST and PostgreSQL provide robust scalability, they require careful query optimization for recommendation workloads. SQLite is practical for development but not suited for production scale or concurrent writes.
- Real-Time Recommendations: On-the-fly scoring enhances personalization but introduces higher compute overhead. Background jobs (optional future enhancement) may be leveraged for offline pre-computation at scale.
- Caching: The addition of caching (e.g., Redis) accelerates common queries but demands cache invalidation strategies when user preferences or media data change.
- Extensibility: Modular engine design facilitates new recommendation algorithms but may increase initial development complexity.
RecAnthology implements a hybrid recommendation system, combining content-based genre affinities with collaborative filtering to deliver highly relevant media suggestions.
Aligns users with media based on explicit and inferred genre affinities.
Operational Overview:
- Users rate media items, shaping a user-genre affinity profile.
- Dominant user genres are dynamically detected and ranked.
- Media candidates are scored based on their genre alignment with the user's profile.
- Scores are normalized (0–100) for consistent relativity.
RecAnthology now supports Item-Item Collaborative Filtering to discover patterns across the user base.
Implemented Features:
- Similarity Computation: Uses Cosine Similarity to calculate affinity between items based on shared user rating patterns.
- Multi-Signal Scoring: Leverages metadata like author, popularity, recency, and language to enrich content-based scores.
- Adaptive Hybrid Logic: Dynamically balances content and collaborative signals based on user interaction density (Adaptive α).
- API Control: Users can toggle collaborative filtering and override hybrid weights via API parameters (e.g.,
?cf=true&alpha=0.6).
For comprehensive implementation and advanced usage, refer to RECOMMENDATION-DOC.md.
- Python 3.12.3 or newer (should run on >=3.9)
- Pipenv (or pip and virtualenv) (RECOMMENDED)
- PostgreSQL or any comparable SQL server (SQLite3 supported for development only)
- Clone the repository:
git clone https://github.com/karar-hayder/RecAnthology.git
cd RecAnthology- Set up the virtual environment (recommended):
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtpython -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt- Configure the database:
- Create a file in the RecAnthology directory (next to
settings.py) and name itcred.env - Set the following variables:
SECRET_KEY=your_secret_key_here
DEBUG=True # Set to False in production
ALLOWED_HOSTS=localhost,127.0.0.1 # Comma-separated; update for production deployment
ADMIN_PAGE=admin/ # Customize admin URL in production environments
DB_NAME=your_db_name
DB_HOST=localhost # DB server IP or localhost
DB_PORT=5432 # Default for PostgreSQL
DB_USER=your_db_user
DB_PASSWORD=your_db_password
REDIS_URL=redis://localhost:6379/0 # Optional. Defaults to local Redis instance.python3 -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': get_env("DB_NAME"),
'HOST': get_env("DB_HOST"),
'PORT': get_env("DB_PORT"),
'USER': get_env("DB_USER"),
'PASSWORD': get_env("DB_PASSWORD"),
}
}DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / "db.sqlite3",
}
}- Apply migrations:
python manage.py migrate- Create your admin user account
python manage.py createsuperuser- Launch the development server:
python manage.py runserverThe full API documentation, including endpoint specifications and authentication protocols, is provided in API-DOC.md.
To execute the automated test suite, run:
python manage.py test- Fork the repository.
- Create a new branch:
git checkout -b feature-branch-name - Commit your changes:
git commit -m 'Add some feature' - Push to your branch:
git push origin feature-branch-name - Open a pull request.
This project is released under the BSD-3-Clause license. See the LICENSE file for full details.
For questions or feedback, contact:
- Name: Karar Haider
- LinkedIn: Karar Haider
- GitHub: karar-hayder