A complete microservices application that generates structured course outlines using AI. Built with Node.js, Python Flask, and React.
The application follows a microservices architecture with three main components:
- Frontend: React application with Tailwind CSS
- API Gateway: Node.js/Express service that handles routing and communication
- AI Service: Python Flask service that integrates with Google's Gemini AI
/ai-course-builder
โโโ /backend
โ โโโ /api-gateway # Node.js API Gateway service
โ โโโ /ai-service # Python AI service with Gemini integration
โโโ /frontend # React frontend application
- Node.js 16+
- Python 3.8+
- Google Gemini API key
git clone <repository-url>
cd ai-course-buildercd backend/ai-service
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Set environment variables
cp env.example .env
# Edit .env and add your GEMINI_API_KEY
# Start the service
python app.pyThe AI service will run on http://localhost:5001
cd ../api-gateway
# Install dependencies
npm install
# Set environment variables
cp env.example .env
# Edit .env if you need to change the AI service URL
# Start the service
npm run devThe API Gateway will run on http://localhost:5000
cd ../../frontend
# Install dependencies
npm install
# Start the development server
npm run devThe frontend will run on http://localhost:3000
GEMINI_API_KEY=your_gemini_api_key_here
PORT=5001
FLASK_ENV=development
PORT=5000
NODE_ENV=development
AI_SERVICE_URL=http://localhost:5001
GET /health- Health checkPOST /generate- Generate course outline
GET /health- Health checkPOST /api/generate-course- Generate course (forwards to AI service)POST /api/save-course- Save course (placeholder for Firebase)GET /api/courses- Get saved courses (placeholder)
- Start all services in the order: AI Service โ API Gateway โ Frontend
- Open the frontend at
http://localhost:3000 - Enter a course description in the text area
- Click "Generate Course" to create a course outline
- Review the generated course with modules, lessons, and quizzes
- Save the course or generate a new one
# AI Service
cd backend/ai-service
python app.py
# API Gateway
cd backend/api-gateway
npm run dev
# Frontend
cd frontend
npm run dev# Frontend
cd frontend
npm run build
# API Gateway
cd backend/api-gateway
npm start
# AI Service
cd backend/ai-service
python app.pyThe AI service uses Google's Gemini Pro model to generate course content. The service:
- Accepts user prompts for course generation
- Uses a structured schema to ensure consistent output
- Returns JSON with course title, modules, lessons, and quizzes
- Handles API errors gracefully
The AI service generates courses with this structure:
{
"courseTitle": "string",
"modules": [
{
"moduleTitle": "string",
"description": "string",
"lessons": [
{
"lessonTitle": "string",
"content": "string",
"duration": "string"
}
],
"quizzes": [
{
"question": "string",
"options": ["A", "B", "C", "D"],
"correctAnswer": "A",
"explanation": "string"
}
]
}
]
}-
AI Service Connection Error
- Ensure the Python service is running on port 5001
- Check that the GEMINI_API_KEY is set correctly
-
Frontend Can't Connect to Backend
- Verify both backend services are running
- Check the proxy configuration in
vite.config.js
-
Course Generation Fails
- Check the Gemini API key and quota
- Review the AI service logs for detailed error messages
- AI Service: Check the Python console output
- API Gateway: Check the Node.js console output
- Frontend: Check the browser console and network tab
- Firebase Firestore integration for course persistence
- User authentication and course management
- Course export to various formats (PDF, SCORM)
- Advanced course customization options
- Progress tracking and analytics
- Multi-language support
MIT License - see LICENSE file for details
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
For issues and questions:
- Check the troubleshooting section
- Review the logs for error details
- Open an issue on the repository