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
- Host: GitHub
- URL: https://github.com/flexycode/myblog
- Owner: flexycode
- Created: 2025-12-05T12:18:59.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2025-12-17T07:52:44.000Z (4 months ago)
- Last Synced: 2025-12-20T21:11:21.196Z (4 months ago)
- Topics: express, javascript, mern-stack-development, mongodb, nodejs, react
- Language: JavaScript
- Homepage:
- Size: 4.08 MB
- Stars: 3
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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.




---
## ๐ 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
---
ย ย ย ย
