Skip to content

This is the backend part of a full-stack blog application built using NestJS, PostgreSQL, TypeORM, and TypeScript. It provides a RESTful API for managing blog posts, comments, and user authentication using JWT.

Notifications You must be signed in to change notification settings

vlasiuk-anatolii/blog-up-back

Repository files navigation

🧠 Blog-Up Backend

This is the backend part of a full-stack blog application built using NestJS, PostgreSQL, TypeORM, and TypeScript. It provides a RESTful API for managing blog posts, comments, and user authentication using JWT.

📽️ Demo

Watch demo video

🚀 Features

  • 📄 CRUD operations for posts
  • 💬 Comments on posts
  • 🔐 JWT-based authentication
  • 📁 PostgreSQL integration via TypeORM
  • 🛡️ Input validation with class-validator
  • 🧩 Modular structure

🧰 Tech Stack

  • NestJS
  • TypeScript
  • TypeORM
  • PostgreSQL
  • Passport (Local & JWT)
  • bcrypt
  • Joi for schema validation
  • WebSocket for updating list of comments in realtime

📦 Installation

git clone https://github.com/vlasiuk-anatolii/blog-up-back
cd blog-up-back
npm install
npm run start:dev

The server will run at http://localhost:3001

⚙️ Configuration

Create a .env file in the current directory with the following content:

PORT="3001"

DB_URL=postgres://postgres:1711@localhost:5432/blog-up?schema=public

JWT_SECRET="uWoYsHgYqqsCH4O11PgpuMQAWSRObk5T"
JWT_EXPIRATION="10h"

RECAPTCHA_PROJECT_ID=blog-up-*******
RECAPTCHA_SITE_KEY=6LfPM************************

GCP_CLIENT_EMAIL=recaptcha-client@blog-up-************.com
GCP_PRIVATE_KEY=-----BEGIN PRIVATE KEY-----\nMI*******0fY5A==\n-----END PRIVATE KEY-----\n

📁 Project Structure

back/
├── src/
│   ├── auth/            // Authentication module (JWT, local)
│   ├── comments/        // Comments module
│   ├── posts/           // Posts module
│   ├── config/          // Config file for Joi
│   ├── users/           // Users module
│   ├── recaptcha/       // Recaptcha module
│   ├── app.module.ts    // Main module
│   └── main.ts          // App entry point
├── .env                 // Environment variables
└── package.json         // Project metadata and scripts

✅ Implemented

  • API for posts (CRUD)
  • API for comments
  • Authentication (login, singup)
  • Input validation
  • Sanitize html in comment defore saving to db
  • PostgreSQL DB setup

➕ Optional Enhancements

  • Role-based access control
  • Rate limiting
  • Swagger documentation
  • Unit & e2e tests coverage

📝 Notes

  • The frontend should be configured to send requests to http://localhost:3001
  • Make sure PostgreSQL is running and a database named blog-up is created

📄 License

MIT © 2025 Anatolii Vlasiuk

About

This is the backend part of a full-stack blog application built using NestJS, PostgreSQL, TypeORM, and TypeScript. It provides a RESTful API for managing blog posts, comments, and user authentication using JWT.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published