Skip to content

vvduth/dukem-learning

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

40 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Dukem Learning

An AI-powered learning platform that helps students study more effectively through intelligent document processing, flashcard generation, quizzes, and interactive AI chat.

Docker React Node AWS

Live Demo

https://dukem-learning.xyz alt text

πŸš€ Features

  • πŸ“„ Document Upload & Processing: Upload PDF and Markdown files for automatic text extraction and chunking
  • alt text
  • πŸ€– AI-Powered Study Tools:
    • Generate flashcards automatically from your documents
    • Create custom quizzes with multiple-choice questions
    • Get AI-generated summaries of complex materials
    • Interactive chat with document context (RAG)
  • Smart Flashcards: Review, star favorites, and track progress with spaced repetition
  • alt text
  • Quiz System: Take quizzes, get instant feedback, and track scores
  • Progress Dashboard: Monitor your study statistics, streaks, and achievements
  • Secure Authentication: JWT-based user authentication and authorization

alt text

Tech Stack

Frontend

  • React 19 with TypeScript
  • Vite for fast development and optimized builds
  • Tailwind CSS v4 for modern, responsive styling
  • React Router v7 for client-side routing
  • Axios for API communication
  • React Hot Toast for notifications

Backend

  • Node.js with Express 5
  • TypeScript for type safety
  • MongoDB Atlas for cloud database
  • Mongoose for object modeling
  • JWT for authentication
  • Multer for file uploads
  • Helmet for security headers

AI Integration

  • Google Gemini AI for content generation
  • RAG (Retrieval-Augmented Generation) for context-aware responses
  • Text Chunking for efficient document processing
  • PDF Parser for text extraction

DevOps

  • Docker & Docker Compose for containerization
  • Nginx for reverse proxy and static file serving
  • Let's Encrypt for SSL certificates (production)
  • GitHub Actions ready for CI/CD

Prerequisites

  • Node.js 20.x or higher
  • Docker & Docker Compose
  • MongoDB Atlas account (or local MongoDB)
  • Google Gemini API key

Quick Start

1. Clone the Repository

git clone https://github.com/vvduth/dukem-learning.git
cd dukem-learning

2. Set Up Environment Variables

Create a .env file in the project root:

# MongoDB Connection
MONGO_URI=mongodb+srv://username:password@cluster.mongodb.net/database

# JWT Secret (generate a strong random string)
JWT_SECRET=your-super-secret-jwt-key-change-this-in-production

# Google Gemini API Key
GOOGLE_API_KEY=your-google-gemini-api-key

3. Run with Docker Compose (Recommended)

# Build and start all services
docker-compose up -d

# Check status
docker-compose ps

# View logs
docker-compose logs -f

Access the application:

  • Frontend: http://localhost
  • Backend API: http://localhost:5000

4. Run Locally (Development)

Backend:

cd backend
npm install
npm run dev

Frontend:

cd frontend
npm install
npm run dev

Access the application:

  • Frontend: http://localhost:5173
  • Backend API: http://localhost:5000

🐳 Docker Deployment

Build and Push Images

# Build images
docker build -t vvduth/dukem-learning-backend:latest ./backend
docker build -t vvduth/dukem-learning-frontend:latest ./frontend

# Push to Docker Hub
docker push vvduth/dukem-learning-backend:latest
docker push vvduth/dukem-learning-frontend:latest

Deploy to EC2 (Production)

See DEPLOYMENT.md for detailed deployment instructions including:

  • AWS EC2 setup
  • Domain configuration
  • SSL certificate setup
  • Performance optimization for t3.micro instances

πŸ“ Project Structure

dukem-learning/
β”œβ”€β”€ backend/                 # Node.js Express backend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ controllers/    # Request handlers
β”‚   β”‚   β”œβ”€β”€ models/         # Mongoose schemas
β”‚   β”‚   β”œβ”€β”€ routes/         # API routes
β”‚   β”‚   β”œβ”€β”€ middleware/     # Auth & error handling
β”‚   β”‚   β”œβ”€β”€ utils/          # AI services & helpers
β”‚   β”‚   └── index.ts        # Entry point
β”‚   β”œβ”€β”€ uploads/            # File storage
β”‚   └── Dockerfile
β”‚
β”œβ”€β”€ frontend/               # React frontend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/    # Reusable components
β”‚   β”‚   β”œβ”€β”€ pages/         # Page components
β”‚   β”‚   β”œβ”€β”€ services/      # API service layer
β”‚   β”‚   β”œβ”€β”€ context/       # React context (Auth)
β”‚   β”‚   β”œβ”€β”€ utils/         # Axios instance, helpers
β”‚   β”‚   └── types/         # TypeScript definitions
β”‚   β”œβ”€β”€ nginx.conf         # Nginx configuration
β”‚   └── Dockerfile
β”‚
β”œβ”€β”€ docker-compose.yml     # Docker orchestration
β”œβ”€β”€ .env.example           # Environment template
└── README.md

πŸ”‘ Key Features Explained

RAG (Retrieval-Augmented Generation)

The platform uses RAG to provide context-aware AI responses:

  1. Document Upload: PDFs/Markdown files are uploaded and text is extracted
  2. Text Chunking: Documents are split into manageable chunks
  3. Semantic Search: Relevant chunks are retrieved based on user queries
  4. AI Generation: Google Gemini uses retrieved context to generate accurate responses

Document Processing Flow

Upload β†’ Parse (PDF/MD) β†’ Extract Text β†’ Chunk β†’ Store β†’ AI Process

Authentication Flow

Register β†’ JWT Token β†’ Store in localStorage β†’ Auto-attach to requests

πŸ”§ Configuration

Backend Configuration

Edit backend/src/index.ts for:

  • CORS origins
  • Port settings
  • Middleware configuration
  • Static file serving

Frontend Configuration

Edit frontend/src/utils/apiPaths.ts for:

  • API base URL
  • Endpoint paths

Nginx Configuration

Edit frontend/nginx.conf for:

  • Reverse proxy settings
  • SSL certificates (production)
  • Caching rules

πŸ“Š API Endpoints

Authentication

  • POST /api/auth/register - Register new user
  • POST /api/auth/login - Login user
  • GET /api/auth/profile - Get user profile
  • PUT /api/auth/profile - Update profile
  • POST /api/auth/change-password - Change password

Documents

  • POST /api/documents/upload - Upload document
  • GET /api/documents - Get all documents
  • GET /api/documents/:id - Get document by ID
  • DELETE /api/documents/:id - Delete document

AI Services

  • POST /api/ai/generate-flashcards - Generate flashcards
  • POST /api/ai/generate-quiz - Generate quiz
  • POST /api/ai/generate-summary - Generate summary
  • POST /api/ai/chat - Chat with document context
  • POST /api/ai/explain-concept - Explain concept

Flashcards

  • GET /api/flashcards/:documentId - Get flashcards by document
  • POST /api/flashcards/:cardId/review - Mark card as reviewed
  • POST /api/flashcards/:cardId/star - Toggle star
  • DELETE /api/flashcards/:setId - Delete flashcard set

Quizzes

  • GET /api/quizzes/:documentId - Get quizzes by document
  • GET /api/quizzes/quiz/:id - Get quiz by ID
  • POST /api/quizzes/:id/submit - Submit quiz answers
  • GET /api/quizzes/:id/results - Get quiz results

Progress

  • GET /api/progress/dashboard - Get dashboard statistics

Monitoring

# View container stats
docker stats

# Check logs
docker-compose logs -f

# Monitor system resources
htop
free -h
df -h

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ‘¨β€πŸ’» Author

Duc Thai

πŸ™ Acknowledgments

  • Google Gemini AI for powerful language model capabilities
  • MongoDB Atlas for reliable cloud database hosting
  • React team for the excellent frontend framework
  • Docker for simplifying deployment

πŸ“ž Support

For issues, questions, or suggestions:

  • Open an issue on GitHub
  • Check DEPLOYMENT.md for deployment help
  • Review .github/copilot-instructions.md for AI coding guidelines

πŸ”„ Updates

See CHANGELOG.md for version history and updates.


Live Demo: https://dukem-learning.xyz

Deployed on: AWS EC2 (t3.micro) with Docker containers

Packages

 
 
 

Contributors

Languages