Skip to content

MartinMikes/spec-kit-for-dotnet-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

.NET Web Application Template with Spec-Kit

A comprehensive template for .NET 10 web applications using GitHub's spec-kit framework with best practices, coding standards, and architectural guidelines.

πŸ“‹ Overview

This repository serves as a foundational template for building modern .NET web applications. It includes comprehensive specifications, best practices, and guidelines following:

  • .NET 10 best practices
  • Clean Architecture principles
  • Domain-Driven Design (DDD)
  • Security-first approach
  • Performance optimization strategies
  • Comprehensive testing standards

πŸ—οΈ Technology Stack

Backend

  • .NET 10 - Latest LTS version
  • ASP.NET Core - Web framework
  • Entity Framework Core - ORM
  • MediatR - CQRS pattern
  • FluentValidation - Input validation

Frontend

  • React or Vue.js - UI framework (your choice)
  • FluentUI (Microsoft) - Component library
  • TypeScript - Type-safe JavaScript

Database

  • PostgreSQL or SQL Server - Primary database
  • Redis - Caching and session storage

DevOps

  • Docker - Containerization
  • GitHub Actions - CI/CD
  • Azure or AWS - Cloud hosting

πŸ“ Repository Structure

.github/
└── specs/                          # Spec-kit specifications
    β”œβ”€β”€ constitution.md             # Core principles and guidelines
    β”œβ”€β”€ best-practices.md           # .NET 10 coding standards
    β”œβ”€β”€ rules.md                    # Development rules and conventions
    β”œβ”€β”€ naming-conventions.md       # Standardized naming conventions
    └── specifications/
        β”œβ”€β”€ architecture.md         # Application architecture guidelines
        β”œβ”€β”€ security.md             # Security best practices
        β”œβ”€β”€ performance.md          # Performance optimization
        β”œβ”€β”€ testing.md              # Testing standards
        └── ui-guidelines.md        # React/Vue + FluentUI guidelines

πŸš€ Getting Started

Prerequisites

Using This Template

  1. Click "Use this template" button on GitHub

  2. Clone your new repository

    git clone https://github.com/yourusername/your-project-name.git
    cd your-project-name
  3. Review the specifications

  4. Create your .NET project structure

    # Create solution
    dotnet new sln -n YourProjectName
    
    # Create projects following clean architecture
    dotnet new classlib -n YourProjectName.Domain
    dotnet new classlib -n YourProjectName.Application
    dotnet new classlib -n YourProjectName.Infrastructure
    dotnet new webapi -n YourProjectName.Api
    
    # Add projects to solution
    dotnet sln add **/*.csproj
  5. Set up frontend (React or Vue.js)

    # React with TypeScript
    npx create-react-app client --template typescript
    cd client
    npm install @fluentui/react @fluentui/react-icons
    
    # OR Vue.js with TypeScript
    npm create vue@latest
    cd client
    npm install @fluentui/web-components

πŸ“š Documentation

Core Specifications

Technical Specifications

  • Architecture - Clean architecture, CQRS, DDD patterns
  • Security - Authentication, authorization, data protection
  • Performance - Optimization strategies and caching
  • Testing - Unit, integration, and E2E testing standards
  • UI Guidelines - React/Vue.js with FluentUI implementation

πŸ›οΈ Architecture

This template follows Clean Architecture with Domain-Driven Design:

src/
β”œβ”€β”€ Domain/           # Business entities, value objects, domain events
β”œβ”€β”€ Application/      # Use cases, DTOs, CQRS handlers
β”œβ”€β”€ Infrastructure/   # Data access, external services
└── API/              # Controllers, middleware, API endpoints

tests/
β”œβ”€β”€ UnitTests/        # Unit tests (70% of tests)
β”œβ”€β”€ IntegrationTests/ # Integration tests (20% of tests)
└── E2ETests/         # End-to-end tests (10% of tests)

πŸ”’ Security

Security is built-in from the start:

  • βœ… JWT authentication with refresh tokens
  • βœ… Role-based and policy-based authorization
  • βœ… Input validation and sanitization
  • βœ… SQL injection prevention
  • βœ… XSS protection
  • βœ… HTTPS enforcement
  • βœ… Security headers
  • βœ… Rate limiting
  • βœ… Secrets management

See Security Specifications for details.

🚦 Quality Gates

All code must pass these gates before merging:

  • βœ… All unit tests pass
  • βœ… Code coverage > 80%
  • βœ… No critical security vulnerabilities
  • βœ… Linting and formatting checks pass
  • βœ… Peer review approval
  • βœ… Integration tests pass
  • βœ… Performance benchmarks met

πŸ§ͺ Testing Strategy

Following the Test Pyramid:

  • 70% Unit Tests - Fast, isolated, business logic
  • 20% Integration Tests - API and database integration
  • 10% E2E Tests - Critical user journeys

See Testing Standards for details.

πŸ“Š Performance Targets

  • API endpoints: < 200ms (p95)
  • Database queries: < 100ms (p95)
  • Page load time: < 2s (p95)
  • Concurrent users: 10,000+

See Performance Specifications for optimization strategies.

🎨 UI Development

FluentUI Integration

React:

import { ThemeProvider } from '@fluentui/react';
import { PrimaryButton } from '@fluentui/react/lib/Button';

Vue.js:

<template>
  <fluent-button appearance="primary">Click me</fluent-button>
</template>

See UI Guidelines for complete setup.

πŸ”„ Development Workflow

  1. Create feature branch from develop

    git checkout -b feature/your-feature-name
  2. Follow naming conventions from Naming Conventions

  3. Write tests first (TDD approach)

  4. Implement feature following Best Practices

  5. Run quality checks

    dotnet build
    dotnet test
    dotnet format
  6. Create Pull Request with clear description

  7. Pass code review and quality gates

  8. Merge to develop β†’ then to main for release

πŸ“ Code Style

This template uses .editorconfig for consistent formatting:

  • C# files: 4 spaces, PascalCase for public members
  • TypeScript/JavaScript: 2 spaces, camelCase for variables
  • JSON/YAML: 2 spaces
  • Line endings: LF (Unix-style)

🀝 Contributing

  1. Read the Constitution
  2. Follow the Rules
  3. Adhere to Best Practices
  4. Use Naming Conventions
  5. Write comprehensive tests per Testing Standards

πŸ“„ License

This template is available under the MIT License. See LICENSE file for details.

πŸ”— Resources

πŸ’‘ Quick Tips

  • Always use async/await for I/O operations
  • Enable nullable reference types in all projects
  • Use file-scoped namespaces (C# 10+)
  • Implement proper logging with structured logging
  • Cache appropriately with memory and distributed caching
  • Validate all inputs using FluentValidation
  • Never commit secrets - use secure secret management

🎯 Next Steps

  1. Review all specifications in .github/specs/
  2. Set up your project following the architecture guidelines
  3. Configure CI/CD pipeline using GitHub Actions
  4. Implement authentication and authorization
  5. Set up database with migrations
  6. Create your first feature following TDD
  7. Deploy to your preferred cloud platform

Happy Coding! πŸš€

For questions or issues, please refer to the specifications or open an issue in this repository.

About

The template for dotnet web apps generated using GitHub/spec-kit and the best practices

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors