An open API service indexing awesome lists of open source software.

https://github.com/flexycode/myblog

MyBlog is powerful like a fruit juice or holy spaghetti matching with holy macaroni
https://github.com/flexycode/myblog

express javascript mern-stack-development mongodb nodejs react

Last synced: about 16 hours ago
JSON representation

MyBlog is powerful like a fruit juice or holy spaghetti matching with holy macaroni

Awesome Lists containing this project

README

          

# ๐Ÿ“ MyBlog

A full-stack blogging platform built with **React**, **Node.js**, **Express**, and **MongoDB**. Create, share, and manage your blog posts with a modern, responsive interface.

![React](https://img.shields.io/badge/React-19.2.0-blue?logo=react)
![Node.js](https://img.shields.io/badge/Node.js-Express-green?logo=node.js)
![MongoDB](https://img.shields.io/badge/MongoDB-Atlas-success?logo=mongodb)
![License](https://img.shields.io/badge/License-MIT-yellow)

---

## ๐Ÿ“‹ Table of Contents

- [โœจ Features](#-features)
- [๐Ÿ› ๏ธ Tech Stack](#๏ธ-tech-stack)
- [๐Ÿ“ Project Structure](#-project-structure)
- [โš™๏ธ Prerequisites](#๏ธ-prerequisites)
- [๐Ÿš€ Getting Started](#-getting-started)
- [๐Ÿ” Environment Variables](#-environment-variables)
- [๐Ÿ“œ Available Scripts](#-available-scripts)
- [๐Ÿ”— API Endpoints](#-api-endpoints)
- [๐Ÿ“ฎ Postman Testing](#-postman-testing)
- [๐Ÿค Contributing](#-contributing)
- [๐Ÿ“„ License](#-license)

---

## โœจ Features

| Feature | Description |
|---------|-------------|
| ๐Ÿ” **User Authentication** | Secure login and registration with role-based access (Admin/User) |
| โœ๏ธ **Blog Management** | Create, read, update, and delete blog posts |
| ๐Ÿ’ฌ **Comments System** | Add and view comments on blog posts |
| ๐Ÿ“Š **Dashboard** | Personal dashboard to manage your content |
| ๐Ÿ‘ค **Role-Based Users** | Support for Admin and User roles |
| ๐ŸŽจ **Responsive Design** | Beautiful UI that works on all devices |

---

## ๐Ÿ› ๏ธ Tech Stack

### Frontend
- โš›๏ธ **React 19** - Modern UI library
- ๐ŸŽจ **Bootstrap 5** - Responsive CSS framework
- ๐Ÿ”€ **React Router DOM** - Client-side routing

### Backend
- ๐ŸŸข **Node.js** - JavaScript runtime
- ๐Ÿš‚ **Express 5** - Web framework
- ๐Ÿƒ **MongoDB** - NoSQL database
- ๐Ÿ”— **Mongoose** - MongoDB ODM

### Dev Tools
- ๐Ÿ”„ **Concurrently** - Run multiple scripts simultaneously
- ๐Ÿ”ฅ **Nodemon** - Auto-restart server on changes

---

## ๐Ÿ“ Project Structure

```
myblog/
โ”œโ”€โ”€ ๐Ÿ“‚ backend/
โ”‚ โ”œโ”€โ”€ ๐Ÿ“„ server.js # Express server & MongoDB connection
โ”‚ โ”œโ”€โ”€ ๐Ÿ“„ authRoutes.js # Authentication routes (register/login)
โ”‚ โ”œโ”€โ”€ ๐Ÿ“„ blogRoutes.js # Blog post CRUD routes
โ”‚ โ”œโ”€โ”€ ๐Ÿ“„ commentRoutes.js # Comments routes
โ”‚ โ”œโ”€โ”€ ๐Ÿ“„ userModel.js # User schema (with role)
โ”‚ โ”œโ”€โ”€ ๐Ÿ“„ blogPostModel.js # Blog post schema
โ”‚ โ”œโ”€โ”€ ๐Ÿ“„ commentModel.js # Comment schema
โ”‚ โ””โ”€โ”€ ๐Ÿ“„ .env # Environment variables
โ”œโ”€โ”€ ๐Ÿ“‚ src/
โ”‚ โ”œโ”€โ”€ ๐Ÿ“‚ components/
โ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ“„ AppNavbar.js # Navigation bar
โ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ“„ Dashboard.js # Dashboard component
โ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ“„ HomePage.js # Landing page
โ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ“„ Login.js # Login form
โ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ“„ Register.js # Registration (with role selector)
โ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ“„ Services.js # Blog articles list
โ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ“„ ArticleDetail.js # View post with comments
โ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ“„ About.js # About page
โ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ“„ Contact.js # Contact page
โ”‚ โ”‚ โ””โ”€โ”€ ๐Ÿ“„ Footer.js # Footer component
โ”‚ โ”œโ”€โ”€ ๐Ÿ“„ App.js # Main application with routes
โ”‚ โ”œโ”€โ”€ ๐Ÿ“„ App.css # Application styles
โ”‚ โ””โ”€โ”€ ๐Ÿ“„ index.js # React entry point
โ”œโ”€โ”€ ๐Ÿ“„ package.json # Dependencies and scripts
โ””โ”€โ”€ ๐Ÿ“„ README.md # Project documentation
```

---

## โš™๏ธ Prerequisites

Before you begin, ensure you have the following installed:

- ๐Ÿ“ฆ **Node.js** (v18 or higher) - [Download](https://nodejs.org/)
- ๐Ÿƒ **MongoDB Atlas Account** - [Sign Up](https://www.mongodb.com/atlas)
- ๐Ÿ’ป **Git** - [Download](https://git-scm.com/)
- ๐Ÿ“ฎ **Postman** (optional) - [Download](https://www.postman.com/downloads/)

---

## ๐Ÿš€ Getting Started

### 1๏ธโƒฃ Clone the Repository

```bash
git clone https://github.com/flexycode/myblog.git
cd myblog
```

### 2๏ธโƒฃ Install Dependencies

```bash
npm install
```

### 3๏ธโƒฃ Configure Environment Variables

Create a `.env` file in the `backend/` directory (see [Environment Variables](#-environment-variables)).

### 4๏ธโƒฃ Run the Application

```bash
npm run dev
```

๐ŸŽ‰ **That's it!**
- Frontend: [http://localhost:3000](http://localhost:3000)
- Backend API: [http://localhost:5000](http://localhost:5000)

---

## ๐Ÿ” Environment Variables

Create a `.env` file in the `backend/` directory:

```env
# MongoDB Configuration
MONGO_URI=mongodb+srv://:@.mongodb.net/myblog?retryWrites=true&w=majority

# Server Port
PORT=5000

# JWT Secret Key
JWT_SECRET=your_jwt_secret_key_here
```

> โš ๏ธ **Important:** Whitelist your IP address in MongoDB Atlas Network Access!

---

## ๐Ÿ“œ Available Scripts

| Command | Description |
|---------|-------------|
| `npm run dev` | ๐Ÿš€ Runs frontend + backend concurrently |
| `npm start` | โš›๏ธ Runs React frontend only (port 3000) |
| `npm run backend` | ๐Ÿ–ฅ๏ธ Runs Express backend only (port 5000) |
| `npm run build` | ๐Ÿ“ฆ Builds for production |
| `npm test` | ๐Ÿงช Runs test suite |

---

## ๐Ÿ”— API Endpoints

### ๐Ÿ” Authentication

| Method | Endpoint | Description |
|--------|----------|-------------|
| `POST` | `/api/auth/register` | Register new user (with role) |
| `POST` | `/api/auth/login` | Login and get user info |

### ๐Ÿ“ Blog Posts

| Method | Endpoint | Description |
|--------|----------|-------------|
| `GET` | `/api/blog` | Get all blog posts |
| `GET` | `/api/blog/:id` | Get single blog post |
| `POST` | `/api/blog` | Create new blog post |
| `PUT` | `/api/blog/:id` | Update blog post |
| `DELETE` | `/api/blog/:id` | Delete blog post |

### ๐Ÿ’ฌ Comments

| Method | Endpoint | Description |
|--------|----------|-------------|
| `GET` | `/api/comments/:postId` | Get comments for a post |
| `POST` | `/api/comments` | Create new comment |
| `DELETE` | `/api/comments/:id` | Delete comment |

---

## ๐Ÿ“ฎ Postman Testing

### Register Admin User
```
POST http://localhost:5000/api/auth/register
Content-Type: application/json

{
"username": "admin",
"email": "admin@example.com",
"password": "password123",
"role": "admin"
}
```

### Login
```
POST http://localhost:5000/api/auth/login
Content-Type: application/json

{
"email": "admin@example.com",
"password": "password123"
}
```

### Create Blog Post
```
POST http://localhost:5000/api/blog
Content-Type: application/json

{
"title": "My First Blog Post",
"content": "This is the content of my blog post...",
"author": "admin"
}
```

### Get All Posts
```
GET http://localhost:5000/api/blog
```

### Add Comment
```
POST http://localhost:5000/api/comments
Content-Type: application/json

{
"postId": "",
"user": "admin",
"text": "Great post!"
}
```

---

## ๐Ÿค Contributing

Contributions are welcome!

1. ๐Ÿด Fork the repository
2. ๐ŸŒฟ Create a feature branch (`git checkout -b feature/AmazingFeature`)
3. ๐Ÿ’พ Commit your changes (`git commit -m 'Add AmazingFeature'`)
4. ๐Ÿ“ค Push to the branch (`git push origin feature/AmazingFeature`)
5. ๐Ÿ”ƒ Open a Pull Request

### ๐Ÿ‘‹ Contributors
### Special thanks to all my groupmates:
* #### ๐Ÿ˜Ž [Jay Arre Talosig](https://github.com/flexycode)ย - Machine Learning Engineer | Blockchain Developer | Bioinformatics Scientist ย ย ย 
* #### ๐Ÿ•ต๏ธ [Alexander Castilo](https://github.com/xandercastillo0305-dev) - Penetration Tester | Software Engineer | Threat Researcher
* #### ๐Ÿง‘โ€๐Ÿ’ป [Mark Jhoshua Taberna](https://github.com/MjTaberna) - Digital Forensics Analyst | UI Specialist | Full Stack Engineerย 
* #### ๐Ÿง‘โ€๐Ÿ’ป [Charles Medio](https://github.com/charles41onlyy) - Machine Learning Engineerย | Software Engineer
* #### ๐Ÿ•ต๏ธ [Tristan Jhay Salamat](https://github.com/tristanjhay) - Full Stack Engineer | Forensics Analyst | QA Engineer

* #### ๐Ÿ•ต๏ธโ€โ™€๏ธ [Rinoah Venedict Dela Rama](https://github.com/Noah-dev2217) - Forensic Analyst | QA Engineer | Data Engineer
* #### ๐Ÿฅท [Nicko Nehcterg Dalida](https://github.com/nicknicndin) - Digital Forensics Analyst | QA Engineer | Smart Contract Auditor
---

## ๐Ÿ“„ License

This project is licensed under the **MIT License**.

#### Git Commit Message: ๐ŸŒฟ My Macaroni Fruit Salad
---


Made with โค๏ธ by flexycode

---


mystreak





mystreak

ย ย ย ย