Skip to content

Samadali123/postify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

postify

A Facebook-style social media web app where users can create posts, interact with other users' content, follow people, and see a personalized feed. Built with Node.js, Express, MongoDB, and EJS for server-side rendering. Image uploads (posts and profile photos) go through Cloudinary via Multer. Auth is handled by Passport.js with session-based login.

Features

Auth Users register and log in through Passport.js. Sessions persist in MongoDB. All protected routes redirect unauthenticated users to login.

Posts Users create posts with text and optional image uploads. Images are stored on Cloudinary — Multer handles the file on the server side before passing it to the Cloudinary SDK.

Feed The home feed shows posts from users you follow, ordered by recency. Not a global dump of all posts — only content from people you've chosen to follow.

Likes & Comments Users can like and comment on any post. Like counts and comments update on the post view without requiring a separate API layer — handled through form submissions and server-side re-renders.

Follow / Unfollow Users can follow and unfollow each other. Following someone adds them to your feed. Profile pages show follower and following counts.

Profile Management Users can edit their display name, bio, and profile photo. Profile photo updates replace the old Cloudinary asset.

Project Structure

postify/ ├── bin/ # Server startup script ├── routes/ # Express routes — auth, posts, users, profile ├── views/ # EJS templates — feed, profile, post detail, auth pages ├── cloudinary.js # Cloudinary SDK config and upload helper ├── multer.js # Multer config — file type validation, memory storage ├── app.js # Express setup, session config, middleware, route mounting ├── .env # Environment variables (not committed) └── package.json

Cloudinary and Multer configs are kept as separate root-level files rather than buried in a utils folder — makes it easy to find and update upload settings without digging through the project.

Tech Stack

Node.js · Express.js · MongoDB · Mongoose · EJS · Passport.js · Cloudinary · Multer · Express-Session

Getting Started

bash git clone https://github.com/Samadali123/postify.git cd postify npm install

Create a .env file:

env PORT=5000 MONGODB_URI=your_mongodb_connection_string SESSION_SECRET=your_session_secret

Cloudinary

CLOUDINARY_CLOUD_NAME=your_cloud_name CLOUDINARY_API_KEY=your_api_key CLOUDINARY_API_SECRET=your_api_secret

Start the server:

bash npm start

App runs at http://localhost:5000.

Routes Overview

Route Description
GET / Home feed — posts from followed users
POST /auth/register Register new user
POST /auth/login Login
GET /auth/logout Logout
GET /profile/:id View user profile
POST /profile/edit Update profile info and photo
POST /posts Create a new post
POST /posts/:id/like Like a post
POST /posts/:id/comment Comment on a post
POST /users/:id/follow Follow a user
POST /users/:id/unfollow Unfollow a user

Topics

nodejs expressjs mongodb ejs passport cloudinary multer social-media session-auth fullstack facebook-clone feed image-upload mongoose`

Author

Syed Samad Ali — LinkedIn

About

A Facebook-style social media web app where users can create posts, interact with other users' content, follow people, and see a personalized feed. Built with Node.js, Express, MongoDB, and EJS for server-side rendering. Image uploads (posts and profile photos) go through Cloudinary via Multer. Auth is handled by Passport.js with session-based

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors