Back to projects

LearnHub

A tutorial platform I built for sharing knowledge with other students.

I built LearnHub as my final project for a course at UTHM. I wanted to see if I could build a platform where students could help each other by contributing tutorials.

Why I made this

Most university projects are just static sites, but I wanted to try building something with a database where users could actually create content. I focused on making a simple markdown editor so students could easily share code snippets.

How it works

  • Express & MongoDB: I used the MEN stack (Express and MongoDB) because it's a great way to learn about document-based databases and server-side routing.
  • Authentication: I used Passport.js to handle the login and registration. It was my first time working with actual security logic.
  • File Uploads: Students can upload images or documents to their tutorials. I used Multer to handle the file streams.

Handling file uploads

Handling files on the backend was a bit of a hurdle. I had to learn how to validate file types and sizes so the server wouldn't get overwhelmed.

// A simple look at how I set up the file storage 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)); } });

Things I learned

Using EJS for server-side rendering was a good lesson in how the web used to work before everything moved to modern frameworks like React. It made me appreciate the simplicity of just rendering HTML on the server.

What's next

If I were to rebuild this, I'd probably use Next.js to make the interface feel more responsive. I also want to try adding a search feature so tutorials are easier to find.