Build your skills with interactive, visual learning journeys tailored to your goals
React 19 - Modern React with hooks and concurrent features
TypeScript - Type-safe development experience
Vite - Lightning-fast build tool and dev server
Tailwind CSS - Utility-first CSS framework
Lucide React - Beautiful, customizable icon library
React Flow - Interactive node-based diagrams
Node.js - JavaScript runtime environment
Express.js - Fast, unopinionated web framework
MongoDB - NoSQL document database
Mongoose - Elegant MongoDB object modeling
JWT - Secure token-based authentication
bcryptjs - Advanced password hashing
express-validator - Server-side input validation
helmet - Security middleware collection
cors - Cross-origin resource sharing
๐ฆ LearnAI/
โโโ ๐จ src/ # Frontend React application
โ โโโ ๐งฉ components/ # Reusable UI components
โ โ โโโ ui/ # Base UI components (Button, Card, etc.)
โ โ โโโ layout/ # Layout components (Header, Sidebar)
โ โ โโโ forms/ # Form components
โ โโโ ๐ pages/ # Page components and route handlers
โ โ โโโ auth/ # Authentication pages
โ โ โโโ dashboard/ # Dashboard and user pages
โ โ โโโ roadmap/ # Roadmap-related pages
โ โโโ ๐ง utils/ # Utility functions
โ โ โโโ auth.ts # Authentication helpers
โ โ โโโ api.ts # API client configuration
โ โ โโโ constants.ts # Application constants
โ โโโ ๐ types/ # TypeScript type definitions
โ โโโ ๐ญ mockData/ # Mock data for development
โโโ ๐ฅ๏ธ backend/ # Backend Node.js application
โ โโโ โ๏ธ config/ # Configuration files
โ โ โโโ database.js # MongoDB connection setup
โ โโโ ๐ฎ controllers/ # Business logic controllers
โ โ โโโ authController.js # Authentication logic
โ โ โโโ userController.js # User management
โ โ โโโ roadmapController.js # Roadmap operations
โ โโโ ๐ก๏ธ middleware/ # Express middleware
โ โ โโโ auth.js # JWT authentication middleware
โ โ โโโ validation.js # Input validation
โ โ โโโ rateLimiter.js # Rate limiting
โ โโโ ๐ models/ # Database models
โ โ โโโ User.js # User model schema
โ โ โโโ Roadmap.js # Roadmap model schema
โ โ โโโ Progress.js # Progress tracking schema
โ โโโ ๐ฃ๏ธ routes/ # API route definitions
โ โ โโโ auth.js # Authentication routes
โ โ โโโ users.js # User management routes
โ โ โโโ roadmaps.js # Roadmap routes
โ โโโ ๐ง utils/ # Backend utility functions
โโโ ๐ docs/ # Documentation files
โโโ ๐งช tests/ # Test files
โโโ ๐ README.md
Requirement | Version | Download |
---|---|---|
Node.js | 18.0+ | Download |
MongoDB | 6.0+ | Download or Atlas |
Package Manager | npm/yarn | Included with Node.js |
# Clone the repository
git clone https://github.com/yourusername/LearnAI.git
cd LearnAI
# Install frontend dependencies
npm install
# Install backend dependencies
cd backend
npm install
cd ..
Create backend/.env
:
cd backend
cp .env.example .env
Configure your environment variables:
# ๐ง Server Configuration
PORT=5000
NODE_ENV=development
# ๐๏ธ MongoDB Configuration
MONGODB_URI=mongodb://localhost:27017/LearnAI
# For Atlas: mongodb+srv://username:[email protected]/LearnAI
# ๐ JWT Configuration
JWT_SECRET=your-super-secret-jwt-key-min-32-chars-change-in-production
JWT_EXPIRES_IN=7d
# ๐ CORS Configuration
FRONTEND_URL=http://localhost:5173
# ๐ก๏ธ Security Configuration
RATE_LIMIT_WINDOW_MS=900000 # 15 minutes
RATE_LIMIT_MAX_REQUESTS=100 # Max 100 requests per window
# ๐ง Email Configuration (Optional)
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=[email protected]
SMTP_PASS=your-app-password
Create root .env
:
# API Configuration
VITE_API_URL=http://localhost:5000/api
# Feature Flags
VITE_ENABLE_ANALYTICS=false
VITE_ENABLE_DEBUG=true
# Install MongoDB locally
# macOS with Homebrew
brew install mongodb-community
# Start MongoDB service
brew services start mongodb-community
# Or start manually
mongod --config /usr/local/etc/mongod.conf
- ๐ Create a MongoDB Atlas account
- ๐ Create a new cluster
- ๐ค Create a database user
- ๐ Whitelist your IP address
- ๐ Get your connection string
- โ๏ธ Update
MONGODB_URI
in your.env
file
cd backend
npm run dev
๐ Backend runs on: http://localhost:5000
# In a new terminal from root directory
npm run dev
๐ Frontend runs on: http://localhost:5173
Service | URL | Status |
---|---|---|
๐จ Frontend | http://localhost:5173 | Should show login page |
๐ฅ๏ธ Backend Health | http://localhost:5000/health | Should return {"status":"OK"} |
๐๏ธ Database | MongoDB Compass | Connect with your URI |
POST /api/auth/signup - Register new user
Request Body:
{
"name": "John Doe",
"email": "[email protected]",
"password": "SecurePassword123!"
}
Response:
{
"success": true,
"message": "User created successfully",
"data": {
"user": {
"id": "user_id",
"name": "John Doe",
"email": "[email protected]"
},
"token": "jwt_token_here"
}
}
POST /api/auth/signin - Login user
Request Body:
{
"email": "[email protected]",
"password": "SecurePassword123!"
}
Response:
{
"success": true,
"message": "Login successful",
"data": {
"user": {
"id": "user_id",
"name": "John Doe",
"email": "[email protected]"
},
"token": "jwt_token_here"
}
}
GET /api/auth/me - Get current user
Headers:
Authorization: Bearer jwt_token_here
Response:
{
"success": true,
"data": {
"user": {
"id": "user_id",
"name": "John Doe",
"email": "[email protected]",
"createdAt": "2024-01-01T00:00:00.000Z"
}
}
}
GET /api/roadmaps - Get user's roadmaps
Headers:
Authorization: Bearer jwt_token_here
Response:
{
"success": true,
"data": {
"roadmaps": [
{
"id": "roadmap_id",
"title": "Full Stack Development",
"description": "Complete web development roadmap",
"progress": 45,
"totalSteps": 12,
"completedSteps": 5
}
]
}
}
Security Layer | Implementation | Protection Against |
---|---|---|
๐ Password Security | bcrypt with salt rounds | Rainbow table attacks |
๐ซ JWT Authentication | Secure token-based auth | Session hijacking |
๐ฆ Rate Limiting | Express rate limiter | Brute force attacks |
๐ CORS Protection | Configured origins | Cross-origin attacks |
โ Input Validation | express-validator | Injection attacks |
๐ก๏ธ HTTP Security | Helmet middleware | Various web vulnerabilities |
npm run dev # ๐ Start development server
npm run build # ๐๏ธ Build for production
npm run preview # ๐ Preview production build
npm run lint # ๐ Run ESLint
npm run type-check # ๐ Run TypeScript checks
npm run dev # ๐ Start with nodemon (hot reload)
npm start # ๐ Start production server
npm run test # ๐งช Run tests
npm run seed # ๐ฑ Seed database with sample data
- ๐ Hot Reloading: Both frontend and backend support hot reloading
- ๐จ Code Formatting: Prettier configuration included
- ๐ Linting: ESLint rules for consistent code style
- ๐ TypeScript: Full type safety on frontend
- ๐งช Testing: Jest setup for unit and integration tests
๐ฆ Architecture Pattern: Feature-based modules
โโโ ๐งฉ Components: Reusable UI building blocks
โโโ ๐ Pages: Route-level components
โโโ ๐ฎ Controllers: Business logic handlers
โโโ ๐ Models: Data structure definitions
โโโ ๐ก๏ธ Middleware: Request/response interceptors
โโโ ๐ง Utils: Helper functions and utilities
Platform | Complexity | Free Tier | Guide |
---|---|---|---|
๐ Railway | Easy | โ Yes | Deploy |
โฒ Vercel | Easy | โ Yes | Deploy |
๐ฃ Heroku | Medium | โ No | Deploy |
๐ DigitalOcean | Medium | ๐ฐ Credit | Deploy |
# Build the application
npm run build
# Deploy options:
# 1. Vercel: vercel --prod
# 2. Netlify: ntl deploy --prod --dir=dist
# 3. GitHub Pages: npm run deploy
# Production Backend (.env)
NODE_ENV=production
MONGODB_URI=your_production_mongodb_uri
JWT_SECRET=your_super_secure_production_secret
FRONTEND_URL=https://your-domain.com
# Production Frontend (.env.production)
VITE_API_URL=https://your-api-domain.com/api
VITE_ENABLE_ANALYTICS=true
We welcome contributions! Please follow these steps:
- ๐ด Fork the repository
- ๐ฟ Create a feature branch:
git checkout -b feature/amazing-feature
- โจ Make your changes with proper commit messages
- ๐งช Add tests if applicable
- ๐ Update documentation if needed
- ๐ Submit a pull request
- โ Follow existing code patterns
- ๐ Use TypeScript for new frontend code
- ๐งช Add tests for new features
- ๐ Update documentation
- ๐ท๏ธ Use conventional commit messages
type(scope): description
feat(auth): add password reset functionality
fix(ui): resolve mobile navigation issue
docs(api): update endpoint documentation
- โก Code Splitting: Automatic route-based splitting
- ๐๏ธ Asset Optimization: Vite's built-in optimizations
- ๐พ Caching: Strategic API response caching
- ๐ฑ Lazy Loading: Components loaded on demand
// Performance monitoring (optional)
import { getCLS, getFID, getFCP, getLCP, getTTFB } from 'web-vitals';
getCLS(console.log);
getFID(console.log);
getFCP(console.log);
getLCP(console.log);
getTTFB(console.log);
โ Common Issues & Solutions
# Check if MongoDB is running
brew services list | grep mongodb
# Restart if needed
brew services restart mongodb-community
# Find process using port 5000
lsof -i :5000
# Kill the process
kill -9 PID
- Verify JWT_SECRET is set and consistent
- Check token expiration settings
- Ensure proper token storage on frontend
- Verify FRONTEND_URL matches your development URL
- Check browser network tab for preflight requests
- Ensure credentials are included in requests
Resource | Link | Description |
---|---|---|
๐ Documentation | View Docs | Comprehensive API and feature docs |
๐จ Design System | Design Guide | UI components and guidelines |
๐งช API Testing | Postman Collection | Ready-to-use API tests |
๐ฏ Roadmap | Project Roadmap | Upcoming features and timeline |
This project is licensed under the MIT License - see the LICENSE file for details.
Made with โค๏ธ by Aditya
โญ Star this project โข ๐ Report Bug โข ๐ก Request Feature
๐ Ready to build amazing learning experiences? Let's get started!