EzyTutor is a comprehensive online tutoring platform built with Rust (backend) and React (frontend), featuring a complete REST API with JWT authentication, role-based access control, and comprehensive business logic.
Backend: COMPLETE - Fully implemented and tested
- Complete REST API with 15+ endpoints
- JWT authentication and role-based access control
- PostgreSQL database with migrations
- Comprehensive business logic and validation
- Error handling and logging
- API testing suite included
Frontend: IN PROGRESS - React components implemented Mobile: PLANNED - React Native applications
The application follows a layered architecture with:
- Rust Web Services: Course and Tutor APIs built with Actix-web
- Application Modules: User authentication, templates, error handling, database access
- Infrastructure: PostgreSQL database, logging, configuration management
- Frontend: React web application with modern UI components
- Mobile Support: React Native mobile applications (iOS/Android)
- User Management: Registration, authentication, and role-based access (Student, Tutor, Admin)
- Course Management: Create, update, and manage tutoring courses
- Tutor Profiles: Comprehensive tutor profiles with ratings and reviews
- Search & Discovery: Find tutors and courses by category, difficulty, and rating
- Review System: Student reviews and ratings for tutors
- JWT-based authentication
- RESTful API design
- Database migrations with SQLx
- Input validation and error handling
- CORS support for web clients
- Structured logging
- Rust (latest stable version)
- PostgreSQL 12+
- Node.js 18+ (for frontend)
- npm or yarn
-
Clone the repository
git clone <repository-url> cd EzyTutor
-
Install dependencies
# Install Rust (if not already installed) curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh # Install PostgreSQL (macOS) brew install postgresql brew services start postgresql
-
Set up environment variables
cp .env.example .env # Edit .env with your database credentials and JWT secret -
Set up the database
# Create database createdb ezytutor # The migrations will run automatically when you start the server
-
Run the backend
# Full server (requires PostgreSQL) cargo run --bin ezytutor # Or test server (no database required) cargo run --bin test_server
The API will be available at http://localhost:8080
Test the API without setting up a database:
# Start test server
cargo run --bin test_server
# Run basic tests
./test_simple.shFor full API testing with database:
# Start full server
cargo run --bin ezytutor
# Run comprehensive tests
./test_api.shGET /api/v1/health- Health check endpointPOST /api/v1/auth/register- Register a new userPOST /api/v1/auth/login- Login user and get JWT tokenGET /api/v1/courses- List all active coursesGET /api/v1/courses/{id}- Get specific course detailsGET /api/v1/tutors- List all available tutorsGET /api/v1/tutors/{id}- Get specific tutor profileGET /api/v1/tutors/{id}/reviews- Get reviews for a tutorGET /api/v1/tutors/search?specialization=Math- Search tutors by specialization
Course Management (Tutors Only)
POST /api/v1/courses- Create a new coursePUT /api/v1/courses/{id}- Update course detailsDELETE /api/v1/courses/{id}- Delete a courseGET /api/v1/my/courses- Get tutor's own courses
Tutor Profile Management
POST /api/v1/tutors/profile- Create tutor profilePUT /api/v1/tutors/profile- Update tutor profile
Review System (Students Only)
POST /api/v1/tutors/{id}/reviews- Add review for a tutor
All protected endpoints require a Bearer token in the Authorization header:
Authorization: Bearer <jwt_token>
The application uses PostgreSQL with the following main tables:
users- User accounts with email, password, role (student/tutor/admin)tutors- Tutor profiles with bio, specializations, hourly rates, ratingscourses- Course information with title, description, price, difficulty leveltutor_reviews- Student reviews and ratings (1-5 stars) for tutors
- Custom PostgreSQL enums for user roles and difficulty levels
- Automatic timestamps with triggers for created_at/updated_at
- Comprehensive indexes for performance optimization
- Foreign key constraints ensuring data integrity
- Rating aggregation automatically calculated from reviews
# Unit and integration tests
cargo test
# API endpoint testing (requires database)
./test_api.sh
# Basic health check testing (no database)
./test_simple.sh# Format code
cargo fmt
# Lint code
cargo clippy
# Check compilation
cargo check- Make changes to source code
- Test locally with
cargo run --bin test_server - Run tests with
./test_simple.sh - Set up database for full testing
- Run full tests with
./test_api.sh
The application can be deployed using Docker or directly on a server with PostgreSQL.
DATABASE_URL- PostgreSQL connection stringJWT_SECRET- Secret key for JWT token signingHOST- Server host (default: 127.0.0.1)PORT- Server port (default: 8080)RUST_LOG- Logging level (default: info)
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.