https://github.com/ragab0/blog-post-api
A simple blog post api (back-end repo)
https://github.com/ragab0/blog-post-api
bcrypt jwt nestjs nodejs postgresql rest-client swagger typeorm typescript
Last synced: 14 days ago
JSON representation
A simple blog post api (back-end repo)
- Host: GitHub
- URL: https://github.com/ragab0/blog-post-api
- Owner: ragab0
- Created: 2025-03-05T04:41:22.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-03-09T00:19:40.000Z (over 1 year ago)
- Last Synced: 2025-06-07T20:43:45.418Z (about 1 year ago)
- Topics: bcrypt, jwt, nestjs, nodejs, postgresql, rest-client, swagger, typeorm, typescript
- Language: TypeScript
- Homepage: https://devblog-api-q9ij.onrender.com/api/docs
- Size: 272 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 🚀 DevBlog API
A modern, feature-rich blogging platform API built with NestJS, featuring authentication and post management
## ✨ Features
- **🔐 Authentication**
- User registration and login
- JWT-based authentication
- Protected routes with auth guards
- User profile management
- **📝 Blog Posts**
- Create, read, update, and delete posts
- Pagination support
- **👤 User Management**
- User profiles with avatars
- Email-based authentication
- Password security with hashing
- Profile updates
- **📚 API Documentation**
- Comprehensive Swagger documentation
- Detailed request/response schemas
- Interactive API testing interface (in REST client extension - postman like)
## 🛠️ Tech Stack
- **🔧 Framework**: NestJS
- **🗄️ Database**: PostgreSQL with TypeORM
- **🔑 Authentication**: JWT (JSON Web Tokens)
- **📖 Documentation**: Swagger/OpenAPI
- **✅ Validation**: Class Validator & Class Transformer
- **🔒 Security**: bcrypt for password hashing
## 💻 Quick Start
### Prerequisites
- Node.js
- PostgreSQL server running locally
- npm/yarn
### Setup
```bash
# Install dependencies
npm install
# Create .env file with your configurations
PORT=3000
DB_HOST=localhost
DB_PORT=5432
DB_USERNAME=postgres
DB_PASSWORD=your_password
DB_NAME=devblog
JWT_SECRET=your_super_secret_key
# Start development server
npm run start:dev
```
## 🔌 API Endpoints
### 🚦 Project Structure
```
src/
├── auth/ # Authentication module
├── posts/ # Posts module
├── users/ # Users module
├── common/ # Shared resources
└── app.module.ts # Main application module
```
### Authentication
- `POST /api/auth/register` - Register a new user
- `POST /api/auth/login` - Login user
- `POST /api/auth/logout` - Logout user
- `GET /api/auth/me` - Get user profile
### Posts
- `GET /api/posts` - Get all posts (with pagination)
- `GET /api/posts/:id` - Get a specific post
- `POST /api/posts` - Create a new post
- `PUT /api/posts/:id` - Update a post
- `DELETE /api/posts/:id` - Delete a post
### Users
- `GET /api/users/profile` - Get user profile
- `PUT /api/users/profile` - Update user profile
## 📖 API Documentation
https://devblog-api-q9ij.onrender.com/api/docs