Giter VIP home page Giter VIP logo

netcore-boilerplate's Introduction

netcore-boilerplate

Boilerplate of API in .NET Core 3.1

Travis CI GitHub Codecov
Travis CI Build Status GitHub Build Status codecov

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.

Source code contains

  1. Autofac
  2. Swagger + Swashbuckle
  3. EF Core
  4. Tests
  5. Code quality
  6. Docker
    • Dockerfile
    • Docker-compose
      • mysql:8 with DB initialization
      • mcr.microsoft.com/mssql/server:2017-latest with DB initialization
      • netcore-boilerplate:local
  7. Serilog
  8. DbUp as a db migration tool
  9. Continuous integration

Architecture

Api

HappyCode.NetCoreBoilerplate.Api

HappyCode.NetCoreBoilerplate.Api

Core

HappyCode.NetCoreBoilerplate.Core

HappyCode.NetCoreBoilerplate.Core

DB Migrations

HappyCode.NetCoreBoilerplate.Db

HappyCode.NetCoreBoilerplate.Db

Tests

Integration tests

HappyCode.NetCoreBoilerplate.Api.IntegrationTests

HappyCode.NetCoreBoilerplate.Api.IntegrationTests

Unit tests

HappyCode.NetCoreBoilerplate.Api.UnitTests

HappyCode.NetCoreBoilerplate.Core.UnitTests

HappyCode.NetCoreBoilerplate.Core.UnitTests

Load tests

Keep in mind that entire environment has to be up and running.

HappyCode.NetCoreBoilerplate.Api.LoadTests

HappyCode.NetCoreBoilerplate.Api.LoadTests

How to adapt to your project

Generally it is totally up to you! But in case you do not have any plan, You can follow below simple steps:

  1. Download/clone/fork repository
  2. Remove components and/or classes that you do not need to
  3. Rename files (e.g. sln, csproj, ruleset), folders, namespaces etc.
  4. Give us a star!

Build the solution

Just execute dotnet build in the root directory, it takes HappyCode.NetCoreBoilerplate.sln and build everything.

Start the application

Standalone

At first, you need to have up and running MySQL and MsSQL database servers on localhost with initialized database by mysql script and mssql script.

Then the application (API) can be started by dotnet run command executed in the src/HappyCode.NetCoreBoilerplate.Api directory. By default it will be available under http://localhost:5000/, but keep in mind that documentation is available under http://localhost:5000/swagger/.

Docker (recommended)

Just run docker-compose up command in the root directory and after successful start of services visit http://localhost:5000/swagger/.

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.

Run unit tests

Run dotnet test command in the root directory, it will look for test projects in HappyCode.NetCoreBoilerplate.sln and run them.

Migrate from ASP .NET Core 2.2 to 3.1

Need to migrate from .NET Core 2.2 to .NET Core 3.1? There's an Microsoft article about this, but you can also, just in case, take a look at my migration commit where you can find the complete list of required changes.

To Do

  • any idea? Please create an issue.

Be like a star, give me a star! โญ

If:

  • you like this repo/code,
  • you learn something,
  • you are using it in your project/application,

then please give us a star, appreciate our work. Thanks!

Contribution

You are very welcome to submit either issues or pull requests to this repository!

For pull request please follow this rules:

  • Commit messages should be clear and as much as possible descriptive.
  • Rebase if required.
  • Make sure that your code compile and run locally.
  • Changes do not break any tests and code quality rules.

netcore-boilerplate's People

Contributors

cezarypiatek avatar dependabot-preview[bot] avatar lkurzyniec avatar nblumhardt avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.