A simple and powerful blog management system that allows users to register, log in, and manage blog posts with role-based access. Built using modern web technologies with secure authentication and scalable design.
- User registration and login with JWT authentication
- Role-based access (Admin and Editor)
- Create, update, and delete blog posts
- Tag-based filtering and pagination
- Swagger API documentation
- PostgreSQL with TypeORM
- Deployed database using Aiven
- Dockerized setup for easy deployment
- Passwords hashed using
bcrypt - JWT for stateless authentication
- Route protection using Guards
- Role-based access:
- Admin: Create, update, delete blogs
- Editor: Create and update blogs
- Backend: Node.js, Express.js, TypeScript
- Database: PostgreSQL (with TypeORM)
- Auth: JWT, bcrypt
- Docs: Swagger
- Testing: Jest
- Containerization: Docker
| Column | Type | Description |
|---|---|---|
| id | number | Primary key |
| username | string | Unique username |
| password | string | Hashed password |
| role | string | User role (Admin/Editor) |
- 🔐 Relation: Each user has one role.
| Column | Type | Description |
|---|---|---|
| id | number | Primary key |
| title | string | Blog title |
| content | text | Blog content |
- 🔗 Relation:
- Each blog can have multiple tags (
ManyToManywithTag) - Can be extended to link with users as authors
- Each blog can have multiple tags (
| Column | Type | Description |
|---|---|---|
| id | number | Primary key |
| name | string | Unique tag name |
- 🔗 Relation:
- Each tag can be associated with multiple blogs (
ManyToManywithBlog)
- Each tag can be associated with multiple blogs (
| Column | Type | Description |
|---|---|---|
| id | number | Primary key |
| name | string | Role name (unique) |
- 🔗 Relation: Assigned to users to define permissions
git clone https://github.com/aml-fakhry/Blog-Management-System-Uvera-.git
PORT=3000
JWT_PRIVATE_KEY=Uvettra@25
HASHING_SALT_ROUNDS=10
DB_HOST=pg-3dbef891-amlfakhry13-5f34.b.aivencloud.com
DB_PORT=26362
DB_USERNAME=avnadmin
DB_PASSWORD=AVNS_PnZ7B1RNH39TpDbfWQN
DB_NAME=Blog-Management-System
npm install
# Development
npm run dev
# Build
npm run build
# Test
npm run test
- Production: https://blog-management-system-uv-production-a5b1.up.railway.app/api-docs(Swagger UI)
- Local: http://localhost:3000/api-docs(Swagger UI)
└── 📁src
└── 📁_tests_
└── auth.service.spec.ts
└── blog.service.spec.ts
└── hash.util.spec.ts
└── jwt.util.spec.ts
└── 📁docs
└── collection.yml
└── 📁entity
└── blog.entity.ts
└── index.ts
└── role.entity.ts
└── tag.entity.ts
└── user.entity.ts
└── 📁routes
└── auth.routes.ts
└── blog.routes.ts
└── index.ts
└── 📁services
└── auth.service.ts
└── blog.service.ts
└── 📁shared
└── 📁middleware
└── auth.middleware.ts
└── roles.enum.ts
└── 📁util
└── hash.util.ts
└── jwt.util.ts
└── app.ts
└── data-source.tsTo test the authentication and API endpoints, you can use the following test user credentials:
- Email: aml@gmail.com
- Password: 1234
- Email: ra@gmail.com
- Password: 1234
Use these credentials when testing the login and role-based access control in the API.
Base URLs:
- Production: https://blog-management-system-ura-production-a5b1.up.railway.app
- Local: http://localhost:3000
To easily test the API, you can download the Postman collection:
-
Download the Postman Collection JSON file from the repository:
-
Local: Download Postman Collection
-
Production:Download Postman Collection
-
-
Import the collection into Postman:
- Open Postman and go to File > Import.
- Select the Raw Text tab and paste the JSON from the above file or use the download link.
- Click Import.
@aml-fakhry