GhaylStackDocumentationv1.0.2
العربيةWebsite
Architecture

Architecture

Architecture and project map

Understand the hosts, module boundaries and services before changing a feature.

Read the repository by responsibility

GhaylStack runs its business modules inside one ASP.NET Core API. Admin and Dashboard are separate React clients that call this API. A module owns its business behavior and persistence while publishing explicit contracts for other modules. This structure lets a team add capabilities without turning every feature into a separate deployment.

Location Responsibility Start here when
src/Host/GhaylStack.Api Compose services, modules and HTTP pipeline An endpoint or module is missing
src/Host/GhaylStack.AppHost Orchestrate local dependencies and clients A local service fails to start
src/Host/GhaylStack.DbMigrator Apply migrations and provision seed data Schema or initial data is missing
src/Modules Business capabilities, contracts and feature handlers A business rule must change
src/BuildingBlocks Shared persistence, jobs, mail, storage and web behavior Several modules need one capability
clients/admin, clients/dashboard Platform administration and tenant workspaces A screen or interaction must change
src/Tests Architecture, unit and integration verification A behavior needs evidence

Understand startup ownership

AppHost.cs declares PostgreSQL, Valkey, RustFS and development mail, then starts migration and demonstration seeding before the API. Read service endpoints in Aspire rather than assuming every infrastructure port is fixed. Admin normally uses 5173 and Dashboard 5174.

The API registers Mediator contract and handler assemblies, adds shared services with AddHeroPlatform, registers framework eventing once, then loads the module assemblies. These are separate registrations: discovering a module does not automatically add a missing assembly to Mediator's source-generation configuration.

The API does not own demonstration seeding. The migrator's apply and seed-demo paths do. A database problem should therefore be investigated in the migrator logs before changing a feature handler.

Follow one business operation

Use Catalog's CreateBrand feature as a small complete example. Its contract defines the input, its endpoint maps HTTP and permission requirements, its validator checks field rules, and its handler creates the domain entity and saves through CatalogDbContext. This is the vertical-slice development path.

Shared request behavior handles authentication, localization, authorization and errors. Business rules remain in the feature and domain layer. A frontend label is not an authorization boundary; the API still checks the operation.

Choose the right extension point

For a new operation on an existing domain, add a feature inside that module. For an independent business capability with its own model and lifecycle, follow add a module. For cross-module communication, reference the owner's Contracts project or publish a documented integration event. Avoid reaching into another module's context or tables from feature code.

Generated applications use their own project and solution names. Paths in this handbook describe the starter-kit repository; substitute the generated name when following host commands in your application.

Check the result

Build the solution and run architecture tests after changing project references or composition:

sh
dotnet build src/GhaylStack.slnx -c Release
dotnet test src/Tests/Architecture.Tests -c Release

Then verify the affected endpoint against a running API with a permitted user and a user without permission. A successful build proves compilation; it does not prove tenant isolation, successful migration or a complete frontend journey. Continue with module boundaries and the request lifecycle.

Implementation references

View MarkdownBack to top

Search documentation

Use ↑ ↓ to move, Enter to open and Esc to close.