A full-stack learning platform that allows users to learn topics using AI-generated lessons.
- Node.js with NestJS framework
- Prisma ORM with PostgreSQL
- OpenAI GPT API for lesson generation
- TypeScript for type safety
- Class Validator for input validation
- React with TypeScript
- Chakra UI for modern UI components
- Axios for API calls
- React Router for navigation
- Docker Compose for database setup
- ESLint and Prettier for code quality
ai-learning-platform/
โโโ backend/ # NestJS backend
โ โโโ src/
โ โ โโโ users/ # Users module
โ โ โโโ categories/ # Categories module
โ โ โโโ prompts/ # Prompts module
โ โ โโโ ai/ # AI service integration
โ โ โโโ prisma/ # Prisma service
โ โโโ prisma/ # Database schema
โ โโโ package.json
โโโ frontend/ # React frontend
โ โโโ src/
โ โ โโโ components/ # Reusable components
โ โ โโโ pages/ # Page components
โ โ โโโ api/ # API client
โ โ โโโ types/ # TypeScript types
โ โโโ package.json
โโโ docker-compose.yml # Docker configuration
โโโ README.md
- Node.js (v18+)
- npm or yarn
- Docker and Docker Compose
- OpenAI API key
git clone <your-repo-url>
cd ai-learning-platformdocker-compose up -dcd backend
npm install
cp .env.example .env
# Edit .env and add your OpenAI API key
npx prisma migrate dev
npx prisma generate
npm run start:devBackend will run on http://localhost:3000
cd frontend
npm install
npm startFrontend will run on http://localhost:3001
curl -X POST http://localhost:3000/categories/seedDATABASE_URL="postgresql://user:password@localhost:5433/ai_learning_db"
OPENAI_API_KEY="your-openai-api-key"
PORT=3000
JWT_SECRET="your-super-secret-jwt-key-change-in-production"
REACT_APP_API_URL=http://localhost:3000
Swagger UI available at: http://localhost:3000/api-docs
POST /auth/login- Login with phone and password (returns JWT token)
POST /users- Register new user (name, phone, password)GET /users- Get all users (requires ADMIN role)GET /users/:id- Get user by ID (requires authentication)PATCH /users/:id/role- Update user role (requires ADMIN role)
GET /categories- Get all categories with subcategoriesPOST /categories/seed- Seed initial categories
POST /prompts- Create new prompt and generate lesson (requires authentication)GET /prompts/user/:userId- Get user's learning history (requires authentication)GET /prompts- Get all prompts (requires ADMIN role)
- โ User registration with name, phone, and password
- โ JWT-based authentication with bcrypt password hashing
- โ Role-based access control (USER/ADMIN)
- โ Category and subcategory selection
- โ AI-powered lesson generation using OpenAI
- โ Learning history tracking
- โ Admin dashboard to view all users and their prompts
- โ Clean architecture with separated layers
- โ Input validation and error handling
- โ TypeScript for type safety
- โ Responsive UI with Chakra UI
- โ
Swagger/OpenAPI documentation at
/api-docs - โ Docker Compose for easy database setup
- โ Environment variable management
# Backend tests
cd backend
npm run test
# Frontend tests
cd frontend
npm run test- Set environment variables
- Run migrations:
npx prisma migrate deploy - Start server:
npm run start:prod
- Set
REACT_APP_API_URLto your backend URL - Build:
npm run build - Deploy the
buildfolder
- Phone numbers are unique identifiers (10 digits)
- OpenAI API is used for lesson generation (with fallback mock)
- PostgreSQL is the primary database (port 5433)
- JWT tokens are valid for 7 days
- Passwords are hashed with bcrypt (10 rounds)
- Default user role is USER, can be upgraded to ADMIN
- Admin features require ADMIN role
- Israel visits the platform
- He registers with his name, phone number, and password
- He logs in with his phone and password
- He selects Science โ Space
- He enters: "Teach me about black holes"
- The AI generates a comprehensive lesson
- He can view all his past lessons in the "My History" section
- He can logout securely
- Admin users can access the admin dashboard to see all users and their learning activity
- User profiles with avatars
- Password reset functionality
- Lesson bookmarking and favorites
- Search and filter in history
- Export lessons as PDF
- Real-time notifications
- Progress tracking and analytics
- Social features (share lessons)
# Run backend in dev mode
cd backend && npm run start:dev
# Run frontend in dev mode
cd frontend && npm start
# Format code
npm run format
# Lint code
npm run lintMIT
Contributions are welcome! Please feel free to submit a Pull Request.
Built with โค๏ธ for learning
For detailed step-by-step setup instructions in Hebrew, see SETUP-GUIDE.md
Note: This project includes Swagger/OpenAPI documentation. After starting the backend, visit http://localhost:3000/api-docs to explore and test all API endpoints interactively.