User Tools

Site Tools


syntheses:dotnet-solution-structure

This is an old revision of the document!


.NET Solution - product/website Structure

Notes

Summary

.NET Solution - product/website Structure

Location

  • Repo: vps/vps (project ID: 1)
  • Path: product/website/
  • Solution file: MammothVps.slnx
  • Build system: .NET (Directory.Build.props, Directory.Packages.props)
  • Runtime: ASP.NET Core (Hosting.AspNetCore)

Project Structure

product/website/
├── AdminSite/           — Admin panel (staff only, NOT customer-facing)
├── Analyzers/           — .NET code analyzers
├── Authentication/      — Auth middleware/services
├── ClassicPanel/        — Legacy WebForms panel (MonoRail MVC)
│   ├── Controllers/
│   │   ├── Panel/       — Customer-facing panel controllers
│   │   │   ├── FirewallController
│   │   │   ├── Network
│   │   │   ├── SelectGuest
│   │   │   ├── SuspendedGuest
│   │   │   └── ...
│   │   ├── Frontend/    — Public/landing controllers
│   │   ├── ApplicationController
│   │   ├── DebugController
│   │   ├── DomainNamePlansController
│   │   ├── HostCommandController
│   │   ├── LandingController
│   │   ├── PlansController
│   │   ├── RescuesController
│   │   ├── SearchController
│   │   └── SitemapController
├── Configuration.*      — Config/log4net/NHibernate modules
│   ├── Configuration/
│   ├── Configuration.AppSettings/
│   ├── Configuration.Log4Net/
│   └── Configuration.NHibernate/
├── Controllers.Shared/  — Shared controller code
├── Core/                — Core shared libraries
├── Domain/              — Core domain entities & services
│   ├── Commands/        — CQRS command objects
│   ├── DTO/             — Data transfer objects
│   ├── Entities/        — Domain entities (see below)
│   ├── Exceptions/      — Custom exceptions
│   ├── Factories/       — Entity factories
│   ├── Interfaces/      — Domain interfaces
│   ├── Mailers/         — Email notification services
│   ├── Parsers/         — Data parsers
│   ├── Services/        — Domain services
│   └── Validators/      — Validation attributes (see below)
├── Environment/         — Environment-specific configuration
├── HostDaemon/          — Daemon running on compute hosts
│   ├── Applets/         — Host command applets
│   ├── Application/     — HostDaemon application logic
│   ├── GuestConfiguration/ — Guest config generation
│   ├── Handlers/        — Host command handlers
│   ├── Helpers/         — Utility classes
│   ├── Hosted/          — Hosted services
│   ├── LoggingContext/  — Logging infrastructure
│   ├── Properties/      — Assembly properties
│   ├── Scripts/         — Shell scripts on hosts
│   ├── Services/        — Host services
│   ├── config/          — HostDaemon config
│   ├── BlockingHostCommandHandler.cs
│   ├── HostCommandExecutor.cs
│   ├── HostCommandHandler.cs
│   ├── HostShell.cs
│   ├── SshShell.cs
│   └── Program.cs
├── Hosting.AspNetCore/  — ASP.NET Core hosting layer
├── Hosting/             — Generic hosting abstractions
├── IntegrationTest/     — Integration test infrastructure
├── Mammoth.Wooly/       — Asset bundling
├── MigratorDotNet/      — Database migrations
├── MonoRail/            — MonoRail MVC framework (ClassicPanel)
├── MpayClient/          — Payment client (Mpay/Merchant)
├── PanelSite/           — Modern SPA panel (.NET Core + React/TypeScript)
│   └── ClientApp/       — React/TypeScript frontend
├── Persistence/         — NHibernate data access
├── Persistence.Mappings/ — NHibernate mapping configurations
├── Schema/              — Database schema definitions
├── StatsDaemon/         — Statistics daemon
├── SynergyClient/       — Synergy wholesale integration
├── Tests/               — Unit tests
├── WebApi/              — REST API (customer + CLI facing)
│   ├── Controllers/     — API controllers (see below)
│   │   ├── WebsiteOnly/ — Panel-only controllers
│   │   ├── AccountsController
│   │   ├── ActionsController
│   │   ├── CustomersController
│   │   ├── DataUsagesController
│   │   ├── DomainsController
│   │   ├── FailoverIpsController
│   │   ├── ImagesController
│   │   ├── InternalController
│   │   ├── InvoiceDocumentController
│   │   ├── KeysController
│   │   ├── LoadBalancersController
│   │   ├── NetworkAlertController
│   │   ├── RegionsController
│   │   ├── ReverseNamesController
│   │   ├── SampleSetsController
│   │   ├── ServersController
│   │   ├── SizesController
│   │   ├── SoftwareController
│   │   ├── TestController
│   │   └── VpcsController
│   ├── DTOs/            — API request/response DTOs
│   ├── DiscriminatedUnion/
│   ├── Middleware/      — API middleware
│   ├── OpenApi/         — OpenAPI/Swagger generation
│   ├── Serialization/   — JSON serialization config
│   ├── Services/        — API services
│   ├── spec/            — OpenAPI spec files
│   ├── Program.cs       — API entry point
│   └── Startup.cs       — API startup configuration
├── devenv/              — Development environment
├── lib/                 — Shared libraries
├── logs/                — Log files
├── packages-custom/     — Custom NuGet packages
├── scripts/             — Build/deploy scripts

Domain Entities (product/website/Domain/Entities/)

Core objects customers interact with:

  • Guest — A VPS/server instance. Has FirewallRules, Interfaces, Storage
  • GuestDisk — Guest disk configuration
  • GuestDiskIndex — Disk indexing
  • GuestExtras — Guest extras/add-ons
  • GuestFirewallRule — Individual firewall rule with SourceAddresses, DestinationAddresses, DestinationPorts, Protocol, Target
  • GuestHostLog — Guest host logging
  • GuestLocation — Guest datacentre location
  • GuestMaintenanceCommand — Maintenance window commands
  • GuestRuntimeInfo — Runtime state
  • GuestUptimeCommand — Uptime tracking
  • Host — Physical compute node
  • HostCommand — Commands sent to compute hosts
  • HostUtilization — Host resource usage
  • Interface — Network interface
  • Invoice / InvoiceLineItem — Billing
  • InvoiceFoldingCommand — Invoice aggregation
  • Kernel — Guest kernel selection
  • Lease — Billing lease

Entity interfaces (command markers):

  • IAllowedDuringGuestMaintenanceCommand
  • ICancellationStateCommand
  • IDnsRecord
  • IMigrateGuestCommand
  • IPasswordResetCommand
  • IProductHostCommand
  • IRestorable
  • ISshHost

Domain Validators (product/website/Domain/Validators/)

Key validators (attribute-based):

  • ValidateAddressListAttribute — Validates individual IP addresses (NOT collection count)
  • ValidateCidrBlockAttribute — CIDR block validation
  • ValidateCollectionNotEmptyAttribute — Non-empty collection check
  • ValidateCreditCardNumberAttribute — Credit card validation
  • ValidateDnsRecordValueAttribute — DNS record value validation
  • ValidateEmailAttribute — Email format
  • ValidateHostnameAttribute — Hostname format
  • ValidateIPv4Attribute — IPv4 address validation
  • ValidateNotCardNumberAttribute — Anti-card-number validation
  • ValidatePasswordComplexityAttribute — Password strength
  • ValidatePortListAttribute — Port list validation
  • ValidateSshKeyAttribute — SSH key format
  • CustomerEmailUniqueAttribute — Email uniqueness
  • CustomerHostnameUniqueAttribute — Hostname uniqueness
  • CustomerSshKeyNameUniqueAttribute — SSH key name uniqueness
  • GuestIsEligibleForFacilityMigrationAttribute — Migration eligibility

WebApi Controllers (product/website/WebApi/Controllers/)

Customer-facing API endpoints:

Controller Resource Notes
AccountsController Account management
ActionsController Guest actions (start/stop/reinstall)
CustomersController Customer profiles
DataUsagesController Data usage tracking
DomainsController Domain registration/management
FailoverIpsController Failover IP management
ImagesController Guest images
InternalController Internal/staff only
InvoiceDocumentController Invoice documents
KeysController SSH key management
LoadBalancersController Load balancer management
NetworkAlertController Network alerts
RegionsController Datacentre regions
ReverseNamesController Reverse DNS
SampleSetsController
ServersController Guest/server management Primary customer entry point
SizesController Plan sizes
SoftwareController Guest software/OS
TestController Health/check endpoints
VpcsController VPC management

Key Service: AdvancedFirewallApiService

  • Method: SetFirewallRules() — accepts firewall rules for a guest
  • Called by: PanelSite frontend, binarylane-cli, Python client, customer scripts
  • Authentication: API key or session-based

Authentication Flow

  • WebApi supports API key and session-based auth
  • ClassicPanel uses session-based auth via MonoRail
  • PanelSite (SPA) uses session/API key auth with React frontend

Build & Deployment

  • Solution: MammothVps.slnx (SDK-style .NET solution)
  • Package management: Directory.Packages.props (centralized)
  • Lock files: packages.lock.json per project
  • CI/CD: .gitlab-ci.yml at repo root
  • Code analysis: biome.jsonc (likely for frontend), analyzers in Analyzers/
  • Pre-commit hooks: .pre-commit-config.yaml
syntheses/dotnet-solution-structure.1784174059.txt.gz · Last modified: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki