PastryTycoon is a modular, event-driven simulation game backend built with .NET and Orleans. It models the management of a virtual pastry business, supporting scalable state management and extensibility.
- Orleans-based Grains: Distributed, actor-based state management.
- Event Sourcing: Reliable, auditable state changes.
- Validation: Business logic validation using FluentValidation.
- Azure Storage Support: Local development with Azurite; ready for Azure deployment.
- Modular Architecture: Clear separation between core logic, abstractions, and data access.
- Aspire Orchestration: Unified local development experience using .NET Aspire for running all dependencies and services.
- Comprehensive Testing: Unit tests for both core grains and data access layers.
- Developer Tooling: Integrated dashboards for Orleans, Aspire, and storage emulators for easy monitoring and debugging.
docs/
Documentation files, architecture diagrams, and additional project resources.src/
Main source code folder containing all projects.PastryTycoon.AppHost/
Aspire AppHost project for orchestrating local development dependencies and services.PastryTycoon.Core.Abstractions/
Interfaces, contracts, and shared abstractions used across the solution.PastryTycoon.Core.Grains/
Orleans grains and core business logic for the simulation.PastryTycoon.Core.Grains.IntegrationTests/
Integration tests for testing event flows in the grains using the Orleans Testing Host.PastryTycoon.Core.Grains.UnitTests/
Unit tests for the core grains and business logic using mocks and OrleansTestkit.PastryTycoon.Data/
Data access logic, storage providers, and persistence-related code.PastryTycoon.Data.UnitTests/
Unit tests for the data access layer.PastryTycoon.ServiceDefaults/
Shared service configuration, OpenTelemetry, and cross-cutting concerns for all projects.PastryTycoon.Silo/
Orleans Silo host project, responsible for running the Orleans cluster.PastryTycoon.Web.API/
ASP.NET Core Web API project for exposing endpoints to clients.PastryTycoon.sln
Solution file for the project.
.gitignore
Git ignore rules for the repository.README.md
Project documentation and instructions.
This structure helps organize the backend, API, data, and tests for maintainability and scalability.
- Clone the repository:
git clone https://github.com/your-org/PastryTycoon.git
- Install dependencies:
- .NET 9 SDK
- Docker (for running Azurite and CosmosDB emulator via Aspire AppHost)
- (Optional) Azure Storage Explorer for browsing and managing Azurite/Azure Storage data
- Build the Solution
From the root of the repository, run:
dotnet build src/PastryTycoon.sln
- Run Unit Tests
To execute all unit tests (for both core grains and data layers), run:
dotnet test src/PastryTycoon.sln
- Run the project
To run all dependencies, the Orleans Silo and the Web API:
dotnet run --project src/PastryTycoon.AppHost
The following tools let you browse, manage, and debug your local development data:
-
Access Azurite:
Use Azure Storage Explorer to connect to Azurite athttp://127.0.0.1:10000
(Blob),http://127.0.0.1:10001
(Queue), andhttp://127.0.0.1:10002
(Table).
In Storage Explorer, add a new connection using "Attach to a local emulator" and select Azurite. -
Access CosmosDB Emulator:
Use Azure Cosmos DB Explorer or compatible tools.
Connect to the emulator at https://localhost:8081/_explorer/index.html (you may need to accept the self-signed certificate).
For connection strings and keys, see the official Cosmos DB emulator documentation. -
Access Aspire Dashboard:
After starting, open http://localhost:18888 in your browser to view the Aspire dashboard, which provides health, logs, and endpoint links for all running services. -
Access Orleans Dashboard:
After starting, open http://localhost:8080 in your browser to view the Orleans dashboard for cluster monitoring and management.Note: If you do not see a link to the Orleans dashboard in the Aspire dashboard, simply open the URL above directly in your browser.
- Developer manifesto
Important
Read the Developer Manifesto before writing and committing any code!
- Tooling
For the best development experience with PastryTycoon in VSCode, install the following extensions:
-
C#
Core C# language support (required by C# Dev Kit). -
C# Dev Kit
Full-featured C# support for .NET projects, including IntelliSense, debugging, and project management. -
IntelliCode for C# Dev Kit
AI-assisted code completions and recommendations for C# Dev Kit. -
Container Tools
Enhanced support for developing with containers in VS Code. -
Docker
Build, run, and manage Docker containers and images. -
Markdown All in One
Enhanced Markdown editing and preview support. -
Todo Tree
Quickly search and visualize TODO comments and code annotations across your project.
Contributions are welcome! Please open issues or submit pull requests.
This project is licensed under the MIT License.
-
Aspire
.NET application composition and orchestration for local development. -
Azurite
Local Azure Storage emulator for development and testing. -
Cosmos DB Emulator
Local emulator for Azure Cosmos DB, used for development and testing. -
Docker
Containerization platform used for running local dependencies. -
FluentValidation
Validation library for .NET used for business rule enforcement. -
Microsoft Orleans
Distributed application framework powering the actor-based backend. -
Visual Studio Code
Recommended editor for development with rich extension support.