ADHYA is a modern, premium full-stack mentor-matching and live-learning platform. Built with a highly responsive React + Tailwind v4 frontend and a robust FastAPI (Python) + PostgreSQL backend, ADHYA enables students to discover verified subject mentors, manage bookings, and communicate in real-time via persistent, permission-gated WebSockets.
Explore Backend Hub β’ Explore Frontend Application
ADHYA is optimized for three user personas, providing dedicated dashboards and fine-grained authorization rules:
- Mentor Discovery: Search and discover expert tutors using multi-criteria filters including subject, city, monthly pricing, and minimum experience years.
- Booking Management: Book tutoring sessions directly based on real-time availability slots defined by mentors.
- Performance Reviews: Share structured rating scores (1β5) and written feedback for accepted bookings.
- Student Profile: Customize avatar, academic grade/class, and city.
- Hall of Fame: Showcase student achievements linked to specific tutors with vibrant visual cards.
- Teacher Dashboard: Real-time revenue trackers, active student counts, and booking request statistics.
- Availability Planner: Fully control active time slots organized by month and year.
- Hiring Portal: View incoming session requests with the ability to accept or decline student bookings.
- Professional Profiles: Edit professional biography, hourly rates, experience years, subject expertise, and location.
- Platform Dashboard: Deep analytical dashboards showing active partnerships, overall revenue volume, and complete user breakdown.
- Mentor Verification: Secure onboarding flow where admins review, approve, and verify teachers to list them in the discovery engine.
- User Control: Instant status toggles to manage platform access.
ADHYA's architecture follows a classic decoupled full-stack paradigm, utilizing a client-server architecture with persistent data caching and bidirectional socket connections:
graph TD
subgraph Client Tier [Client Tier React & Vite]
React[React Client App]
Axios[Axios Interceptors]
WS_Client[WebSocket Client]
end
subgraph Service Tier [Service Tier FastAPI Web App]
FastAPI[FastAPI Gateway]
Auth[OAuth2 JWT Auth Router]
Admin[Admin Analytics Hub]
BookingSvc[Booking Handler]
WS_Svc[WebSocket Connection Manager]
end
subgraph Data Tier [Data Database Engine]
SQLA[SQLAlchemy ORM]
PG[(PostgreSQL Database)]
end
%% Client Interactions
React -->|User Interactions| Axios
React -->|Real-time Events| WS_Client
%% API Interactions
Axios -->|HTTPS / REST API| FastAPI
WS_Client -->|ws:// WebSockets| WS_Svc
%% Service Internal
FastAPI --> Auth
FastAPI --> Admin
FastAPI --> BookingSvc
%% Database Connection
Auth --> SQLA
Admin --> SQLA
BookingSvc --> SQLA
WS_Svc -->|run_in_threadpool| SQLA
SQLA -->|Database Sessions| PG
The database structure is designed to enforce domain boundaries and ensure strict audit logs for billing and booking transactions:
erDiagram
users {
int id PK
string email UK
string password
string role
boolean is_verified
string interview_status
datetime created_at
}
teacher_profiles {
int id PK
int user_id FK
string full_name
string subject
text bio
int experience_years
int monthly_rate
string profile_picture
string city
}
student_profiles {
int id PK
int user_id FK
string full_name
string grade_class
string city
string profile_picture
}
teacher_availability {
int id PK
int teacher_id FK
string month_year
string time_slot
boolean is_active
}
bookings {
int id PK
int student_id FK
int teacher_id FK
string subject
string month_year
string time_slot
string status
datetime created_at
}
conversations {
int id PK
int student_id FK
int tutor_id FK
string status
datetime created_at
}
chat_messages {
int id PK
int conversation_id FK
int sender_id FK
text content
datetime timestamp
}
reviews {
int id PK
int student_id FK
int teacher_id FK
int booking_id FK
int rating
string comment
datetime created_at
}
achievements {
int id PK
string student_name
string score
string subject
string detail
int teacher_id FK
string color_theme
boolean is_featured
datetime created_at
}
users ||--o| teacher_profiles : "has profile"
users ||--o| student_profiles : "has profile"
users ||--o{ teacher_availability : "provides"
users ||--o{ bookings : "creates/handles"
users ||--o{ conversations : "participates"
conversations ||--|{ chat_messages : "contains"
bookings ||--o| reviews : "receives rating"
users ||--o{ achievements : "mentored"
- User Profiles Split: A single
usersentity contains authorization credentials and platform roles. Mentors and Students populate distinct profiles (teacher_profiles,student_profiles) linked via 1-to-1 relationships to preserve clean schema attributes. - Booking-Gated Review Engine: A
Reviewrecord cannot exist without a reference to a validBooking. This database constraint prevents spam, verifying that feedback can only be posted by a student who booked the tutor. - Availability Slot Triggers: When a booking is marked
accepted, availability checks dynamically label corresponding time slots asis_bookedfor other students.
- Stateless JWT Authentication: Passwords are encrypted using
bcrypt. Login requests yield signed JSON Web Tokens (JWT) containing token validity constraints and user roles. - Route-Level Guards: FastAPI dependency injection evaluates security tokens for each restricted endpoint. Roles are validated at the route boundary, preventing students from accessing mentor statistics or modification routes.
- Axios Interceptors: The client application implements request interceptors to automatically insert the authentication token (
Authorization: Bearer <token>) and response interceptors to catch401 Unauthorizederrors, automatically wiping local storage and redirecting expired sessions to the login page.
FastAPI executes operations asynchronously. However, standard SQL query execution via SQLAlchemy can block the system's asynchronous event loop.
- ThreadPool Delegation: During real-time WebSocket communication, database read/writes are wrapped inside
run_in_threadpoolexecution blocks. This offloads blocking database operations to worker threads, ensuring the WebSocket gateway can scale and handle active connections simultaneously. - Connection Pool Pre-Pings: The system configures the SQLAlchemy engine with
pool_pre_ping=Trueto proactively test database connections before allocating sessions, preventing crash exceptions during long-running background tasks.
ADHYA implements a WebSocket connection manager with an active, permission-gated chat cycle:
- First Inquiry: Students are allowed to send an initial message to a verified tutor.
- Gatekeeping: Once the inquiry is sent, the conversation status changes to
pendingand subsequent student messages are locked. - Unlock Trigger: The chat unlocks to
activeimmediately when either:- The mentor sends a reply back.
- An active session booking is accepted by the tutor.
graph TD
A[Student starts conversation] -->|First Message| B(Conversation Status: Pending)
B -->|Student attempts to message again| C[Blocked: Waiting for Tutor Reply]
B -->|Tutor replies OR Booking is accepted| D(Conversation Status: Active)
D -->|Bi-directional chat enabled| E[Unrestricted Real-time Messaging]
ADHYA-FullStack/
βββ app/ # π FastAPI Backend codebase
β βββ crud/ # Database Query Logic (Chat control, etc.)
β βββ routers/ # Modular API Route Controllers (Auth, Bookings, etc.)
β βββ database.py # SQLAlchemy connection & DB session engines
β βββ main.py # Main API launch & CORS Configurations
β βββ models.py # SQLAlchemy DB schemas
β βββ oauth2.py # JWT Token validation middlewares
β βββ schemas.py # Pydantic schemas (Serialization & Request Validation)
β βββ utils.py # Password hashing & JWT helpers
β βββ seed_admin.py # Admin bootstrapping seed script
βββ front/ # βοΈ React & Tailwind v4 Frontend
β βββ src/
β β βββ api/ # Axios core configuration & interceptors
β β βββ components/ # Shared UI Components (Hero, Slider, SuccessWall, etc.)
β β βββ pages/ # Core views (Dashboards, Chat, Profiles, Auth)
β β βββ App.jsx # Main routing & state controller
β βββ package.json # Node modules, Vite & Tailwind configuration
βββ migrations/ # βοΈ Alembic database migration scripts
βββ alembic.ini # Alembic configuration profile
βββ requirements.txt # Python dependency manifests
βββ .env # Global environment configurations
Create a file named .env in the root folder. You can configure it as follows:
| Environment Variable | Description | Example Value |
|---|---|---|
DATABASE_URL |
PostgreSQL connection string | postgresql://postgres:pass@127.0.0.1:5432/tutor_db |
SECRET_KEY |
Signature key for generating JWT sessions | 4f9a2b8e1c3d7f5a... |
ALGORITHM |
JWT token hashing algorithm | HS256 |
ACCESS_TOKEN_EXPIRE_MINUTES |
Token validity duration | 60 |
ADMIN_EMAIL |
Default administrator account email | admin@adhya.com |
ADMIN_PASSWORD |
Default administrator account password | YourAdminPass |
Note: The frontend project folder also contains a local .env defining the backend target: VITE_API_URL=http://127.0.0.1:8000/api.
Ensure you have PostgreSQL running. Run the following command in your PostgreSQL terminal/admin dashboard to create the database:
CREATE DATABASE tutor_db;Open a terminal in the root directory:
# 1. Create a virtual environment
python -m venv venv
# 2. Activate the virtual environment
# On Windows:
.\venv\Scripts\activate
# On Linux/macOS:
source venv/bin/activate
# 3. Install requirements
pip install -r requirements.txt
# 4. Apply Database Migrations (Or let FastAPI auto-generate tables on run)
alembic upgrade head
# 5. Bootstrapping/Seeding the Admin User
python app/seed_admin.py
# 6. Run the FastAPI development server
uvicorn app.main:app --reloadThe backend API documentation will be available at http://127.0.0.1:8000/docs.
Open another terminal pane in the front/ directory:
# 1. Navigate to the frontend directory
cd front
# 2. Install NPM dependencies
npm install
# 3. Run the Vite development server
npm run devThe React development interface will be online at http://localhost:5173/.
POST /api/auth/login- Authenticate users and acquire JWT tokens.POST /api/users- Create student or teacher profiles.
GET /api/profiles/all- Query verified tutors with flexible filter metrics (subject,min_price,max_price,city,min_experience).GET /api/profiles/user/{u_id}- Retrieve a detailed teacher profile.
GET /api/profiles/availability/{teacher_id}- Retrieve active time slots for a mentor.POST /api/profiles/availability- Set new time slots (Tutors only).DELETE /api/profiles/availability/{slot_id}- Delete availability slots.
POST /api/bookings- Submit session hire request.GET /api/profiles/bookings- Access incoming hire requests.PATCH /api/profiles/bookings/{booking_id}- Accept/reject requests.
- Connection Endpoint:
ws://127.0.0.1:8000/api/chat/ws/{user_id} - JSON Payload Format:
{ "receiver_id": 10, "content": "Hello! I am looking for mathematics guidance." }
- Interactive Motion Engine: Powered by
framer-motionto produce smooth, non-intrusive micro-animations on cards, buttons, and navigation elements. - Responsive Sliding Galleries: Integrated
swiperto present mentor portfolios, student reviews, and featured subjects. - Glassmorphic Design Tokens: Custom background colors (
#f7fdfd), elegant header components, and high-contrast styling details powered by Tailwind CSS v4. - Status Management: Active user sessions are securely managed using JWT local storage integrations and live status headers.