A simple social media-style web app built with Node.js, Express, MongoDB, and EJS. Users can register, log in, create posts, like/unlike posts, and edit their content.
- User Authentication β Secure login/register with JWT and bcrypt
- Profile Page β View your posts and likes
- Like/Unlike System β Toggle likes on posts
- Edit Posts β Update your post content anytime
- Secure Routes β Only logged-in users can post or like
- EJS Templates β Server-side rendered views
- MongoDB Database β Store users and posts
- Backend: Node.js, Express.js
- Database: MongoDB, Mongoose
- Authentication: JWT, bcrypt.js, cookie-parser
- Templating: EJS
- Styling: CSS, Public Assets
- Other: Path, dotenv
. βββ models β βββ user.js β βββ post.js βββ public β βββ css/ β βββ js/ βββ views β βββ index.ejs β βββ profile.ejs β βββ login.ejs β βββ edit.ejs βββ app.js βββ package.json
- Clone the repository
git clone https://github.com/yourusername/postify.git cd postify - Install dependencies
npm install
- Setup environment variables
Create a
.envfile in the root directory:MONGODB_URI=your_mongodb_connection_string JWT_SECRET=shhhhhhh PORT=3000
- Run the app
Or with nodemon:
node app.js
npx nodemon app.js
- Open in browser Visit http://localhost:3000