π Introduction
In an era where visual content dominates the web, creating a fast, secure, and user-friendly image hosting app is a rewarding challenge. That's exactly what led me to build ImageVault β a full-stack application where users can upload, view, and manage images seamlessly.
This article dives into how I built ImageVault using the MERN stack (MongoDB, Express.js, React.js, Node.js) along with Tailwind CSS for sleek UI styling.
π§© Tech Stack
Frontend: React , Tailwind CSS
Backend: Node.js, Express.js
Database: MongoDB
Image Uploads: Handled via multer and served with Express static middleware
Hosting:
Backend: Render
Frontend: Vercel
Version Control: Git & GitHub
π¦ Key Features
β
Upload images (PNG, JPG, etc.)
β
View uploaded images in a responsive gallery
β
Image previews and metadata
β
Server-side image storage (locally in uploads/)
β
REST API built with Express.js
β
Clean Tailwind-based UI
β
Delete functionality with confirmation
π Folder Structure
imagevault/
β
βββ ImageVault-frontend/ # React frontend with Tailwind
β βββ src/
β βββ ...
β
βββ ImageVault-backend/ # Node + Express backend
β βββ config/
β βββ routes/
β βββ controllers/
β βββ models/
β βββ uploads/
β βββ server.js
π§ Backend Setup
I used Express.js to handle image uploads via multer. Here's a glimpse:
javascript// server.js
const express = require('express');
const cors = require('cors');
const app = express();
app.use(cors({ origin: 'https://adeshmishra-imagevault.vercel.app' }));
app.use(express.json());
app.use('/uploads', express.static('uploads'));
const imageRoutes = require('./routes/imageRoutes');
app.use('/api/images', imageRoutes);
π§βπ¨ Frontend UI
Using React + Tailwind CSS, I built a responsive image gallery. Here's a preview of the upload component:
javascript
Upload
And fetching uploaded images:
javascriptuseEffect(() => {
fetch('https://atadeshmishra-imagevault.onrender.com/api/images')
.then(res => res.json())
.then(data => setImages(data));
}, []);
π Deployment
π§ Backend is hosted on Render:
https://atadeshmishra-imagevault.onrender.com
π¨ Frontend is deployed on Vercel:
https://adeshmishra-imagevault.vercel.app
π‘οΈ Sensitive credentials like DB URI are stored securely in .env, and .gitignore prevents committing them.
π What I Learned
Handling file uploads securely with multer
Connecting a React frontend to an Express backend with CORS
Managing deployments across Vercel & Render
Structuring scalable MERN applications
π What's Next?
π Add user authentication (JWT + bcrypt)
βοΈ Use a cloud storage like AWS S3 or Cloudinary
πΌοΈ Add image tagging and search
πΌοΈ Add image sending functionality
π Live Project Links
Frontend (Vercel): https://adeshmishra-imagevault.vercel.app
Backend (Render): https://adeshmishra-imagevault.onrender.com
GitHub Repo: https://github.com/adesh9201/imagevault
π§βπ» Final Thoughts
Building ImageVault helped me deepen my full-stack development skills. It's lightweight, fast, and extensible β ideal for developers looking to implement image upload features or create portfolio-worthy MERN projects.
If you found this useful, feel free to fork it and make it your own!
Top comments (0)