RESTful blog backend built with Node.js, TypeScript, Express, and Prisma.
- JWT-based authentication (
register,login,logout) - Role-based access (
USER,EDITOR,ADMIN) - Post CRUD with publishing workflow
- Comments system with moderation-ready model
- Tags and post categorization
- Pagination and search endpoints
- Redis-backed token blacklisting for logout sessions
- PostgreSQL persistence via Prisma ORM
- Node.js
- TypeScript
- Express
- Prisma ORM
- PostgreSQL
- Redis
- JSON Web Token (JWT)
- bcrypt
- express-validator
- express-rate-limit
src/
controllers/
middlewares/
routes/
services/
utils/
prisma/
migrations/
schema.prisma
npm installCreate/update .env with at least:
PORT=3001
DATABASE_URL=postgresql://USER:PASSWORD@HOST:PORT/DB_NAME
ACCESS_TOKEN_SECRET=your_jwt_secret
REDIS_URL=redis://localhost:6379npx prisma migrate devnpm run devServer runs on http://localhost:3001 by default.
npm run dev- start development server with nodemonnpm run build- compile TypeScriptnpm run start- run compiled build
/api/auth/api/admin/api/posts/api/comments/api/users/api/tags/api/analytics
/api/admin also includes endpoints to attach and remove tags from a specific post.
UserPostCommentTag
https://github.com/samer12332/Blog_prisma
Use descriptive commit messages in this format:
feat: add admin endpoint to assign tags to postsfix: validate tag ID before disconnecting from postdocs: update README with setup and route details