Skip to content

Commit b6c3d0f

Browse files
committed
Added a readme
1 parent 8eb22b3 commit b6c3d0f

1 file changed

Lines changed: 96 additions & 0 deletions

File tree

README.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Blog API
2+
3+
A full-featured RESTful Blog API built with **Node.js**, **Express**, and **MongoDB**, featuring user authentication, role-based access control, post management, comments, likes, caching with **Redis**, and API documentation using Swagger.
4+
5+
---
6+
7+
## 🚀 Features
8+
9+
- User Registration & Authentication (JWT & Refresh Tokens)
10+
- Role-Based Access Control (`user`, `author`, `admin`)
11+
- Post CRUD operations with pagination
12+
- Comments and likes on posts
13+
- Auto-promotion to `author` after first post
14+
- Input validation and centralized error handling
15+
- Redis caching for performance
16+
- Swagger UI for interactive API docs
17+
- Dockerized for easy deployment
18+
19+
---
20+
21+
## 📁 Project Structure
22+
23+
```bash
24+
src/
25+
├── api/
26+
│ └── v1/
27+
│ ├── controllers/
28+
│ ├── routes/
29+
│ └── middleware/
30+
├── config/
31+
├── services/
32+
├── database/
33+
│ └── models/
34+
├── utils/
35+
├── tests/
36+
├── docs/
37+
│ └── swagger.yaml
38+
```
39+
40+
---
41+
42+
## Running the Project
43+
44+
### 🔧 Prerequisites
45+
46+
- Node.js v18+
47+
- Docker + Docker Compose
48+
- MongoDB & Redis (via Docker)
49+
50+
### 📦 Installation
51+
52+
```bash
53+
npm install
54+
```
55+
56+
### ▶️ Run the API (Development)
57+
58+
```bash
59+
npm run dev
60+
```
61+
62+
### 🐳 Run with Docker
63+
64+
```bash
65+
docker-compose up --build
66+
```
67+
68+
---
69+
70+
## 🛡️ Authentication
71+
72+
- JWT Access Token in `Authorization: Bearer <token>`.
73+
74+
- Refresh Token in secure HTTP-only cookie.
75+
76+
- Supports user login/logout and token refreshing.
77+
78+
## 🧑‍💻 Roles & Access
79+
80+
user ---> Default registered user
81+
author ---> Automatically promoted after 1st post
82+
admin ---> Full access to all user/admin routes
83+
84+
## 📄 API Documentation
85+
86+
Swagger UI available at: (API Documentation)[<domain>/api-docs]
87+
88+
**Live preview of all endpoints, request/response schemas, and error codes.**
89+
90+
## 📝 License
91+
92+
(View License Here)[]
93+
94+
## 👨‍🏫 Author
95+
96+
(Emmanuel Maduka Agbeze)[https://github.com/EmmanuelM-A]

0 commit comments

Comments
 (0)