A modern social feed application built with the MERN stack, featuring a unique neobrutalism design aesthetic. Users can register, login, and create posts with images that are hosted via ImageKit.
- React 19 - UI library
- Vite - Build tool and dev server
- Tailwind CSS - Styling framework
- React Router DOM - Client-side routing
- Axios - HTTP client
- Lucide React - Icon library
- Node.js - JavaScript runtime
- Express.js - Web framework
- MongoDB - NoSQL database
- Mongoose - MongoDB ODM
- JSON Web Token (JWT) - Authentication
- Bcryptjs - Password hashing
- Multer - File upload middleware
- ImageKit - Image hosting and CDN
MERN PROJECT/
β
βββ π BACKEND/ # Server-side application
β βββ package.json # Backend dependencies
β βββ server.js # Application entry point
β β
β βββ π src/
β βββ app.js # Express configuration & routes
β β
β βββ π database/
β β βββ db.js # MongoDB connection setup
β β
β βββ π middleware/
β β βββ auth.middleware.js # JWT authentication middleware
β β
β βββ π models/
β β βββ user.model.js # User schema (username, email, password)
β β βββ post.model.js # Post schema (image, caption)
β β
β βββ π routes/
β β βββ auth.routes.js # /api/auth endpoints
β β βββ post.routes.js # /api/posts endpoints
β β
β βββ π controllers/
β β βββ auth.controller.js # Auth logic (register, login)
β β
β βββ π services/
β βββ storage.service.js # ImageKit image upload service
β
βββ π FRONTEND/ # Client-side application
β βββ package.json # Frontend dependencies
β βββ vite.config.js # Vite configuration
β βββ tailwind.config.js # Tailwind CSS configuration
β βββ postcss.config.js # PostCSS configuration
β β
β βββ π src/
β βββ main.jsx # React app entry point
β βββ App.jsx # Main app component with routing
β βββ index.css # Global styles
β β
β βββ π pages/
β β βββ Home.jsx # Main feed displaying all posts
β β βββ Login.jsx # User login page
β β βββ CreatePost.jsx # Page to create new post
β β βββ AdminSetup.jsx # Initial admin account setup
β β
β βββ π components/
β β βββ Navbar.jsx # Navigation bar with links
β β βββ PostCard.jsx # Individual post display component
β β βββ ThemeSwitcher.jsx # Dark/light mode toggle
β β βββ ProtectedRoute.jsx # Route guard for auth
β β
β βββ π context/
β β βββ AuthContext.jsx # Authentication state management
β β
β βββ π theme/
β β βββ ThemeContext.jsx # Theme state management
β β
β βββ π services/
β βββ api.js # Axios API client with interceptors
β
βββ netlify.toml # Netlify deployment configuration
βββ overview.md # Project documentation & bug reports
βββ README.md # This file
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β FRONTEND (React) β
β ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββββ β
β β Home β β Login β βCreatePostβ βAdminSetupβ β
β ββββββ¬ββββββ ββββββ¬ββββββ ββββββ¬ββββββ ββββββ¬ββββββ β
β β β β β β
β βββββββββββββββ΄ββββββββββββββ΄ββββββββββββββ β
β β β
β ββββββββ΄βββββββ β
β β App.jsx β (React Router) β
β ββββββββ¬βββββββ β
β β β
β βββββββββββββββββββΌββββββββββββββββββ β
β β β β β
β ββββββββ΄βββββββ βββββββββ΄ββββββββ ββββββββ΄βββββββ β
β β AuthContext β βThemeContext β β api.js β β
β β (User Auth) β β (Dark/Light) β β (Axios) β β
β βββββββββββββββ βββββββββββββββββ ββββββββ¬βββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββΌββββββββββββββββββββ
β
β HTTP Requests
β
βββββββββββββββββββββββββββββββββββββββββββββββΌββββββββββββββββββββ
β BACKEND (Express) β β
β βΌ β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β app.js β β
β β βββββββββββββββ βββββββββββββββ βββββββββββββββββββ β β
β β β CORS Config β β Auth Routes β β Post Routes β β β
β β β β β /api/auth β β /api/posts β β β
β β βββββββββββββββ ββββββββ¬βββββββ βββββββββ¬βββββββββ β β
β β β β β β
β ββββββββββββββββββββββββββββΌβββββββββββββββββββΌββββββββββββββ β
β β β β
β ββββββββββββββββ΄ββββββββ βββββββββ΄βββββββββ β
β β auth.controller.js β β post.routes.js β β
β β (register, login) β β (create, fetch)β β
β βββββββββββββ¬ββββββββββββ βββββββββ¬βββββββββ β
β β β β
β ββββββββββββββββββΌββββββββββββββββββββββΌββββββββββββ β
β β β β β β
β ββββββββ΄βββββββ ββββββββ΄βββββββ βββββββββββββ΄βββββββββ β β
β βuser.model.jsβ βpost.model.jsβ βstorage.service.js β β β
β β (Mongoose) β β (Mongoose) β β (ImageKit) β β β
β ββββββββ¬βββββββ ββββββββ¬βββββββ βββββββββββββ¬βββββββββ β β
β β β β β β
β ββββββββββββββββββ΄ββββββββββββββββββββββ β β
β β β β
β βΌ β β
β ββββββββββββ β β
β β MongoDB β β β
β β β β β
β ββββββββββββ β β
β β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β
ββββββββββββββββ β
β ImageKit β βββ Image CDN β
β (Images) β β
ββββββββββββββββ β
- User Authentication: Register and login with JWT-based authentication
- Image Posts: Create posts with images and captions
- Image Hosting: Images are uploaded to ImageKit for CDN delivery
- Protected Routes: Authenticated access to create posts
- Dark/Light Theme: Toggle between themes with theme persistence
- Responsive Design: Works on mobile and desktop
- Neobrutalism UI: Unique bold design aesthetic
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/auth/register |
Register a new user |
| POST | /api/auth/login |
Login user |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/posts |
Get all posts |
| POST | /api/posts/create-post |
Create a new post with image |
- Node.js (v18+)
- MongoDB (local or Atlas)
- ImageKit account (free tier)
Create a .env file in the BACKEND directory:
# Backend .env
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret_key
IMAGE_KIT_PUBLIC=your_imagekit_public_key
IMAGE_KIT_PRIVATE=your_imagekit_private_key
IMAGE_KIT_ENDPOINT=your_imagekit_endpoint_url
FRONTEND_URL=http://localhost:5173
PORT=3000Create a .env file in the FRONTEND directory:
# Frontend .env
VITE_BACKEND_URL=http://localhost:3000git clone <repository-url>
cd "MERN PROJECT"cd BACKEND
npm installcd ../FRONTEND
npm installcd BACKEND
npm start
# or for development with nodemon
npx nodemon server.jsThe backend will run on http://localhost:3000
cd FRONTEND
npm run devThe frontend will run on http://localhost:5173
cd FRONTEND
npm run buildThe built files will be in the dist folder.
Deploy to platforms like:
- Render
- Railway
- Fly.io
- Heroku
Deploy to platforms like:
- Netlify (configured with
netlify.toml) - Vercel
ISC License