.NET 10 · SignalR · CQRS · Clean Architecture

CollabNotes

A real-time collaboration tool for shared notes with user accounts, private notes, and an invitation system.

4
Architecture Layers
8
CQRS Commands
9
SignalR Events
11
API Endpoints
Features

Everything You Need

From user accounts and real-time collaboration to full access control.

User Accounts

Registration and login with persistent JSON storage. Automatic re-login via localStorage.

Private Notes

Notes are private by default, visible only to the creator. Full control over your own data.

Invitation System

Invite other users by username. Real-time notification when an invitation is received.

Real-Time Sync

Changes to title and content are instantly transmitted to all collaborators via SignalR WebSockets.

Access Control

Only the owner can delete notes, invite or remove collaborators. All operations enforce access checks.

Tabbed UI

Clear separation between “My Notes” and “Shared with Me” for the best overview.

Architecture

Clean Architecture

Strict layer separation following the Dependency Rule — outer layers know inner layers, never the reverse.

Four Layers, Clear Responsibilities

The architecture follows Clean Architecture principles. Each layer has a clearly defined responsibility and communicates only with the layer directly below it through interfaces.

  • Domain Layer has zero dependencies on external libraries
  • Application Layer defines interfaces, Infrastructure implements them
  • CQRS cleanly separates read and write operations
  • MediatR Pipeline with Validation Behavior for automatic input validation
  • Domain Events for loose coupling between entities and side effects
API Layer
AuthController · NotesController · ExceptionHandlingMiddleware · wwwroot (Frontend)
Application Layer
Auth & Note Commands · Queries · Validators · DTOs · Mappings · Behaviors
Infrastructure Layer
EF Core InMemory · JSON User Repository · SignalR Hub · RealtimeNotifier
Domain Layer
Note · User · NoteCollaborator · Domain Events · Repository Interfaces
Tech Stack

Technologies

Cutting-edge .NET technologies for a robust and scalable architecture.

.NET

.NET 10 / ASP.NET Core

Web framework with Controllers, Middleware, and DI

SR

SignalR

Real-time communication via WebSockets with Groups and User-Targeting

MR

MediatR

CQRS Command/Query dispatching with Pipeline Behaviors

FV

FluentValidation

Declarative input validation as a MediatR Pipeline Behavior

EF

EF Core InMemory

Note storage (easily swappable for SQL/SQLite)

JS

Vanilla JavaScript

Lightweight frontend with zero framework overhead

Pattern

CQRS with MediatR

Strict separation of read and write operations for maximum maintainability.

Commands (Write)

  • RegisterCommand Register a new user
  • LoginCommand Authenticate user
  • CreateNoteCommand Create note (+ OwnerId)
  • UpdateNoteContentCommand Update content
  • UpdateNoteTitleCommand Update title
  • DeleteNoteCommand Delete note (owner only)
  • AddCollaboratorCommand Invite collaborator
  • RemoveCollaboratorCommand Remove collaborator

Queries (Read)

  • GetMyNotesQuery Fetch own notes
  • GetSharedNotesQuery Fetch shared notes
  • GetNoteByIdQuery Single note (+ access check)
  • SearchUsersQuery Search users

Validation Pipeline

Every command automatically passes through ValidationBehavior<T>, which executes FluentValidation rules before the handler is reached.

REST API

API Endpoints

Complete RESTful API with authentication via the X-User-Id header.

MethodRouteDescription
Authentication
POST/api/auth/registerRegister a new user
POST/api/auth/loginLogin
GET/api/auth/search?q=Search users
Notes
GET/api/notes/myFetch own notes
GET/api/notes/sharedFetch shared notes
GET/api/notes/{id}Fetch single note
POST/api/notesCreate a new note
PUT/api/notes/{id}/contentUpdate content
PUT/api/notes/{id}/titleUpdate title
DELETE/api/notes/{id}Delete note (owner only)
Collaboration
POST/api/notes/{id}/collaboratorsInvite collaborator
DELETE/api/notes/{id}/collaborators/{userId}Remove collaborator
Real-Time

SignalR Events

WebSocket-based real-time communication with Groups and User-Targeting.

SERVER → ALL

NoteCreated

A new note was created

SERVER → GROUP

NoteUpdated

Note was updated

SERVER → ALL

NoteDeleted

Note was deleted

SERVER → GROUP

UserJoined

User joined a note

SERVER → GROUP

UserLeft

User left a note

CLIENT ↔ GROUP

ContentEdited

Real-time text changes

CLIENT ↔ GROUP

TitleEdited

Real-time title changes

SERVER → USER

CollaboratorAdded

Invitation to a note

SERVER → USER

CollaboratorRemoved

Access to note revoked