Skip to content

amankv1234/Blog_App

Repository files navigation

📝 Blog App

🚀 Overview

Blogify is a full-stack blogging platform where users can sign up, log in, write blogs, upload cover images, comment on posts, and read blogs. It includes JWT authentication, cookie-based sessions, Multer uploads, and a structured MVC-like architecture.


🚀 Tech Stack


⭐ Features

🔐 User Authentication (JWT + Cookies)

📝 Create, Read, Update & Delete Blogs

💬 Comment System (Add comments on blogs)

🖼 Cover Image Upload using Multer

🗂 Clean Folder Structure (MVC-inspired)

🧩 Reusable EJS Partials

🚀 Fast & Lightweight Node.js backend

📸 Screenshots

🏠 Home Page

Home Screenshot

Sign Up

Home Screenshot

Sign In

Home Screenshot

Admin

Home Screenshot

Add New Blog

Home Screenshot

Comments

Home Screenshot

Blog Content

Home Screenshot

🗂 Folder Structure

BLOG_APP
├─ middlewares/
│   └─ authentication.js
├─ models/
│   ├─ blog.js
│   ├─ comment.js
│   └─ user.js
├─ node_modules/
├─ public/
│   ├─ images/
│   └─ uploads/
├─ routes/
│   ├─ blog.js
│   └─ user.js
├─ service/
│   └─ authentication.js
├─ views/
│   ├─ partials/
│   │   ├─ head.ejs
│   │   ├─ nav.ejs
│   │   └─ script.ejs
│   ├─ addBlog.ejs
│   ├─ blog.ejs
│   ├─ home.ejs
│   ├─ signin.ejs
│   └─ signup.ejs
├─ .env
├─ app.js
├─ package.json
└─ package-lock.json

⚙️ Tech Stack (with logos)

Tool Used Category
Node.js Server runtime.
Express.js Web framework.
MongoDB Database (via Mongoose).
EJS Templating engine.
JWT Authentication tokens.
Multer File upload middleware.
bcrypt Password hashing.
dotenv Environment variables.
cookie-parser Cookie handling.
nodemon Dev auto-restart.

🚀 Quick Setup — (COPY & PASTE) Option A — If you're cloning this repo (recommended)

clone the repo

git clone

https://github.com/amankv1234/Blog_App.git

cd

install dependencies (reads package.json)

npm install

create .env file (see example below)

then start in dev

npm run dev

or start normally

npm start

Option B — If you're starting from scratch (new project)

mkdir blog-app && cd blog-app

npm init -y

install runtime dependencies

npm install express ejs mongoose dotenv jsonwebtoken cookie-parser multer bcrypt

optional (dev)

npm install -D nodemon

create project files/folders (use the structure above)

📦 Full list of recommended npm packages express ejs mongoose dotenv jsonwebtoken cookie-parser multer bcrypt cookie-signature (optional) Dev: nodemon You can install them all at once:

npm install express ejs mongoose dotenv jsonwebtoken cookie-parser multer bcrypt
npm install -D nodemon

🔧 Environment Variables (.env example)

Create a .env file in project root and populate values: PORT=3000

MONGODB_URI=mongodb://localhost:27017/blogify

How to run (commands)

Development (auto restart):

npm run dev

assumes package.json has "dev": "nodemon app.js"

Production:

npm start

"start": "node app.js"

🔐 Authentication flow (high level)

User signs up → password hashed with bcrypt → saved to users collection.

On login → server validates credentials → signs a JWT (jsonwebtoken) → stores token in an HTTP-only cookie (cookie-parser).

Protected routes check cookie + verify JWT in middlewares/authentication.js.

📁 Views & Partials

views/partials/head.ejs — head tags, CSS links, meta.

views/partials/nav.ejs — navigation bar, user name, logout.

views/partials/script.ejs — JS imports.

Main pages: home.ejs, addBlog.ejs, blog.ejs, signin.ejs, signup.ejs.

🖼️ Image Uploads

Using multer to accept cover images and store them in public/uploads/.

Optionally configure Cloudinary and store the URL in the DB (recommended for production).

🤝 Contributing

Fork the repo → create a feature branch → open a PR with description.

Please follow consistent coding style and add meaningful commit messages.

📝 License

MIT License — see LICENSE file.

✉️ Author

Aman Kumar Vishwakarma

Email: amankumarvishwakarma

About

A full-stack blog application with authentication, CRUD and image upload.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors