Skip to content

Latest commit

 

History

2,015 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

.NET Playground

Build & Test

An ASP.NET Core web application showcasing modern .NET patterns, integrations, and feature examples. Hosted live at https://haos.hopto.org/dotnet/

Features

  • InkBall Game — Real-time multiplayer drawing game using SignalR with WebSocket support
  • Blogging System — Create, edit, and manage blog posts and comments
  • Hash Generator — Compute and search MD5/SHA256 hashes with caching
  • Identity Management — User authentication with ASP.NET Core Identity + OAuth providers (Google, Facebook, GitHub, Twitter)
  • Admin UI — IdentityManager2 integration for user/role management at /dotnet/idm
  • Multi-Database Support — Switch between SQLite, SQL Server, PostgreSQL, MySQL, Oracle, or MongoDB via configuration
  • Distributed Caching — SQL Server or MySQL session cache backends
  • Background Tasks — YouTube upload integration with file watching
  • End-to-End Tests — Playwright test suite with pre-configured test users
  • Asset Pipeline — Gulp-based compilation for JS/CSS/translations with webpack bundling

Quick Start

Prerequisites

  • .NET SDK
  • Node.js (bun/pnpm/npm) for asset pipeline
  • Docker (optional, for database services)

Setup

# Clone with submodules (InkBall, IdentityManager2, Caching-MySQL)
git clone https://github.com/ChaosEngine/Dotnet-Playground.git
cd Dotnet-Playground
git submodule update --init --recursive

# Restore .NET dependencies
dotnet restore

# Install Node dependencies
bun install  # or: npm install / pnpm install

# Build assets
bun x gulp  # or: npm run gulp

# Run the app (listens on https://localhost:4553/dotnet/)
dotnet run --project DotnetPlayground.Web

Run Tests

# Unit and integration tests
dotnet test

# Playwright e2e tests (requires app running)
cd e2e
npm run test  # or: bunx playwright test

Configuration

Edit DotnetPlayground.Web/appsettings.json or use user-secrets:

dotnet user-secrets set "DBKind" "sqlite"  # sqlite|sqlserver|postgres|mysql|oracle|mongodb
dotnet user-secrets set "Authentication:Google:ClientId" "your-client-id"

Key Settings:

  • AppRootPath — All routes run under /dotnet/ path
  • DBKind — Database provider (default: sqlite)
  • Authentication:* — OAuth credentials for external login providers
  • YouTubeAPI — YouTube upload integration (optional)

Project Structure

├── DotnetPlayground.Web/       # Main ASP.NET Core app
├── DotnetPlayground.Tests/     # Unit & integration tests
├── e2e/                        # Playwright end-to-end tests
├── InkBall/                    # Game module (submodule)
├── IdentityManager2/           # Identity admin UI (submodule)
├── Caching-MySQL/              # MySQL distributed cache (submodule)
└── gulpfile.mjs                # Asset build pipeline

Architecture Highlights

  • Database Contexts: Two DbContexts (BloggingContext + GamesContext) with auto-migration on DEBUG startup
  • Provider Abstraction: ContextFactory wires up database/cache based on DBKind build constant
  • Modular Design: InkBall game, IdentityManager2 admin, and Caching-MySQL are git submodules
  • SignalR Integration: Real-time game updates via MessagePack or JSON protocol
  • Background Tasks: BackgroundTaskQueue service for async operations (video processing, etc.)
  • Path Isolation: All middleware and routes scoped under /dotnet via app.Map() for multi-tenancy readiness

Development

Build Configurations

  • Debug — All database providers enabled (INCLUDE_ORACLE, INCLUDE_MONGODB, INCLUDE_SQLSERVER, INCLUDE_POSTGRES, INCLUDE_MYSQL)
  • Release — MySQL only (production-optimized)
  • Oracle — Oracle provider only

Asset Pipeline

Uses Gulp + Webpack for bundling JavaScript (including workers) and SCSS compilation. Run after any JS/CSS changes:

bun x gulp

CDN SRI Validation

Razor/HTML CDN tags with integrity attributes are validated by a local checker. It verifies both package-version alignment against package.json and hash correctness against CDN bytes.

Detailed usage: tools/sri/sri-tools.md

Current scan scope:

  • DotnetPlayground.Web (all .cshtml, .razor, .html, .htm)
  • InkBall/src (all .cshtml, .razor, .html, .htm)
# Validate all CDN integrity references in DotnetPlayground.Web
npm run sri:check

# Recompute and patch mismatched integrity values in-place
npm run sri:update

# Optional targeted update modes (Node)
node tools/sri/sri-check.mjs --update --only bootstrap-table
node tools/sri/sri-check.mjs --update --changed

# Optional targeted update modes (Bun)
bun tools/sri/sri-check.mjs --update --only bootstrap-table
bun tools/sri/sri-check.mjs --update --changed

Notes:

  • Checker retries unreachable CDN URLs three times with exponential backoff.
  • In CI, network failures fail the job.
  • For local troubleshooting, --allow-network-failures downgrades network errors to warnings.

Test Users (Debug Only)

Seeded automatically in DEBUG builds:

  • Playwright1@test.domain.com / Playwright1!
  • Playwright2@test.domain.com / Playwright2!

Deployment

# Publish (triggers gulp build internally)
dotnet publish -c Release -r win-x64 --self-contained

# Or use Docker
docker build -t dotnet-playground .
docker-compose up

License

MIT — See LICENSE file for details

Contributing

Issues and pull requests welcome! Please refer to .github/copilot-instructions.md for development guidelines.

About

Dotnet core examples, tests and experiments pages

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages