A simple Blog Application built with Node.js, Express, EJS, and MongoDB Atlas, deployed on Render. Users can view blogs, add new blogs, and manage authentication.
- User signup & signin
- Add, view, and manage blogs
- MongoDB Atlas as database
- Deployed on Render
- Responsive UI using EJS templates
- Node.js (v22.16.0)
- Express.js
- MongoDB Atlas (via Mongoose)
- EJS for templating
- dotenv for environment variables
Blog-Application/
│
├── app.js # Main server file
├── package.json # Project dependencies and scripts
├── .env # Environment variables
├── .gitignore # Git ignore file
│
├── public/ # Static files
│ ├── css/ # Stylesheets
│ │ └── style.css
│ ├── js/ # Client-side JavaScript
│ │ └── main.js
│ └── images/ # Images
│ └── (image files)
│
├── views/ # EJS templates
│ ├── partials/ # Reusable components
│ │ ├── head.ejs
│ │ └── nav.ejs
│ ├── blog.ejs # Blog home page
│ ├── add-new.ejs # Add new blog page
│ ├── signup.ejs # Signup page
│ └── signin.ejs # Signin page
│
├── routes/ # Application routes
│ └── home.js
│
└── models/ # Database models
└── user.js| Path | Type | Description |
|---|---|---|
| app.js | File | Main application |
| package.json | File | Dependencies |
| public/ | Folder | Static files |
| public/css/ | Folder | Stylesheets |
| public/js/ | Folder | JavaScript |
This Blog Application follows a client–server architecture using Express and MongoDB.
- The server starts using Node.js & Express.
- EJS is used for server-side rendering of pages.
- Users interact with the application through forms and pages.
- Requests are handled by Express routes.
- Data is stored and retrieved from MongoDB Atlas using Mongoose.
- Render hosts the application and manages environment variables.
- User signs up using the signup form.
- User details are stored in MongoDB.
- User can sign in using registered credentials.
- After authentication, users can access blog features.
- User opens the blog home page.
- User navigates to Add New Blog page.
- Blog data is submitted via a form.
- Server processes the request and stores blog data in MongoDB.
- Blogs are fetched from the database and displayed on the home page.
- Mongoose is used as an ODM.
- Schemas define the structure of stored data.
- MongoDB Atlas handles cloud storage and scalability.
- Sensitive information (MongoDB URL, Port) is stored in
.env. - Render injects environment variables during deployment.