Skip to content

priyam731/blogging

Repository files navigation

Blogify - The Blogging Engine

Blogify, is a dynamic blogging platform designed to be simple, fast, and effective. I've structured this to handle content creation reliably without the unnecessary overhead of complex client-side frameworks. It is classic server-side rendering done right.

The Tech Stack

We made some specific architectural choices here to keep development velocity high while maintaining a robust backend.

  • Node.js & Express: The backbone of the application. It is fast, flexible, and handles our HTTP prowess.
  • MongoDB & Mongoose: We are using a document store because it fits our data model perfectly. Blog posts and comments are naturally hierarchical.
  • EJS (Embedded JavaScript): We render our views on the server. This ensures fast initial page loads and excellent SEO without the complexity of a hydration layer.
  • Authentication: A custom JWT implementation using cookies. It is stateless and keeps our session management lightweight.
  • Multer: Handles file uploads for blog cover images directly to our public directory.

Project Structure

I have kept the organization clean and predictable so you can jump right in:

  • models/: Defines our data schemas (User, Blog, Comment).
  • views/: Contains all the server-rendered EJS templates.
  • routes/: Acts as the controller layer, mapping URLs to logic.
  • middlewares/: Handles request processing like authentication checks.
  • services/: Isolates business logic, particularly for auth.

Getting Started

  1. Clone the repo and navigate into the directory.
  2. Install dependencies:
    npm install
  3. Environment Setup: Create a .env file in the root directory. You simply need to provide your database connection string:
    MONGO_URL=mongodb://localhost:27017/blogify
    
  4. Launch:
    npm start
    The server will spin up on port 8000 by default.

A Note on Security

You might notice the JWT secret is currently hardcoded in the service layer. This is intentional for the development environment to reduce setup friction. For any production deployment, verify you move this to an environment variable immediately.

Dive in, explore the code, and enjoy working with a clean, well-structured Node.js application.

About

Blogify, is a dynamic blogging platform where you can upload blog ,view other blogs and event comment on it .

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors