|
1 | | -# AITutor — Production-Ready Web App |
2 | | - |
3 | | -Tutor for Indian students. Enter any topic, get a clear explanation, then take a 10-question mock test grounded in that explanation. |
4 | | - |
5 | | -## Tech Stack |
6 | | - |
7 | | -| Layer | Technology | |
8 | | -|-----------|-----------------------------------------| |
9 | | -| Frontend | Next.js 14 (App Router), TypeScript, Tailwind CSS | |
10 | | -| Backend | FastAPI, Python 3.12, Pydantic v2 | |
11 | | -| API | OpenRouter → GPT-OSS 120B (deep reasoning) | |
12 | | -| Deploy | Docker + docker-compose | |
13 | | - |
14 | | -## Project Structure |
15 | | - |
16 | | -``` |
17 | | -aitutor/ |
18 | | -├── src/ |
19 | | -│ ├── backend/ |
20 | | -│ │ ├── app/ |
21 | | -│ │ │ ├── core/config.py # Settings (pydantic-settings) |
22 | | -│ │ │ ├── models/schemas.py # Request/response Pydantic models |
23 | | -│ │ │ ├── services/api_service.py # All API logic isolated here |
24 | | -│ │ │ ├── api/routes/tutor.py # FastAPI route handlers |
25 | | -│ │ │ └── main.py # App factory + middleware |
26 | | -│ │ ├── requirements.txt |
27 | | -│ │ ├── Dockerfile |
28 | | -│ │ └── .env.example |
29 | | -│ └── frontend/ |
30 | | -│ ├── app/ |
31 | | -│ │ ├── components/ |
32 | | -│ │ │ ├── layout/ # Navbar, Hero |
33 | | -│ │ │ ├── ui/ # Card, Button (reusable) |
34 | | -│ │ │ └── tutor/ # TutorApp, TopicInput, QuizView, etc. |
35 | | -│ │ ├── hooks/useLearn.ts # All client state + API calls |
36 | | -│ │ ├── lib/api.ts # Typed fetch wrapper |
37 | | -│ │ ├── types/index.ts # Shared TypeScript types |
38 | | -│ │ ├── layout.tsx |
39 | | -│ │ └── page.tsx |
40 | | -│ ├── public/manifest.json |
41 | | -│ ├── tailwind.config.ts |
42 | | -│ ├── next.config.mjs |
43 | | -│ └── Dockerfile |
44 | | -├── deployment/ # Deployment configurations |
45 | | -├── docs/ # Documentation |
46 | | -├── vercel.json # Vercel configuration |
47 | | -├── render.yaml # Render configuration |
48 | | -└── DEPLOYMENT.md # Deployment guide |
49 | | -``` |
50 | | - |
51 | | -## Quick Start (Local Dev) |
52 | | - |
53 | | -### Option 1: Using Modular Structure (Recommended) |
54 | | -```bash |
55 | | -# Backend |
56 | | -cd backend |
57 | | -cp .env.example .env |
58 | | -# Edit .env with your OPENROUTER_API_KEY |
59 | | -python -m uvicorn app.main:app --reload --port 8000 |
60 | | - |
61 | | -# Frontend (new terminal) |
62 | | -cd frontend |
63 | | -cp .env.example .env.local |
64 | | -npm install |
65 | | -npm run dev |
66 | | -``` |
67 | | - |
68 | | -### Option 2: Using Original Structure |
69 | | -```bash |
70 | | -# Backend |
71 | | -cd src/backend |
72 | | -source venv/bin/activate |
73 | | -python -m uvicorn app.main:app --reload --port 8000 |
74 | | - |
75 | | -# Frontend |
76 | | -cd src/frontend |
77 | | -npm install |
78 | | -npm run dev |
79 | | -``` |
80 | | - |
81 | | -### 3. Open Browser |
82 | | -Navigate to: http://localhost:3000 (or 3001/3002 if ports taken) |
83 | | - |
84 | | ---- |
85 | | - |
86 | | -## Production Deployment |
87 | | - |
88 | | -### 🚀 Quick Deploy (Modular Structure) |
89 | | -```bash |
90 | | -# Deploy both services |
91 | | -cd backend && ./deploy.sh |
92 | | -cd ../frontend && ./deploy.sh |
93 | | -``` |
94 | | - |
95 | | -### Option 1: Separate Modules (Recommended) |
96 | | -- **Backend**: See [backend/README.md](backend/README.md) → Deploy to Render |
97 | | -- **Frontend**: See [frontend/README.md](frontend/README.md) → Deploy to Vercel |
98 | | -- **Guide**: See [QUICK_DEPLOY.md](QUICK_DEPLOY.md) for step-by-step |
99 | | - |
100 | | -### Option 2: Original Structure |
101 | | -- See [DEPLOYMENT.md](DEPLOYMENT.md) for combined deployment |
102 | | - |
103 | | -### Option 3: Full Modular Setup |
104 | | -- See [MODULAR_DEPLOYMENT.md](MODULAR_DEPLOYMENT.md) for complete guide |
105 | | - |
106 | | ---- |
107 | | - |
108 | | -## Docker (Production) |
109 | | - |
110 | | -```bash |
111 | | -# Set your API key in src/backend/.env first |
112 | | -docker-compose up --build |
113 | | -``` |
114 | | - |
115 | | -Frontend → http://localhost:3000 |
116 | | -Backend API docs → http://localhost:8000/docs |
117 | | - |
118 | | -## API Endpoints |
119 | | - |
120 | | -| Method | Path | Description | |
121 | | -|--------|-------------------------|--------------------------------------| |
122 | | -| POST | /api/v1/tutor/learn | Generate explanation + quiz (30-60s) | |
123 | | -| POST | /api/v1/tutor/score | Score quiz answers (instant) | |
124 | | -| GET | /api/v1/tutor/health | Health check | |
125 | | -| GET | /docs | Swagger UI | |
126 | | - |
127 | | -### POST /api/v1/tutor/learn |
128 | | -```json |
129 | | -{ "topic": "Photosynthesis", "language": "en" } |
130 | | -``` |
131 | | - |
132 | | -**Response:** |
133 | | -```json |
134 | | -{ |
135 | | - "topic": "Photosynthesis", |
136 | | - "explanation": "Photosynthesis is the process by which...", |
137 | | - "quiz": [ |
138 | | - { |
139 | | - "question": "According to the explanation...", |
140 | | - "options": ["A) ...", "B) ...", "C) ...", "D) ..."], |
141 | | - "answer": 0, |
142 | | - "explanation": "...", |
143 | | - "difficulty": 1 |
144 | | - } |
145 | | - ] |
146 | | -} |
147 | | -``` |
148 | | - |
149 | | -## Environment Variables |
150 | | - |
151 | | -Create `.env.local` from `.env.example`: |
152 | | - |
153 | | -```bash |
154 | | -# Required |
155 | | -OPENROUTER_API_KEY=sk-or-v1-your-key-here |
156 | | -NEXT_PUBLIC_API_URL=http://localhost:8000 |
157 | | - |
158 | | -# Optional |
159 | | -NODE_ENV=development |
160 | | -``` |
161 | | - |
162 | | -## Development |
163 | | - |
164 | | -### Code Quality |
165 | | -- TypeScript strict mode |
166 | | -- ESLint + Prettier |
167 | | -- Pre-commit hooks |
168 | | -- Docker support |
169 | | - |
170 | | -### Testing |
171 | | -```bash |
172 | | -# Backend tests |
173 | | -cd src/backend && python -m pytest |
174 | | - |
175 | | -# Frontend tests |
176 | | -cd src/frontend && npm test |
177 | | -``` |
178 | | - |
179 | | -## Production Features |
180 | | - |
181 | | -- Production-ready code |
182 | | -- Environment-based configuration |
183 | | -- Health checks |
184 | | -- Error handling |
185 | | -- CORS support |
186 | | -- Docker deployment |
187 | | -- Vercel + Render deployment guides |
188 | | -- Emoji-free UI (professional) |
189 | | -- Responsive design |
190 | | -- Three quiz modes (Standard, Adaptive, Swipe Cards) |
191 | | - |
192 | | -## License |
193 | | - |
194 | | -MIT License - see [LICENSE](LICENSE) for details. |
| 1 | +<div align="center"> |
| 2 | + |
| 3 | + <img src="https://img.shields.io/badge/Production%20Ready-Ready%20to%20Deploy-8B5CF6?style=for-the-badge&logo=rocket&logoColor=white" alt="Production Ready" /> |
| 4 | + |
| 5 | + <h1 style="font-size: 3.8rem; margin: 16px 0 8px; background: linear-gradient(90deg, #A78BFA, #C4B5FD, #DDD6FE); -webkit-background-clip: text; -webkit-text-fill-color: transparent; font-weight: 800;"> |
| 6 | + 🌊 AITutor 🌊 |
| 7 | + </h1> |
| 8 | + |
| 9 | + <h3 style="color: #64748B; font-weight: 500;">AI-Powered Tutor for Indian Students</h3> |
| 10 | + |
| 11 | + <p style="font-size: 1.35rem; max-width: 620px; margin: 20px auto;"> |
| 12 | + Enter <strong>any topic</strong> → Receive a crystal-clear explanation → Take a smart 10-question mock test grounded in what you just learned |
| 13 | + </p> |
| 14 | + |
| 15 | + <img src="https://api.pikwy.com/web/69a2a331decb0d637029bd48.png" |
| 16 | + alt="AITutor Preview" |
| 17 | + width="920" |
| 18 | + style="border-radius: 24px; box-shadow: 0 30px 80px -20px rgba(167, 139, 246, 0.5); margin: 30px 0 40px;"> |
| 19 | + |
| 20 | + <p> |
| 21 | + <img src="https://img.shields.io/badge/Next.js-14-black?style=for-the-badge&logo=nextdotjs&logoColor=white" /> |
| 22 | + <img src="https://img.shields.io/badge/FastAPI-009688?style=for-the-badge&logo=fastapi&logoColor=white" /> |
| 23 | + <img src="https://img.shields.io/badge/Python-3.12-3776AB?style=for-the-badge&logo=python&logoColor=white" /> |
| 24 | + <img src="https://img.shields.io/badge/Tailwind_CSS-06B6D4?style=for-the-badge&logo=tailwindcss&logoColor=white" /> |
| 25 | + <img src="https://img.shields.io/badge/Docker-2496ED?style=for-the-badge&logo=docker&logoColor=white" /> |
| 26 | + </p> |
| 27 | + |
| 28 | +</div> |
0 commit comments