ReBin Pro is a comprehensive AI-powered waste sorting application that helps users make environmentally conscious decisions about waste disposal. The application combines computer vision, machine learning, and real-time data to provide accurate sorting guidance and track environmental impact.
- AI-Powered Image Recognition: Upload or capture photos of waste items for instant classification
- Local Policy Integration: Get sorting guidance based on your ZIP code's specific recycling policies
- Real-time Processing: Fast image analysis with Cloudflare Workers for optimal performance
- Environmental Impact Tracking: Monitor your COβ savings and environmental contribution
- Leaderboards: Compete with other users and track your ranking across different time periods and categories
- Challenges: Participate in community challenges to increase engagement and earn rewards
- Achievements: Earn badges and points for sustainable actions with a comprehensive achievement system
- Real-time Updates: Live statistics and community activity feeds with real-time notifications
- Social Engagement: Connect with other users, share achievements, and participate in community events
- Progressive Web App (PWA): Install on mobile devices for offline functionality
- Responsive Design: Optimized for desktop, tablet, and mobile devices
- Accessibility: WCAG 2.1 AA compliant interface
- Multi-language Support: Internationalization ready
- Offline Mode: Core functionality works without internet connection
- Push Notifications: Stay updated on challenges and achievements
- Analytics Dashboard: Comprehensive insights into your recycling habits
- Social Sharing: Share your environmental impact with friends
- Framework: React 18 with TypeScript
- Styling: TailwindCSS with custom components
- State Management: React Query for server state, Zustand for client state
- Real-time: Supabase real-time subscriptions
- PWA: Service Worker with offline capabilities
- Framework: FastAPI with async/await patterns
- Database: Supabase (PostgreSQL) with real-time capabilities
- AI Integration: OpenRouter/Gemini for reasoning, YOLOv8 for computer vision
- Authentication: Supabase Auth with social providers
- API Documentation: Auto-generated OpenAPI/Swagger docs
- Image Processing: Canvas API for image optimization
- Caching: KV storage for policies and user sessions
- Rate Limiting: Per-user request throttling
- Analytics: Event tracking and performance monitoring
- Containerization: Docker with multi-stage builds
- Monitoring: Prometheus, Grafana, and custom metrics
- CI/CD: GitHub Actions with automated testing
- Security: Rate limiting, input validation, and audit logging
- Node.js 18+ and npm/yarn
- Python 3.11+
- Docker and Docker Compose
- Supabase account
- Cloudflare account (for Workers)
-
Clone the repository
git clone https://github.com/your-org/rebin-pro.git cd rebin-pro -
Set up environment variables
# Backend cp backend/.env.example backend/.env # Edit backend/.env with your configuration # Frontend cp frontend/.env.example frontend/.env.local # Edit frontend/.env.local with your configuration
-
Database setup
# Run database migrations cd database python migrate.py
-
Start development servers
# Using Docker Compose (recommended) docker-compose up -d # Or manually # Backend cd backend pip install -r requirements.txt uvicorn main:app --reload --port 8000 # Frontend cd frontend npm install npm run dev
-
Access the application
- Frontend: http://localhost:5173
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
# Run all tests
npm run test
# Run tests in watch mode
npm run test:watch
# Run tests with coverage
npm run test:coverage
# Run community features tests
npm run test:community
# Run specific test suites
npm run test:ui # UI component tests
npm run test:auth # Authentication tests
npm run test:security # Security testsThe project includes comprehensive test coverage for:
- Community Features: Challenge system, leaderboards, achievements, notifications
- UI Components: All reusable components with accessibility testing
- Authentication: Login, registration, and security features
- API Endpoints: Backend route testing and validation
- Security: XSS protection, CSRF tokens, rate limiting
- Integration: End-to-end workflow testing
frontend/src/test/
βββ components/
β βββ auth/ # Authentication component tests
β βββ community/ # Community feature tests
β βββ ui/ # UI component tests
β βββ navigation/ # Navigation component tests
βββ lib/ # Library and utility tests
βββ setup.ts # Test configuration
- users: User accounts and profiles
- sort_events: Individual waste sorting events
- policies: Local recycling policies by ZIP code
- user_preferences: User customization settings
- achievements: User achievements and badges with progress tracking
- challenges: Community challenges and competitions with real-time updates
- challenge_participants: User participation tracking and progress monitoring
- leaderboard: Materialized view for performance with caching
- user_preferences: User customization and notification settings
- analytics_events: Detailed user behavior and engagement tracking
- user_sessions: Session tracking for analytics
- analytics_events: Detailed user behavior tracking
- feedback: User feedback on sorting decisions
POST /auth/register- User registrationPOST /auth/login- User loginPOST /auth/logout- User logoutGET /auth/profile- Get user profile
POST /infer- Image analysis and item detectionPOST /explain- Get sorting explanations and eco tipsPOST /event- Log sorting eventsPOST /chatbot- Generate conversational explanations
GET /users/profile/{user_id}- Get user profilePUT /users/profile/{user_id}- Update user profileGET /users/preferences/{user_id}- Get user preferencesPUT /users/preferences/{user_id}- Update user preferencesGET /users/stats/{user_id}- Get user statisticsGET /users/achievements/{user_id}- Get user achievements
GET /analytics/trends- Get recycling trends and patternsGET /analytics/impact- Calculate environmental impactGET /analytics/leaderboard- Get leaderboard dataGET /analytics/recent-activity- Get recent activityPOST /analytics/track-event- Track analytics events
GET /users/challenges- Get available challenges with filteringPOST /users/challenges/{challenge_id}/join- Join a challengeGET /users/achievements/{user_id}- Get user achievements and progressGET /analytics/leaderboard- Get leaderboard data with rankingsGET /analytics/trends- Get recycling trends and community statisticsGET /analytics/impact- Calculate environmental impact metricsPOST /analytics/track-event- Track user engagement events
# Backend tests
cd backend
pytest tests/ -v
# Frontend tests
cd frontend
npm test
# Integration tests
docker-compose -f docker-compose.test.yml up --abort-on-container-exit
# E2E tests
npm run test:e2e- Unit Tests: 90%+ coverage for core business logic
- Integration Tests: API endpoints and database operations
- E2E Tests: Complete user workflows
- Performance Tests: Load testing with k6
-
Build and push Docker images
docker build -t rebin-pro/backend:latest ./backend docker build -t rebin-pro/frontend:latest ./frontend
-
Deploy to production
# Using Docker Compose docker-compose -f docker-compose.prod.yml up -d # Or using Kubernetes kubectl apply -f k8s/
-
Set up monitoring
# Start monitoring stack docker-compose -f docker-compose.monitoring.yml up -d
ENVIRONMENT=production
SUPABASE_URL=your_supabase_url
SUPABASE_SERVICE_ROLE_KEY=your_service_role_key
OPENROUTER_API_KEY=your_openrouter_key
ELEVENLABS_API_KEY=your_elevenlabs_key
FRONTEND_ORIGIN=https://your-domain.comVITE_SUPABASE_URL=your_supabase_url
VITE_SUPABASE_ANON_KEY=your_anon_key
VITE_API_URL=https://api.your-domain.com
VITE_CLOUDFLARE_WORKER_URL=https://your-worker.your-subdomain.workers.dev- Application Metrics: Request rates, response times, error rates
- Business Metrics: Sort events, user engagement, environmental impact
- Infrastructure Metrics: CPU, memory, disk usage
- Custom Metrics: AI model performance, cache hit rates
- Grafana: Real-time monitoring dashboards
- Prometheus: Metrics collection and alerting
- Custom Analytics: User behavior and engagement tracking
- API Response Time: Alert if > 200ms for 95th percentile
- Error Rate: Alert if > 1% error rate
- Database Performance: Alert on slow queries
- User Engagement: Alert on significant drops in activity
- Rate Limiting: Per-user and per-IP request throttling
- Input Validation: Comprehensive validation and sanitization
- Authentication: JWT tokens with refresh mechanism
- Authorization: Row-level security in Supabase
- Audit Logging: Complete audit trail for all operations
- CORS: Proper cross-origin resource sharing configuration
- Environment Variables: Sensitive data in environment variables only
- Dependency Scanning: Regular security audits of dependencies
- Code Scanning: Static analysis for security vulnerabilities
- Penetration Testing: Regular security assessments
- 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
- TypeScript: Strict typing, no
anytypes - Python: Type hints, async/await patterns, proper error handling
- Testing: Unit tests for all new features
- Documentation: Update documentation for API changes
- Linting: ESLint for frontend, Black/flake8 for backend
- Include tests for new functionality
- Update documentation as needed
- Ensure all tests pass
- Follow the existing code style
- Include a clear description of changes
This project is licensed under the MIT License - see the LICENSE file for details.
- Supabase for the backend-as-a-service platform
- Cloudflare for edge computing and CDN services
- OpenRouter for AI model access
- ElevenLabs for text-to-speech capabilities
- YOLOv8 for computer vision capabilities
- Documentation: docs.rebin-pro.com
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: support@rebin-pro.com
- β Core waste sorting functionality
- β User authentication and profiles
- β Comprehensive community features (leaderboards, challenges, achievements)
- β Real-time notifications and updates
- β Advanced analytics and reporting
- β PWA capabilities with offline support
- β Comprehensive test coverage
- π Advanced AI models for better accuracy
- π Multi-language support
- π Social features and sharing
- π Mobile app (React Native)
- π Enterprise features for businesses
- π API for third-party integrations
- π Advanced analytics and reporting
- π Machine learning model improvements
- π Global expansion with local policies
- π Integration with smart waste bins
- π Carbon credit marketplace
- π Advanced gamification features
ReBin Pro - Making waste sorting smarter, one item at a time. π±β»οΈ