Educational content sharing with file uploads & rich markdown support

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.
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/tutorialsCreate 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"
}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
});Page Load Time
< 1.5s
Search Query Time
< 200ms
File Upload Speed
~2MB/s
Hosted 200+ tutorials across 15 subject categories
Active user base of 100+ students and educators
Average session duration of 12 minutes
Code Coverage
Test Types


