Giter Club home page Giter Club logo

fullstackhero / dotnet-webapi-boilerplate Goto Github PK

View Code? Open in Web Editor NEW
4.1K 138.0 1.3K 3.79 MB

Production Grade Cloud-Ready .NET 8 Starter Kit (Web API + Blazor Client) with Multitenancy Support, and Clean/Modular Architecture that saves roughly 200+ Development Hours! All Batteries Included.

Home Page: https://fullstackhero.net/dotnet-webapi-boilerplate/

License: MIT License

C# 93.86% HTML 1.67% PowerShell 0.72% Vim Snippet 1.97% Makefile 0.21% Shell 0.08% HCL 1.49%
clean-architecture dotnet webapi multitenancy boilerplate template fullstackhero codewithmukesh clean-architechture dotnet8 starter-kit vertical-slice-architecture modular-monolith aws blazor docker terraform

dotnet-webapi-boilerplate's Introduction

dotnet-cicd GitHub Discord Nuget downloads Twitter

fullstackhero webapi

What's fullstackhero's .NET Web API Boilerplate?

fullstackhero's .NET Web API Boilerplate is a starting point for your next .NET 7 Clean Architecture Project that incorporates the most essential packages and features your projects will ever need including out of the box Multi-Tenancy support. This project can save well over 200+ hours of development time for your team.

As the name suggests, this is an API / Server Boilerplate. You can find other Client Boilerplates that consume this API under @fullstackhero handle.

YouTube Video - .NET Web API Boilerplate | FullStackHero - Getting Started

Watch the Getting started video here : https://www.youtube.com/watch?v=a1mWRLQf9hY

.NET Web API Boilerplate | FullStackHero - Getting Started

Goals

The goal of this repository is to provide a complete and feature-rich starting point for any .NET Developer / Team to kick-start their next major project using .NET 7 Web API. This also serves the purpose of learning advanced concepts and implementations such as Multitenancy, CQRS, Onion Architecture, Clean Coding standards, Cloud Deployments with Terraform to AWS, Docker Concepts, CICD Pipelines & Workflows and so on.

Features

  • Built on .NET 7.0
  • Follows Clean Architecture Principles
  • Domain Driven Design
  • Cloud Ready. Can be deployed to AWS Infrastructure as ECS Containers using Terraform!
  • Docker-Compose File Examples
  • Documented at fullstackhero.net
  • Multi Tenancy Support with Finbuckle
    • Create Tenants with Multi Database / Shared Database Support
    • Activate / Deactivate Tenants on Demand
    • Upgrade Subscription of Tenants - Add More Validity Months to each tenant!
  • Supports MySQL, MSSQL, Oracle & PostgreSQL!
Click to See More!
  • Uses Entity Framework Core as DB Abstraction
  • Flexible Repository Pattern
  • Dapper Integration for Optimal Performance
  • Serilog Integration with various Sinks - File, SEQ, Kibana
  • OpenAPI - Supports Client Service Generation
  • Mapster Integration for Quicker Mapping
  • API Versioning
  • Response Caching - Distributed Caching + REDIS
  • Fluent Validations
  • Audit Logging
  • Advanced User & Role Based Permission Management
  • Code Analysis & StyleCop Integration with Rulesets
  • JSON Based Localization with Caching
  • Hangfire Support - Secured Dashboard
  • File Storage Service
  • Test Projects
  • JWT & Azure AD Authentication
  • MediatR - CQRS
  • SignalR Notifications
  • & Much More

Documentation

Read Documentation related to this Boilerplate here - https://fullstackhero.net/dotnet-webapi-boilerplate/

Feel free to contribute to the Documentation Repository - https://github.com/fullstackhero/docs

Getting Started

To get started with this Boilerplate, here are the available options.

  • Install using the FSH CLI tool. Use this for release versions of the Boilerplate only.
  • Fork the Repository. Use this if you want to always keep your version of the Boilerplate up-to date with the latest changes.

Make sure that your DEV enviroment is setup, Read the Development Environment Guide

FSH CLI Tool

Prerequisites

Before creating your first fullstackhero solution, you should ensure that your local machine has:

  • .NET 7 You can find the download here.
  • NodeJS (16+) You can find the download here.

Installation

After you have installed .NET, you will need to install the fsh console tool.

dotnet tool install --global FSH.CLI
fsh install

This isntall the FSH CLI tools and the associated Templates. You are now ready to create your first FSH project!

FSH .NET WebAPI Boilerplate

Here's how you would create a Solution using the FSH .NET WebAPI Boilerplate.

Simply navigate to a new directory (wherever you want to place your new solution), and open up Command Prompt at the opened directory.

Run the following command. Note that, in this demonstration, I am naming my new solution as FSH.Starter.

fsh api new FSH.Starter

OR

fsh api n FSH.Starter

This will create a new .NET 7 WEBAPI solution for you using the FSH Templates. For further steps and details, Read the Getting Started Guide

Update

To update the tool & templates, run the following commands

dotnet tool update FSH.CLI --global
fsh update

Forking the Repository

You would probably need to take this approach if you want to keep your source code upto date with the latest changes. To get started based on this repository, you need to get a copy locally. You have three options: fork, clone, or download.

  • Make a fork of this repository in your Github account.
  • Create your new dotnet-webapi-boilerplate personal project by cloning the forked repository on your personal github.
  • Setup an upstream remote on your personal project pointing to your forked repository using command git remote add upstream https://github.com/{githubuseraccount}/dotnet-webapi-boilerplate and git remote set-url --push upstream DISABLE

For step by step instructions, follow this and this.

Quick Start Guide

So, for a better developer experience, I have added Makefile into the solution. Now that our solution is generated, let's navigate to the root folder of the solution and open up a command terminal.

To build the solution,

make build

By default, the solution is configured to work with postgresql database (mainly because of hte OS licensing). So, you will have to make sure that postgresql database instance is up and running on your machine. You can modify the connection string to include your username and password. Connections strings can be found at src/Host/Configurations/database.json and src/Host/Configurations/hangfire.json. Once that's done, let's start up the API server.

make start

That's it, the application would connect to the defined postgresql database and start creating tables, and seed required data.

For testing this API, we have 3 options.

  1. Swagger @ localhost:5001/swagger
  2. Postman collections are available ./postman
  3. ThunderClient for VSCode. This is my personal favorite. You will have to install the Thunderclient extension for VSCode.

The default credentials to this API is:

{
    "email":"[email protected]",
    "password":"123Pa$$word!"
}

Open up Postman, Thunderclient or Swagger.

identity -> get-token

This is a POST Request. Here the body of the request will be the JSON (credentials) I specified earlier. And also, remember to pass the tenant id in the header of the request. The default tenant id is root.

Here is a sample CURL command for getting the tokens.

curl -X POST \
  'https://localhost:5001/api/tokens' \
  --header 'Accept: */*' \
  --header 'tenant: root' \
  --header 'Accept-Language: en-US' \
  --header 'Content-Type: application/json' \
  --data-raw '{
  "email": "[email protected]",
  "password": "123Pa$$word!"
}'

And here is the response.

{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI6IjM0YTY4ZjQyLWE0ZDgtNDNlMy1hNzE3LTI1OTczZjZmZTJjNyIsImh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3dzLzIwMDUvMDUvaWRlbnRpdHkvY2xhaW1zL2VtYWlsYWRkcmVzcyI6ImFkbWluQHJvb3QuY29tIiwiZnVsbE5hbWUiOiJyb290IEFkbWluIiwiaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcvd3MvMjAwNS8wNS9pZGVudGl0eS9jbGFpbXMvbmFtZSI6InJvb3QiLCJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9zdXJuYW1lIjoiQWRtaW4iLCJpcEFkZHJlc3MiOiIxMjcuMC4wLjEiLCJ0ZW5hbnQiOiJyb290IiwiaW1hZ2VfdXJsIjoiIiwiaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcvd3MvMjAwNS8wNS9pZGVudGl0eS9jbGFpbXMvbW9iaWxlcGhvbmUiOiIiLCJleHAiOjE2ODA5NDE3MzN9.VYNaNvk2T4YDvQ3wriXgk2W_Vy9zyEEhjveNauNAeJY",
  "refreshToken": "pyxO30zJK8KelpEXF0vPfbSbjntdlbbnxrZAlUFXfyE=",
  "refreshTokenExpiryTime": "2023-04-15T07:15:33.5187598Z"
}

You will need to pass the token in the request headers to authenticate calls to the fullstackhero API!

For further steps and details, Read the Getting Started Guide

Containerization

The API project, being .NET 7, it is configured to have built-in support for containerization. That means, you really don't need a Dockerfile to containerize the webapi.

To build a docker image, all you have to do is, ensure that docker-desktop or docker instance is running. And run the following command at the root of the solution.

make publish

You can also push the docker image directly to dockerhub or any supported registry by using the following command.

make publish-to-hub

You will have to update your docker registry / repo url in the Makefile though!.

Docker Compose

This project also comes with examples of docker compose files, where you can spin up the webapi and database isntance in your local containers with the following commands.

make dcu #docker compose up - Boots up the webapi & postgresql container
make dcd #docker compose down - Shuts down the webapi & postgresql containers

There are also examples for mysql & mssql variations of the fsh webapi. You can find the other docker-compose files under the ./docker-compose folder. Read more about fullstackhero's docker-compose instructions & files here

Cloud Deployment with Terraform + AWS ECS

This is something you wont get to see very often with boilerplates. But, we do support cloud deployment to AWS using terraform. The terraform files are available at the ./terraform folder.

Prerequisites

  • Install Terraform
  • Install & Configure AWS CLI profiles to allow terraform to provision resources for you. I have made a video about AWS Credentials Management.

In brief, the terraform folder has 2 sub-folders.

  • backend
  • environments/staging

The Backend folder is internally used by Terraform for state management and locking. There is a one-time setup you have to do against this folder. Navigate to the backend folder and run the command.

terraform init
terraform apply -auto-approve

This would create the required S3 Buckets and DDB table for you.

Next is the environments/staging folder. Here too, run the following command.

terraform init

Once done, you can go the terraform.tfvars file to change the variables like,

  • project tags
  • docker image name
  • ecs cluster name and so on.

After that, simply back to the root of the solution and run the following command.

make ta

This will evaluate your terraform files and create a provision plan for you. Once you are ok, type in yes and the tool will start to deploy your .NET WebAPI project as containers along with a RDS PostgreSQL intance. You will be receiving the hosted api url once the provisioning is completed!

To destroy the deployed resources, run the following

make td

Important Links & Documentations

Overview - Read

Getting Started - Read

Development Environment - Learn about setting up the DEV environment

Participate in Discussions - QNA & General Discussions

Join our Discord - fullstackhero @ Discord

Changelogs

View Complete Changelogs.

Community

License

This project is licensed with the MIT license.

Support ⭐

Has this Project helped you learn something New? or Helped you at work? Here are a few ways by which you can support.

buy-me-a-coffee

Code Contributors

This project exists thanks to all the people who contribute. Submit your PR and join the elite list!

fsh dotnet webapi contributors

Financial Contributors

Become a financial contributor and help me sustain the project. Support the Project!

dotnet-webapi-boilerplate's People

Contributors

274188a avatar akema-trebla avatar alex0403lin avatar b-virtual avatar baranacikgoz avatar cetindogu avatar chhinsras avatar chihabhajji avatar chrbos avatar dependabot[bot] avatar frankyjquintero avatar fretje avatar geekz-reno avatar gialan avatar iammukeshm avatar ittyabrehman avatar juststeve avatar marcelo-maciel avatar mikaelhild avatar mluepkes avatar musmanrafiq avatar nikolasivkov avatar pashaie avatar pedroventura235 avatar pedroventurawork avatar snax4a avatar tj-styr avatar trihugger avatar xlogex avatar zigimun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dotnet-webapi-boilerplate's Issues

Error seeding the database

Describe the bug
EF complains the databases does not exist. -Migrations should be applied before seeding.
Also the the index on Identity.Roles [NormalizedName] is Unique and will prevent same RoleName even per Tenant when seeding the db.

To Reproduce
Steps to reproduce the behavior:

  1. run 'update-database'

Suggestion
Remove index on NormalizedName and add unique index on {normalizedname,tenantId}

Create project without multitenancy

Is your feature request related to a problem? Please describe.
I want to use FSH without tenant, the problem is you should send always header with tenant key and always tenant service work with every service and get connection strings

Describe the solution you'd like
create two templates or make an option to disable tenant

thanks

Add Mapster support for object mappings

Please add the Mapster for object mapping as it is much efficient on both speed and memory. We could gain a 4x performance improvement while using only 1/3 of memory. we don't need to write our own DTO classes. Mapster provides Mapster. Tool to help us generating models. And if we would like to have explicit mapping, Mapster also generates a mapper class for us.

Mapster Repository URL:
https://github.com/MapsterMapper/Mapster

Brands Controller

Describe the bug

  1. In Postman, the get-brands function does not work with and without parameters.
  2. Create a new brand and specify the brand's name and description.
    Then just update the brand name by deleting the brand definition. (The brand definition is required to be null by the user) In this case, the api gives an error "Object reference not set to an instance of an object".

To Reproduce
Steps to reproduce the behavior:

  1. Run the Catalog/get-brands function with Postman.
  2. Build Brand. (Enter name and description)
    Update Brand (Keep the name the same, delete the description)
    Brand Update (Keep the name the same, write a new description)

Expected behavior

  1. I think it should fetch the brand list with the pagination parameter.
  2. I think the new values ​​of the brand should be saved in the database.

Desktop (please complete the following information):
Postman

I'm sorry for my bad english.

Error when removing-migration

Describe the bug
An error occurs when removing a previous created migration.
Error: A relational store has been configured without specifying either the DbConnection or connection string to use.

To Reproduce
Steps to reproduce the behavior:

  1. Open Package Manger Console in Visual Studio
  2. Create a new migration using the following command:
    add-migration AddSortOrder -context ApplicationDbContext -project Migrators.MSSQL -outputdir Migrations\Application -args "--provider SqlServer"
  3. Remove migration using the following command:
    remove-migration -context ApplicationDbContext -project Migrators.MSSQL -args "--provider SqlServer"
  4. Following error occurs:

System.InvalidOperationException: A relational store has been configured without specifying either the DbConnection or connection string to use.
at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.get_DbConnection()
at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.Open(Boolean errorsExpected)
at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerDatabaseCreator.<>c__DisplayClass18_0.b__0(DateTime giveUp)
at Microsoft.EntityFrameworkCore.ExecutionStrategyExtensions.<>c__DisplayClass12_02.<Execute>b__0(DbContext c, TState s) at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.Execute[TState,TResult](TState state, Func3 operation, Func3 verifySucceeded) at Microsoft.EntityFrameworkCore.ExecutionStrategyExtensions.Execute[TState,TResult](IExecutionStrategy strategy, TState state, Func2 operation, Func2 verifySucceeded) at Microsoft.EntityFrameworkCore.ExecutionStrategyExtensions.Execute[TState,TResult](IExecutionStrategy strategy, TState state, Func2 operation)
at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerDatabaseCreator.Exists(Boolean retryOnNotExists)
at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerDatabaseCreator.Exists()
at Microsoft.EntityFrameworkCore.Migrations.HistoryRepository.Exists()
at Microsoft.EntityFrameworkCore.Migrations.HistoryRepository.GetAppliedMigrations()
at Microsoft.EntityFrameworkCore.Migrations.Design.MigrationsScaffolder.RemoveMigration(String projectDir, String rootNamespace, Boolean force, String language)
at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.RemoveMigration(String contextType, Boolean force)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.RemoveMigrationImpl(String contextType, Boolean force)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.RemoveMigration.<>c__DisplayClass0_0.<.ctor>b__0()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.<>c__DisplayClass3_0`1.b__0()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
A relational store has been configured without specifying either the DbConnection or connection string to use.

Expected behavior
Migration is removed.

Screenshots
image

Desktop (please complete the following information):

  • Windows 10

Can We Add Specification to GetSearchResult

In Pagination Request Can We add includes to GetSearchResult in Repository Class

public async Task<PaginatedResult<TDto>> GetSearchResultsAsync<T, TDto>(int pageNumber, int pageSize = int.MaxValue, string[] orderBy = null, Search advancedSearch = null, string keyword = null, Expression<Func<T, bool>> expression = null,
params string[] includes ,
CancellationToken cancellationToken = default)
        where T : BaseEntity
        where TDto : IDto
        {
            IQueryable<T> query = _dbContext.Set<T>().AsNoTracking();
            if (includes != null)
            {
                foreach (var include in includes)
                {
                    if (include != null)
                        query = query .Include(include);
                }
            }

            if (expression != null) query = query.Where(expression);
            if (advancedSearch?.Fields.Count > 0 && !string.IsNullOrEmpty(advancedSearch.Keyword))
                query = query.AdvancedSearch(advancedSearch);
            else if (!string.IsNullOrEmpty(keyword))
                query = query.SearchByKeyword(keyword);
            string ordering = new OrderByConverter().ConvertBack(orderBy);
            query = !string.IsNullOrWhiteSpace(ordering) ? query.OrderBy(ordering) : query.OrderBy(a => a.Id);
            return await query.ToMappedPaginatedResultAsync<T, TDto>(pageNumber, pageSize);
        }

Swagger Setup

  • Code Separation via Extensions
  • Custom Swagger
  • JWT Auth Support

Multi Tenant - ApplicationDbContext on BackgroundJob, Worker or isolated process: Example HangFire

The use of the 'contextdb' within an isolated process presents conflicts since the whole definition depends on the httpContext for some internal processes such as audit or multiple tenant (ITenantService tenantService, ICurrentUser currentUserService)

https://github.com/fullstackhero/dotnet-webapi-boilerplate/blob/ef53f36f419a2817c57381719cf77aaafc133f15/src/Infrastructure/Persistence/ApplicationDbContext.cs#L21

The dependency of the httpContext is generated in these processes

https://github.com/fullstackhero/dotnet-webapi-boilerplate/blob/ef53f36f419a2817c57381719cf77aaafc133f15/src/Infrastructure/Services/General/TenantService.cs#L43

https://github.com/fullstackhero/dotnet-webapi-boilerplate/blob/bc433a04013c1b3580f937d7331b4f6fd779b582/src/Infrastructure/Identity/Services/CurrentUser.cs#L14

This step is a great limitation to be able to create isolated or background processes for secondary tasks or Jobs with Hangfire that require an injection of 'ApplicationDbContext' or any of the existing repositories.

I consider that the process of defining tenantId and CurrentUserId should occur in the flow from the application so the services, dbcontext and other dependencies are isolated from the httpcontext layer

PS: in the case of HangFire, an extra solution must be created since achieving tenure from this point requires additional steps such as those mentioned here:

https://stackoverflow.com/questions/57394712/hangfire-multi-tenant-asp-net-core-resolving-the-correct-tenant

It is to clarify that I do not mean to create a database for each hangfire, but to use the dbcontext within it for background tasks which for obvious reasons cannot carry the HTTP context.

https://docs.hangfire.io/en/latest/background-methods/passing-dependencies.html

Example Basic:

BrandGeneratorTask.cs

`public class BrandGeneratorTask {

    private readonly IRepositoryAsync _repository;
    public BrandGeneratorTask(IRepositoryAsync repository)
    {
        _repository = repository;
    }

    [Queue("notdefault")]
    [DisplayName("Generate Random Brand example job on Queue notDefault")]
    public void Execute()
    {
        foreach (int item in Enumerable.Range(0, 100))
        {
            await _repository.CreateAsync<Brand>(new Brand(name: $"Brand Random - {Guid.NewGuid()}", "Funny description"));
        }
        await _repository.SaveChangesAsync();
    }
}`

Call example(representation of the generic call process from the jobservice):

BackgroundJob.Enqueue<BrandGeneratorTask>(x => x.Execute());

It is finally that the process of sending arguments to Hangfire should not be of type ref or out

https://docs.hangfire.io/en/latest/background-methods/passing-arguments.html

https://www.hangfire.io/blog/2014/05/10/are-your-methods-ready-to-run-in-background.html

INFO: Using VS 2022 Preview

Just in cse anyone else is on the bleeding edge like me

In order to get the code compiling for Visual Studio 2022 (v17.0.0 Preview 4.1) I had to make a few small tweaks:

  1. in the project xml add ImplcitUsings:
    <ImplicitUsings>enable</ImplicitUsings>

  2. at the solution level to set the sdk version by adding a global.json file:
    { "sdk": { "version": "6.0.100-rc.1.21463.6", } }

  • possibly useful to add to the redme.md somewhere?

Setup Identity

  • Initial Folder Structure
  • Projects Setup
  • Persistence Setup
  • Token Generation
  • Refresh Tokens
  • User Registrations
  • DB Seeder

Enhance Multitenancy Workflow

Current Multitenant Implementation takes tenant details from AppSettings. It's better to have these settings stored in the Database and cache them to application memory.

  • Move to a Database Managed Tenant Approach.
  • Create a Root User who has access to manage tenants.
  • Root user should also be a tenant himself.
  • Introduce Caching in Tenant Service
  • Tenant Creation
  • Tenant Validity in Months -> after which tenant users won't have access to the system
  • Tenant Status - Active / Inactive
  • Only Root User has access to tenant management

The remaining flow remains the same as it is now.

Add File Storage Service

  • FileStorage Interface
  • LocalFileStorage Implementation
  • Allow Static File Serving
  • Entity Based Folders
  • Product Image Demo

new Solution does not build when creating from visual studio template

Describe the bug
Try to build a new sln created from template get a build error in the domain and shared projects about sytlecop.json could not be found

To Reproduce
Steps to reproduce the behavior:
create a new sln from the visual studio FullStackHero WebAPI Boilerplate

Expected behavior
sln should build

Support Multiple Key Types for Base Entity

Guid is a secure and reliable data type. But there can be instances where performance can be a bit down due to lot of Guids in DBs.
To combat this, we can make the BaseEntity to BaseEntity where T can be simple ints as well.

Someone can take this up and raise a PR as well.

Things to note.
Ensure new migrations are built.
Test every other scenario as well.

Adding ApplicationUser as Navigation Property to entities

Discussed in #127

Originally posted by pashaie November 2, 2021
Hi,
In Onion Architecture we are supposed to put entities in Domain layer. But ApplicationUser is on Infrastructure layer and that prevents us from adding ApplicationUser as Navigation Property to entities. Is there any best practice for doing it?

Redis Support

  • Option to support Redis Server in Production
  • Include in Docker Composes

Configurable Swagger Support

@iammukeshm recently I was working on a private project with a US client. where the requirement is to build an ERP SAAS application that will be deployed on multiple servers with a load balancer. The client wants to expose the swagger doc on few instances of an application in some regions because of some business purposes. On the basics of this scenario, I think we should also add support to enable/disable the swagger according to the appSettings.json configuration.

Database Sharding Plan

Hi,

Have you considered about database sharding plan? If you've planned to support it, I've read that you primarily support PostgreSQL, and Citus Data is one of the sharding solution for it.

According to Citus docs, one of the requirements is to have composite primary keys:

http://docs.citusdata.com/en/v10.1/use_cases/multi_tenant.html#preparing-tables-and-ingesting-data

But it seems that your Dtos are based on a single primary key:

https://github.com/fullstackhero/dotnet-webapi-boilerplate/blob/main/src/Shared/Shared.DTOs/Catalog/ProductDetailsDto.cs

What do you think about this? Thanks

Add Default Role with Permissions

Whenever a new user is registered, I need a default role to be assigned to this user.

This role should have some default permissions as well.

Add [AllowAnonymous] on create tenant not working

Describe the bug
Its possible to create tenant without doing any authentication?

To Reproduce
Steps to reproduce the behavior:
Change [MustHavePermission(RootPermissions.Tenants.Create)] to [AllowAnonymous] on TenantController -> CreateAsync, still return unauthorized

Expected behavior
Create tenant without perform any authentication

Extensions Cleanup

  • Separate Extensions Physically on the basis of what they do - Helps improve code readability

Refresh token missing property

Hi :)

Bug description

While working with refresh token, I've found out that in GetPrincipalFromExpiredToken() function, property ValidateLifetime should be set to false when creating TokenValidationParameters instance.

How to fix

  1. Go to https://github.com/fullstackhero/dotnet-webapi-boilerplate/blob/d907cacdb6534fe1053ced6da0fc2a5c869df013/src/Infrastructure/Identity/Services/TokenService.cs#L169
  2. Extend tokenValidationParameters variable with ValidateLifetime = false

Get-X-By-Id - caching server-side

Describe the bug
Create a new product, and assigned to a particular brand.
Then updated brand name, and resubmitted the request for the product by id. Did not refresh brand name.
The same is true if you update information on the product, it will return the original product not the new updated information.

To Reproduce
Steps to reproduce the behavior:

  1. Create a Brand
  2. Create a Product - assign to previous brand
  3. Get Product by Id
  4. Update Brand name to a new name
  5. Refresh Product by Id

Expected behavior
Should get any updates to the data, not sure if it is being cached to eliminate reloading data, which makes sense, but I feel it should be able to detect data changes.

Desktop (please complete the following information):
Postman

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.