-
Notifications
You must be signed in to change notification settings - Fork 0
Architecture
anton3x edited this page Nov 15, 2025
·
2 revisions
MatchBy is built as a Blazor Server application using .NET 9, following a layered architecture pattern with clear separation of concerns.
-
Location:
MatchBy/Components/ - Technology: Blazor Server with Razor Components
-
Responsibilities:
- User interface rendering
- User interaction handling
- Component composition
- Client-side state management
Key Components:
-
Pages/- Main application pages (Home, Matches, Chat, Profile) -
Layout/- Layout components (MainLayout, Header, Footer) -
Account/- Identity-related pages (Login, Register, etc.)
-
Location:
MatchBy/Services/ -
Responsibilities:
- Business rule enforcement
- Data transformation
- Service orchestration
- Validation coordination
Services:
-
Matches/- Match creation, search, and management -
Users/- User profile and account management -
Conversations/- Conversation management -
ChatMessages/- Message handling and delivery -
Email/- Email sending functionality -
S3/- File storage operations -
FileValidator/- File validation logic
-
Location:
MatchBy/Data/ - Technology: Entity Framework Core with PostgreSQL
-
Responsibilities:
- Database context management
- Entity configurations
- Migration management
- Data seeding
Key Components:
-
ApplicationDbContext.cs- Main database context -
Configurations/- Entity Framework configurations -
Migrations/- Database migrations -
Seeders/- Database seeding logic
-
Location:
MatchBy/Models/ -
Responsibilities:
- Domain entities
- Business domain logic
- Value objects
Core Models:
-
ApplicationUser- User entity (extends IdentityUser) -
Match- Match/Game entity -
Team- Team entity -
ChatMessage- Chat message entity -
Conversation- Conversation entity -
Friend- Friend relationship -
PlayerRating- Player rating/feedback -
MatchInvite/TeamInvite- Invitation entities
-
Location:
MatchBy/DTOs/ -
Responsibilities:
- Data transfer between layers
- API contract definition
- Data mapping
DTO Categories:
-
Match/- Match-related DTOs -
Chat/- Chat-related DTOs (Messages, Conversations) -
User/- User-related DTOs
-
Location:
MatchBy/Hubs/ - Technology: ASP.NET Core SignalR
- Purpose: Real-time bidirectional communication
Hubs:
-
ChatHub- Real-time chat messaging
All services are registered in Program.cs using the built-in dependency injection container:
- Scoped Services: Most business services (MatchesService, UsersService, etc.)
- Singleton Services: S3Service, configuration services
- Transient Services: EmailSender
- Framework: ASP.NET Core Identity
- Authentication: Cookie-based authentication
-
Features:
- Email confirmation required
- Two-factor authentication support
- Password reset functionality
- Account deletion
- Service: AWS S3 (via Supabase Storage)
-
Location:
MatchBy/Services/S3/ - Usage: Profile images, match-related files
-
Configuration:
S3Settingsinappsettings.json
- Framework: FluentValidation
-
Location:
MatchBy/Validators/ - Usage: Server-side validation for DTOs and models
- Provider: PostgreSQL (via Npgsql)
- ORM: Entity Framework Core 9
- Naming: Snake_case (via EFCore.NamingConventions)
- Migrations: Code-first approach
- Resend - Email delivery service
- AWS S3 (Supabase Storage) - File storage
- Sentry - Error tracking and monitoring (optional)
- Blazorise - UI component library
MatchBy/
├── Components/ # Presentation layer
│ ├── Pages/ # Application pages
│ ├── Layout/ # Layout components
│ └── Account/ # Identity pages
├── Controllers/ # API controllers
├── Data/ # Data access layer
│ ├── Configurations/
│ ├── Migrations/
│ └── Seeders/
├── DTOs/ # Data transfer objects
├── Enums/ # Enumerations
├── Extensions/ # Extension methods
├── Hubs/ # SignalR hubs
├── Models/ # Domain models
├── Services/ # Business logic services
├── Settings/ # Configuration classes
└── Validators/ # FluentValidation validators
- User Request → Blazor Component
- Component → Service (via DI)
- Service → DbContext (via DI)
- DbContext → PostgreSQL Database
- Response flows back through the layers
- Client → SignalR Hub
- Hub → Broadcast to connected clients
- Clients receive updates via WebSocket connection
- Separation of Concerns: Each layer has a single responsibility
- Dependency Injection: All dependencies injected via constructor
- Async/Await: All I/O operations are asynchronous
- Error Handling: Centralized error handling with custom error pages
- Validation: Server-side validation using FluentValidation
-
Configuration: Settings stored in
appsettings.jsonor User Secrets
- Home - Main documentation index
- Database Schema - Database structure
- Deployment - Deployment and CI/CD