A psychological anime recommendation system that uses indirect psychological questions to build user profiles and match them with anime based on their psychological preferences.
- Psychological profiling without direct anime questions
- Multi-stage adaptive questioning system
- Bayesian profile updating with confidence scores
- Multi-stage recommendation filtering with clustering
- Integration with multiple anime data sources (AniList, MyAnimeList, TMDb)
- Trailer integration with YouTube
- High-quality posters from TMDb
- Modern React UI with Tailwind CSS
- MCP (Model Context Protocol) integration for profile storage
Ani-Sage uses a layered architecture with clear separation of concerns:
┌─────────────────────────────────┐
│ User Interface │
│ React + TypeScript + Tailwind │
└───────────────┬─────────────────┘
│
┌───────────────▼─────────────────┐
│ Recommendation Engine │
│ Clustering + Filtering │
└───────────────┬─────────────────┘
│
┌───────────────▼─────────────────┐
│ User Psychology Layer │
│ Profile + Question Mapping │
└───────────────┬─────────────────┘
│
┌───────────────▼─────────────────┐
│ Data Integration Layer │
│ Unified API Adapter Pattern │
└───────────────┬─────────────────┘
│
┌───────────────▼─────────────────┐
│ Multiple Anime API Sources │
│ AniList, MAL, TMDb, YouTube │
└─────────────────────────────────┘
The application integrates with multiple APIs to provide comprehensive anime data:
Used primarily for high-quality poster images and metadata. TMDb often has better image assets than specialized anime databases.
Used for comprehensive anime metadata, seasonal anime information, and user-specific features like watchlists (requires authentication).
Used for anime metadata and user-specific features like ratings and watchlists (requires authentication).
Used to fetch official trailers for anime recommendations.
- Install dependencies:
npm install
-
Create a
.env
file with your API keys (see.env.example
). -
Run the API server:
npm start
- Navigate to the UI directory:
cd ui/ui
- Install dependencies:
npm install
- Create a
.env
file based on.env.example
:
cp .env.example .env
- Run the development server:
npm run dev
npm run demo
- Run the API integration demonpm run api-demo
- Run dedicated API demonpm run recommendation-demo
- Test the recommendation enginenpm test
- Run Jest tests
/api
- API integration modules/core
- Base API client with shared functionality/providers
- Provider-specific API clientsanime-api-adapter.ts
- Unified adapter for all anime sourcesanime-attribute-mapper.ts
- Maps anime attributes to psychological dimensionsmcp-anime-integration.ts
- Integrates with MCP for profile storage
/ui
- User interface/src
- Main UI code/components
- React components/context
- React context providers/services
- API service layer/pages
- Main application pages
psychological-dimensions.ts
- Core psychological dimensions used for profilingquestion-bank.ts
- Bank of psychological questions for user profilingprofile-similarity.ts
- Similarity calculation between user profiles and animeprofile-update.ts
- Bayesian profile updating algorithmrecommendation-engine.ts
- Core recommendation algorithmsrecommendation-service.ts
- Service connecting UI to recommendation enginerecommendation-filters.ts
- Additional filters for diversity and relevance
The project is built in TypeScript and follows a modular architecture. To add a new feature or API integration:
- Create a new client in the
/api/providers
directory - Add conversion functions in the
anime-api-adapter.ts
- Update the
anime-attribute-mapper.ts
if new attributes are available - Update the environment configuration in
api/config.ts
The UI is built with React, TypeScript, and Tailwind CSS. It uses:
- React Context API for state management
- React Router for navigation
- Framer Motion for animations
- Shadcn/UI component library
- Axios for API communication
The API configuration file is located at:
ui/ui/src/config/api.ts
This file contains settings for:
- API base URL
- Timeouts
- Mock API mode toggle
- Storage keys
Create a .env
file in the ui/ui directory with:
VITE_API_BASE_URL
: URL to your API serverVITE_ENABLE_MOCK_API
: Toggle mock API mode (for development)VITE_ENABLE_ANALYTICS
: Toggle analytics (if implemented)
- Language: TypeScript
- Frontend: React, Tailwind CSS, Framer Motion
- State Management: React Context API
- Testing: Jest
- External APIs: AniList, MyAnimeList, TMDb, YouTube
- Implement database integration (MongoDB/PostgreSQL) to replace in-memory storage
- Add user authentication for persistent profiles across sessions
- Create data migration tools for existing profiles
- Implement profile sharing and export functionality
- Replace placeholder images with custom artwork or licensed anime visuals
- Add animations for smoother transitions between questions
- Implement dark mode and accessibility features
- Create mobile-responsive design for all screen sizes
- Add caching layer for external anime API requests
- Implement rate limiting and request batching
- Create a unified error handling system with graceful degradation
- Add comprehensive API documentation with OpenAPI/Swagger
- Train ML models on user response data to improve psychological profiling
- Implement collaborative filtering to supplement psychological matching
- Add content-based recommendation enhancements using anime metadata
- Develop genre-specific psychological mapping for niche preferences
- Expand test coverage for psychological profiling algorithms
- Conduct user studies to validate recommendation accuracy
- Implement A/B testing framework for algorithm improvements
- Add end-to-end testing for critical user flows
- Create containerized deployment with Docker
- Set up CI/CD pipeline for automated testing and deployment
- Implement monitoring and logging systems
- Configure scalable cloud infrastructure for production deployment