Full-stack monorepo for personalized movie and book recommendations using AI (Grok API from xAI).
This is a monorepo containing both frontend and backend applications:
βββ recomienda_ai/ # Backend: Rails 8.1+ API
βββ recomienda_ai_frontend/ # Frontend: React 19 + TypeScript
Recomienda.ai is an intelligent recommendation system that provides personalized movie and book suggestions powered by AI. Users can:
- π Register and authenticate with JWT
- βοΈ Set their preferences for genres, authors, and directors
- π¬ Get AI-powered movie recommendations
- π Get AI-powered book recommendations
- β Rate and favorite content
- π Search through content library
- Rails 8.1+ (API-only mode)
- PostgreSQL database
- JWT authentication
- Solid Queue for background jobs
- Rack-Attack for rate limiting
- Grok API (xAI) for AI recommendations
- jsonapi-serializer for JSON responses
- React 19 with TypeScript
- Vite as bundler
- Tailwind CSS + shadcn/ui components
- TanStack Query for API state management
- React Router for navigation
- Axios for HTTP requests
- Ruby 3.3+
- Node.js 18+
- PostgreSQL 15+
- xAI API key (for Grok)
git clone <repository-url>
cd recomienda_aicd recomienda_ai
# Install dependencies
bundle install
# Setup environment variables
cp .env.example .env
# Edit .env with your xAI API key and database settings
# Setup database
rails db:create
rails db:migrate
rails db:seed
# Start background jobs (in separate terminal)
bin/jobs
# Start Rails server
rails serverBackend will be available at http://localhost:3000
cd recomienda_ai_frontend
# Install dependencies
npm install
# Start development server
npm run devFrontend will be available at http://localhost:5173
http://localhost:3000/api/v1
All protected endpoints require JWT token in Authorization: Bearer <token> header.
POST /auth/register # Register new user
POST /auth/login # Login user
GET /auth/me # Get current user infoGET /preferences # Get user preferences
POST /preferences # Create preferences
PUT /preferences/:id # Update preferencesGET /recommendations # Get recommendations (cached or generate)
POST /recommendations/generate # Force async generation
GET /recommendations/jobs/:id # Check job statusGET /content/:id # Get content details
GET /content/search?q=X # Search contentGET /favorites # Get user favorites
POST /favorites # Add favorite
DELETE /favorites/:id # Remove favoritePOST /ratings # Create rating
PUT /ratings/:id # Update rating
DELETE /ratings/:id # Delete ratingcd recomienda_ai
# Run tests
rails test
# Run linting
bundle exec rubocop
# Security audit
bundle exec brakeman
bundle exec bundler-audit checkcd recomienda_ai_frontend
# Run tests
npm test
# Run linting
npm run lint
# Build for production
npm run build- User: Authentication and profile
- Preference: User's favorite genres, authors, directors
- Content: Polymorphic model for Movies and Books
- Rating: User ratings (1-5) for content
- Favorite: User's favorite content
- Recommendation: AI-generated recommendations with caching
- JWT-based authentication
- Rate limiting (Rack-Attack)
- Input validation and sanitization
- CORS configuration
- Security headers
- Regular security audits (Brakeman, bundler-audit)
- General API: 100 requests/minute
- Login: 5 requests/minute
- Register: 3 requests/minute
- Recommendations: 10 requests/5 minutes
Designed for deployment on modern platforms:
- Render (recommended)
- Heroku
- AWS ECS/Fargate
- DigitalOcean App Platform
- Vercel (recommended)
- Netlify
- GitHub Pages
- AWS S3 + CloudFront
- Docker support included
- Kamal deployment configuration
- Environment variable templates
- Production-ready Procfile
# Database
DATABASE_URL=postgresql://localhost/recomienda_ai_development
# JWT
JWT_SECRET=your-secret-key
# xAI/Grok
XAI_API_KEY=your-xai-api-key
# Rails
RAILS_MASTER_KEY=your-rails-master-keyVITE_API_BASE_URL=http://localhost:3000/api/v1- User authentication (JWT)
- User preferences management
- AI-powered recommendations
- Content search
- Rating system
- Favorites system
- Background job processing
- Rate limiting
- API documentation
- TypeScript frontend
- Social features (follow users)
- Content reviews
- Recommendation explanations
- Export preferences
- Content suggestions by users
- Mobile app
- Dark mode
- Internationalization
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- xAI for the Grok API
- Rails team for the amazing framework
- React and Vite communities
- Tailwind CSS for the utility-first CSS framework