Skip to content

Full-stack blogging platform built to demonstrate modern software architecture principles, clean code, and real-time interaction using SignalR and CQRS

Notifications You must be signed in to change notification settings

MarkoG111/marko_blog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“° Marko's Blog

A full-stack blog platform built with ASP.NET Core 8.0 and React.js

It enables users to create, edit, and follow blog posts, interact through comments and likes, and receive real-time notifications powered by SignalR.
The system is built using Clean Architecture principles and follows the CQRS (Command Query Responsibility Segregation) pattern for high scalability and maintainability.

πŸ”— Live Demo https://marko-blog.vercel.app/

πŸ‘¨β€πŸ’» Admin login:
Username: admin
Password: admin123

πŸ‘¨β€πŸ’» Author login:
Username: emily_s
Password: pass123


🧩 Database Schema

database

πŸ”‘ Key Features

βœ… Post Management – Create, edit, and delete blog posts with images and categories.
βœ… Comments & Likes – Interact with posts and comments in real-time.
βœ… Following System – Follow favorite authors and get updates about their activity.
βœ… Real-Time Notifications – SignalR provides instant updates on comments, likes, and follows.
βœ… JWT + Firebase Authentication – Ensures secure login and role-based access.
βœ… Advanced Filtering & Pagination – Find content efficiently by multiple criteria.
βœ… Use Case Logging – Every action is logged for transparency and analysis.
βœ… Responsive Design – Fully optimized for desktop and mobile devices.
βœ… Administrative Dashboard – Manage users, posts, and author requests.


πŸ—οΈ Architecture Overview

MyBlog follows a multi-layered architecture adhering to Clean Architecture and SOLID principles:

Layer Description
Domain Defines core business entities and rules. Independent of any technical details.
EFDataAccess Manages database operations using Entity Framework Core. Includes configurations, migrations, and global filters.
Application Contains business logic, use-cases, commands, queries, DTOs, validation, and logging. Implements the CQRS pattern.
Implementation Provides concrete service implementations (repositories, SignalR, email services, etc.).
API ASP.NET Core Web API exposing RESTful endpoints for the frontend. Includes centralized error handling and JWT authentication.
Client React.js frontend communicating with the API via Fetch API and SignalR. Uses Redux Toolkit for state management and Tailwind CSS for styling.

βš™οΈ Technologies Used

πŸ–₯ Backend

  • ASP.NET Core 8.0 – Web API
  • C# – Core language
  • Entity Framework Core – ORM for SQL Server
  • SignalR – Real-time WebSocket communication
  • CQRS – Segregated command and query processing
  • JWT – Token-based authentication
  • Sentry – Error logging and performance tracking

πŸ’» Frontend

  • React.js – Client-side app
  • Redux Toolkit – Global state management
  • Tailwind CSS & Flowbite React – UI styling
  • Fetch API – Communication with backend

πŸ—„ Database

The project was originally built using SQL Server, but has since been fully migrated to PostgreSQL to improve portability, deployment compatibility (Railway/Postgres hosting), and development speed.
All Entity Framework configurations and migrations are adjusted accordingly.


πŸ” Security

  • JWT (JSON Web Token) – Handles user authentication and role-based access.
  • Firebase – Supports external authentication providers.
  • FluentValidation – Validates request data at the application layer.
  • Global Exception Handling – Centralized API error management for consistent responses.

πŸš€ Performance and Scalability

  • Asynchronous operations – Non-blocking data processing for better performance.
  • Pagination & Filtering – Efficiently retrieves only relevant data.
  • BulkExtensions – Optimized for large-scale database operations.
  • Decoupled services – Easy horizontal scaling and independent deployment.

πŸ“ Folder Structure

MyBlog/
β”œβ”€β”€ Domain/           # Core entities and business models
β”œβ”€β”€ EFDataAccess/     # Entity Framework configurations, migrations & DbContext
β”œβ”€β”€ Application/      # CQRS commands & queries, DTOs, validation
β”œβ”€β”€ Implementation/   # Services, repositories, SignalR hub, etc.
β”œβ”€β”€ API/              # ASP.NET Core Web API (Controllers, Middleware, JWT)
└── Client/           # React.js frontend app (Vite)

⚑ Setup Instructions

πŸ”§ 1. Prerequisites

Install:

  • .NET SDK 8.0+
  • Node.js 18+
  • PostgreSQL: Railway hosted instance or Local PostgreSQL (postgres default user)
  • EF Core CLI tool:
dotnet tool install --global dotnet-ef --version 8.0.0

πŸ—„οΈ 2. Backend Appsettings

Before running the API, create your local config file: Go to the API/ folder Copy the template file:

appsettings.Development.json.example β†’ appsettings.Development.json

Open the new file and fill in your real values:
PostgreSQL connection string (Railway or local Postgres)
JWT secret key (min 32 chars)
Optional SMTP config
This file is NOT tracked by Git and must be created manually.

πŸ” JWT Example

"JWT": {
    "Issuer": "http://localhost:5000",
    "Audience": "BlogClient",
    "SecretKey": "your-dev-secret-key-min-32-chars",
    "TokenExpiryMinutes": 120
},

βœ‰ SMTP Example

"SMTP": {
    "SenderEmail": "noreply@yourdomain.com",
    "Host": "smtp.yourdomain.com",
    "Port": 587,
    "Username": "noreply@yourdomain.com",
    "Password": "your-smtp-password"
}

πŸ—ƒοΈ 3. Database Configuration (PostgreSQL)

API uses PostgreSQL connection from appsettings.Development.json.
βœ” Railway example:

"ConnectionStrings": {
  "DefaultConnection": "Host=YOUR_HOST;Port=YOUR_PORT;Database=railway;Username=postgres;Password=YOUR_PASSWORD;SSL Mode=Require;Trust Server Certificate=true"
}

βœ” Local PostgreSQL example:

"ConnectionStrings": {
  "DefaultConnection": "Host=localhost;Port=5432;Database=blog;Username=postgres;Password=yourpassword"
}

πŸ“¦ Required NuGet package:

dotnet add package Npgsql.EntityFrameworkCore.PostgreSQL

πŸ› οΈ 4. Apply Migrations

Start migrations:

cd API
dotnet ef database update --project ../EFDataAccess --startup-project .

This creates the blog database automatically.

🌱 5. Seed Initial Data

Seeder will automatically start when you run API.

cd API
dotnet run

If the database is empty, initial data will be inserted.

▢️ 6. Start Backend

cd Api
dotnet restore
dotnet run

Backend URL: http://localhost:5000 Swagger: http://localhost:5000/swagger

πŸ’» 7. Frontend Environment Variables

In folder Client/ create .env
It must be next to vite.config.js.

πŸ”₯ Firebase

VITE_FIREBASE_API_KEY=AIzaSyBp3oi6SrSoQ8G3jrgzZKye4KSmrLCae7k
VITE_FIREBASE_AUTH_DOMAIN=blog-a6b98.firebaseapp.com
VITE_FIREBASE_PROJECT_ID=blog-a6b98
VITE_FIREBASE_STORAGE_BUCKET=blog-a6b98.appspot.com
VITE_FIREBASE_MESSAGING_SENDER_ID=311198757906
VITE_FIREBASE_APP_ID=1:311198757906:web:3023a83a49eeb68fa494cb
VITE_FIREBASE_MEASUREMENT_ID=G-TJWVQ5W4KH

πŸ”— API URL:

VITE_API_URL=http://localhost:5000/api

▢️ 8. Start Frontend

cd Client
npm install
npm run dev

Frontend runs at: http://localhost:5173

🎯 Why This Project Matters

This project is the most important to me because it demonstrates the complete set of knowledge I have acquired:

  • Real-time communication (SignalR)
  • Clean Architecture + CQRS
  • JWT and Firebase combined authentication
  • Database migration (SQL Server β†’ PostgreSQL)
  • Full-stack development (C#, EF Core, React, Redux)
  • Deployment to Vercel / Railway

Releases

No releases published

Packages

No packages published

Languages