WriteFlow is a full-stack blogging application that enables users to securely create, manage, and interact with posts through a scalable REST API powered by Node.js, Express.js, PostgreSQL, and JWT Authentication.
- Node.js
- Express.js
- PostgreSQL
- pg
- JWT Authentication
- bcrypt
- cookie-parser
- cors
- dotenv
- HTML
- CSS
- JavaScript
- 🔐 User Authentication
- 🍪 HTTP-only Cookie Authentication
- 📝 CRUD Operations for Posts
- 💬 CRUD Operations for Comments
- 🔍 Search Posts
- 📄 Pagination
- 👤 Author-only Update/Delete
- 🛡️ Admin Authorization
- 🏗 Layered Architecture
- ⚡ RESTful API
src/
│
├── controllers/
├── services/
├── repositories/
├── routes/
├── middlewares/
├── validators/
├── utils/
│
├── app.js
Current tables
- Users
- Posts
- Comments
| Method | Endpoint | Description | Protected |
|---|---|---|---|
| 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 current authenticated user | ✅ |
| Method | Endpoint | Description | Protected |
|---|---|---|---|
| POST | /api/post/create |
Create a new post | ✅ |
| GET | /api/post |
Get all posts | ✅ |
| GET | /api/post/:id |
Get post by ID | ✅ |
| PATCH | /api/post/:id |
Update own post | ✅ |
| DELETE | /api/post/:id |
Delete own post/Admin | ✅ |
| Method | Endpoint | Description | Protected |
|---|---|---|---|
| POST | /api/post/comment/:id |
Create comment on a post | ✅ |
| GET | /api/post/comment/:id |
Get comments of a post | ✅ |
| PUT | /api/post/comment/:id |
Update own comment | ✅ |
| DELETE | /api/post/comment/:id |
Delete own comment/Admin | ✅ |
Clone the repository
git clone https://github.com/lavishlohiya/writeflow.gitMove into the project
cd writeflowInstall dependencies
npm installCreate a .env file
PORT=1002
DATABASE_URL=your_database_url
JWT_SECRET=your_secret_keyRun the server
npm start
- 🖼 Image Uploads
- ❤️ Like System
- 👤 User Profiles
- 🏷 Categories & Tags
- 📂 File Storage
- 🐳 Docker
- 🧪 Unit & Integration Tests
- 🚀 CI/CD Pipeline
Licensed under the MIT License.
Lavish Lohiya