https://github.com/bigbuildbench/lkurzyniec_netcore-boilerplate
https://github.com/bigbuildbench/lkurzyniec_netcore-boilerplate
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (10.2%) to scientific vocabulary
Repository
Basic Info
- Host: GitHub
- Owner: BigBuildBench
- License: gpl-2.0
- Language: C#
- Default Branch: master
- Size: 812 KB
Statistics
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 1
- Releases: 0
Metadata Files
README.md
netcore-boilerplate
Boilerplate of API in .NET 8
| GitHub | Codecov | Docker Hub |
|:------:|:-------:|:----------:|
|
|
|
|
Boilerplate is a piece of code that helps you to quickly kick-off a project or start writing your source code. It is kind of a template - instead of starting an empty project and adding the same snippets each time, you can use the boilerplate that already contains such code.
Intention - The intention behind this project is to mix a variety of different approaches to show different available paths. That's why you can find here the Service approach mixed-up with Repository approach, or old-fashioned controllers mixed-up with brand new minimal API in a separate module (modular approach). As well as, it's a kind of playground for exploring frameworks, packages, tooling. At the end, You are in charge, so it's your decision to which path you would like to follow.
Table of content
- Source code contains
- Run the solution
- How to adapt
- Architecture
- DB Migrations
- Tests
- Books module
- To Do
Source code contains
- Central Package Management (CPM)
- Swagger + Swashbuckle
- FeatureManagement (Feature Flags, Feature Toggles)
- HealthChecks
- EF Core
- Dapper
- Tests
- Integration tests with InMemory database
- FluentAssertions
- xUnit
- Verify
- Verify.Http
- TestServer
- Unit tests
- ~~Load tests~~ (Removed in PR135)
- ~~[NBomber]~~(https://nbomber.com/)
- Integration tests with InMemory database
- Code quality
- Architectural tests (conventional tests)
- Analyzers
- Code analysis rule set HappyCode.NetCoreBoilerplate.ruleset
- Code analysis with CodeQL
- Code coverage
- EditorConfig (.editorconfig)
- Docker
- Dockerfile
- Docker-compose
mysql:8with DB initializationmcr.microsoft.com/mssql/server:2022-latestwith DB initializationnetcore-boilerplate:compose
- Build and test
- Push to registry
- Serilog
- Sink: Async
- DbUp as a db migration tool
- Continuous integration
- ~~[Travis CI]~~(https://travis-ci.org/) (travisci.yml)
- GitHub Actions
Run the solution
To run the solution, use one of the options:
- Standalone
- In docker
- Docker compose (recommended)
After successful start of the solution in any of above option, check useful endpoints:
- swagger - http://localhost:5000/swagger/
- health check - http://localhost:5000/healthz/ready
- version - http://localhost:5000/version
Standalone
When running standalone, features like
carsandemployeesmight be disabled.
Execute dotnet run --project src/HappyCode.NetCoreBoilerplate.Api in the root directory.
In docker
When running in docker, features like
carsandemployeesare disabled.
Download form registry
- Docker Hub - https://hub.docker.com/r/lkurzyniec/netcore-boilerplate
- GitHub Container Registry - https://github.com/lkurzyniec/netcore-boilerplate/pkgs/container/netcore-boilerplate
Simply execute docker run --rm -p 5000:8080 --name netcore-boilerplate lkurzyniec/netcore-boilerplate to download and spin up a container.
Build your own image
To run in docker with your own image, execute docker build . -t netcore-boilerplate:local in the root directory to build an image,
and then docker run --rm -p 5000:8080 --name netcore-boilerplate netcore-boilerplate:local to spin up a container with it.
Docker compose
When running on
Linux(i.e. WSL), make sure that all docker files (dockerfile, docker-compose and all mssql files) have line endingsLF.
Just execute docker-compose up command in the root directory.
Migrations
When the entire environment is up and running, you can additionally run a migration tool to add some new schema objects into MsSQL DB.
To do that, go to src/HappyCode.NetCoreBoilerplate.Db directory and execute dotnet run command.
How to adapt
Generally it is totally up to you! But in case you do not have any plan, You can follow below simple steps:
- Download/clone/fork repository :arrowheadingdown:
- Remove components and/or classes that you do not need to :fire:
- Rename files (e.g.
slnorcsproj), folders, namespaces etc :memo: - Appreciate the work :star:
Architecture
Api
HappyCode.NetCoreBoilerplate.Api
- The entry point of the app - Program.cs
- Simple Startup class - Startup.cs
- MvcCore
- DbContext (with MySQL)
- DbContext (with MsSQL)
- Swagger and SwaggerUI (Swashbuckle)
- HostedService and HttpClient
- FeatureManagement
- HealthChecks
- MySQL
- MsSQL
- Filters
- Simple
ApiKeyAuthorization filter - ApiKeyAuthorizationFilter.cs - Action filter to validate
ModelState- ValidateModelStateFilter.cs - Global exception filter - HttpGlobalExceptionFilter.cs
- Simple
- Configurations
Serilogconfiguration place - SerilogConfigurator.csSwaggerregistration place - SwaggerRegistration.cs- Feature flag documentation filter - FeatureFlagSwaggerDocumentFilter.cs
- Security requirement operation filter - SecurityRequirementSwaggerOperationFilter.cs
- Logging
- Custom enricher to have version properties in logs - VersionEnricher.cs
- Simple exemplary API controllers - EmployeesController.cs, CarsController.cs, PingsController.cs
- Example of BackgroundService - PingWebsiteBackgroundService.cs

Core
HappyCode.NetCoreBoilerplate.Core
- Models
- Dto models
- DB models
- AppSettings models - Settings
- DbContexts
- MySQL DbContext - EmployeesContext.cs
- MsSQL DbContext - CarsContext.cs
- Providers
- Version provider - VersionProvider.cs
- Core registrations - CoreRegistrations.cs
- Exemplary MySQL repository - EmployeeRepository.cs
- Exemplary MsSQL service - CarService.cs

DB Migrations
HappyCode.NetCoreBoilerplate.Db
- Console application as a simple db migration tool - Program.cs
- Sample migration scripts, both
.sqland.cs- S001_AddCarTypesTable.sql, S002_ModifySomeRows.cs

Tests
Integration tests
HappyCode.NetCoreBoilerplate.Api.IntegrationTests
- Infrastructure
- Fixture with TestServer - TestServerClientFixture.cs
- TestStartup with InMemory databases - TestStartup.cs
- Simple data feeders - EmployeeContextDataFeeder.cs, CarsContextDataFeeder.cs
- Fakes - FakePingService.cs
- Exemplary tests - EmployeesTests.cs, CarsTests.cs, PingsTests.cs

Unit tests
HappyCode.NetCoreBoilerplate.Api.UnitTests
- Exemplary tests - EmployeesControllerTests.cs, CarsControllerTests.cs, PingsControllerTests.cs
- API Infrastructure Unit tests
HappyCode.NetCoreBoilerplate.Core.UnitTests
- Extension methods to mock
DbSetfaster - EnumerableExtensions.cs - Exemplary tests - EmployeeRepositoryTests.cs, CarServiceTests.cs
- Providers tests

Architectural tests
HappyCode.NetCoreBoilerplate.ArchitecturalTests
- Exemplary tests - ApiArchitecturalTests.cs, CoreArchitecturalTests.cs

Books module
Totally separate module, developed with a modular monolith approach.
Module
The code organized around features (vertical slices).
HappyCode.NetCoreBoilerplate.BooksModule
- Features
- Delete book - Endpoint.cs, Command.cs
- Get book - Endpoint.cs, Query.cs
- Get books - Endpoint.cs, Query.cs
- Upsert book - Endpoint.cs, Command.cs
- Sqlite db initializer - DbInitializer.cs
- Module configuration place - BooksModuleConfigurations.cs

Integration Tests
HappyCode.NetCoreBoilerplate.BooksModule.IntegrationTests
- Infrastructure
- Fixture with TestServer - TestServerClientFixture.cs
- Very simple data feeder - BooksDataFeeder.cs
- Exemplary tests - BooksTests.cs

To Do
- any idea? Please create an issue.
Be like a star, give me a star! :star:
If:
- you like this repo/code,
- you learn something,
- you are using it in your project/application,
then please give me a star, appreciate my work. Thanks!
Buy me a coffee! :coffee:
You are also very welcome to acknowledge my time by buying me a small coffee.
Owner
- Name: BigBuildBench
- Login: BigBuildBench
- Kind: organization
- Repositories: 1
- Profile: https://github.com/BigBuildBench
abbr. B3, benchmarking the repo-level understanding capability of your LLMs by reconstructing project build-file.
GitHub Events
Total
- Delete event: 1
- Issue comment event: 1
- Push event: 1
- Pull request event: 9
- Create event: 14
Last Year
- Delete event: 1
- Issue comment event: 1
- Push event: 1
- Pull request event: 9
- Create event: 14
Issues and Pull Requests
Last synced: 10 months ago
All Time
- Total issues: 0
- Total pull requests: 4
- Average time to close issues: N/A
- Average time to close pull requests: 3 months
- Total issue authors: 0
- Total pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 0.25
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 4
Past Year
- Issues: 0
- Pull requests: 4
- Average time to close issues: N/A
- Average time to close pull requests: 3 months
- Issue authors: 0
- Pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 0.25
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 4
Top Authors
Issue Authors
Pull Request Authors
- dependabot[bot] (8)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- dependabot/fetch-metadata v2.2.0 composite
- actions/checkout v4 composite
- actions/setup-dotnet v4 composite
- github/codeql-action/analyze v3 composite
- github/codeql-action/autobuild v3 composite
- github/codeql-action/init v3 composite
- docker/build-push-action v6 composite
- docker/setup-buildx-action v3 composite
- docker/build-push-action v6 composite
- docker/login-action v3 composite
- docker/metadata-action v5 composite
- docker/setup-buildx-action v3 composite
- actions/checkout v4 composite
- actions/setup-dotnet v4 composite
- codecov/codecov-action v4 composite
- actions/stale v9.0.0 composite
- mcr.microsoft.com/mssql/server 2022-latest
- mysql 8
- netcore-boilerplate compose
