Web Platform
2023
Full-Stack Developer

LearnHub - Tutorial Sharing Platform

Educational content sharing with file uploads & rich markdown support

LearnHub - Tutorial Sharing Platform preview

Overview

LearnHub is an educational platform that empowers users to create, share, and discover tutorials across various subjects. Built with a focus on ease of use, it features a robust authentication system, rich markdown editor for content creation, and secure file upload capabilities. The platform encourages knowledge sharing within educational communities and provides tools for organizing and discovering quality learning content.

System Architecture

Traditional MVC architecture with Express.js handling routing, MongoDB for document storage, and EJS for server-side rendering. Multer middleware processes file uploads with validation.

Architecture Diagram

API Documentation

POST/api/tutorials

Create a new tutorial with markdown content

Request Body:

{
  "title": "Introduction to Node.js",
  "content": "# Getting Started\n\nNode.js is...",
  "category": "Web Development",
  "tags": ["nodejs", "javascript"]
}

Response:

{
  "id": "tutorial_123",
  "slug": "introduction-to-nodejs",
  "createdAt": "2025-01-15T10:30:00Z"
}

Code Highlight

File Upload Middleware

javascript
const multer = require('multer');
const path = require('path');

const storage = multer.diskStorage({
  destination: (req, file, cb) => {
    cb(null, 'uploads/');
  },
  filename: (req, file, cb) => {
    const uniqueSuffix = Date.now() + '-' + Math.round(Math.random() * 1E9);
    cb(null, file.fieldname + '-' + uniqueSuffix + path.extname(file.originalname));
  }
});

const fileFilter = (req, file, cb) => {
  const allowedTypes = /jpeg|jpg|png|pdf|doc|docx/;
  const extname = allowedTypes.test(path.extname(file.originalname).toLowerCase());
  const mimetype = allowedTypes.test(file.mimetype);
  
  if (mimetype && extname) {
    return cb(null, true);
  }
  cb(new Error('Invalid file type'));
};

const upload = multer({ 
  storage, 
  fileFilter,
  limits: { fileSize: 5 * 1024 * 1024 } // 5MB
});

Performance Metrics

Page Load Time

< 1.5s

Search Query Time

< 200ms

File Upload Speed

~2MB/s

Challenges

  • 1Implementing secure file upload with validation
  • 2Designing an intuitive markdown editor experience
  • 3Building a scalable search and categorization system

Outcomes & Impact

Hosted 200+ tutorials across 15 subject categories

Active user base of 100+ students and educators

Average session duration of 12 minutes

Testing & Quality

Code Coverage

70%

Test Types

Unit TestsIntegration Tests

Gallery

LearnHub - Tutorial Sharing Platform screenshot 1
LearnHub - Tutorial Sharing Platform screenshot 2
LearnHub - Tutorial Sharing Platform screenshot 3

Tech Stack

Node.jsExpress.jsMongoDBPassport.jsMulterEJSBootstrap

Features

  • Secure user authentication with Passport.js
  • Rich markdown editor for tutorial creation
  • File upload and management system
  • User profile management and customization
  • Tutorial categorization and search
  • Comment and discussion system