This repo hosts several C# projects that together form the backend of the OpenShock system. All projects target .NET 9 (preview). The solution file OpenShockBackend.slnx includes the API, Cron jobs, a WebSocket gateway, helper utilities and test projects.
Project directories:
API– main ASP.NET Core APILiveControlGateway– WebSocket gateway serviceCron– Hangfire based cron daemonCommon– shared classes and EF Core database contextMigrationHelper– CLI helper for EF Core migrationsSeedE2E– utilities to seed E2E test dataCommon.Tests– unit tests for the Common libraryAPI.IntegrationTests– integration tests for the API
- .NET 9 SDK (preview) must be installed in order to build or run the projects.
- Docker is required when running the integration tests because they spin up Postgres and Redis containers through Testcontainers.
Run the following from the repository root:
dotnet restore
# Build all projects in the solution
dotnet build OpenShockBackend.slnx -c ReleaseDevelopment helpers reside in Dev/. The file Dev/docker-compose.yml spins up Postgres, Redis and the WebUI for local use. Example steps:
# Start dependencies for development
cd Dev
docker compose up -dThe API itself can then be executed with:
dotnet run --project API/API.csprojEnvironment variables are documented in README.md and in the .env file used by the production docker-compose.yml.
Unit tests and integration tests can be executed with dotnet test. Integration tests require Docker.
# Unit tests
dotnet test Common.Tests/Common.Tests.csproj -c Release
# Integration tests (needs Docker)
dotnet test API.IntegrationTests/API.IntegrationTests.csproj -c Release- The repository does not contain build artifacts. Avoid committing the
bin/orobj/folders. Dev/setupUsersecrets.shpopulates development secrets if you are using the .NET user secrets feature.