Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

A full-featured starter template for `dotnet new` to quickly scaffold an Asp.Net 8 Web-Api project with MongoDB as the data store.

License

Notifications You must be signed in to change notification settings

dj-nitehawk/MongoWebApiStarter

Repository files navigation

// DEPRECATION NOTICE //

This template will no longer be maintained in favor of the FastEndpoints.TemplatePack. In order to scaffold a VSA based project with MongoDB, you can install the template pack and create a new project as shown below:

dotnet new install FastEndpoints.TemplatePack
dotnet new feintproj -n MyAwesomeProject

MongoWebApiStarter

A full-featured starter template for dotnet new to quickly scaffold an Asp.Net 8.0 Web-Api project using pure vertical slice architecture with MongoDB as the data store.

Install & Scaffold

  dotnet new install MongoWebApiStarter
  dotnet new mongowebapi -n MyAwesomeApp

Features

Platform

  • base framework: .net 8.0
  • api/web-service framework: FastEndpoints
  • language: c#
  • database: mongodb

Vertical Slice Architecture

  • each use case/action/feature is isolated in it's own namespace (vertical slice).
  • there is no cross contamination between feature slices.
  • domain entities are contained in a separate namespace as they are cross contaminating by nature.
  • does not use the mediator pattern like most other templates.

Misc. Features

  • strongly typed app settings which binds to appsettings.json
  • JWT token authentication with embedded claims & permissions
  • permission & claim based authorization
  • custom middleware for putting site offline (maintenance mode)

Api Features

  • input validation with fluentvalidation rules
  • account creation, email validation, login
  • salted hash password storage and verification with bcrypt
  • email/sms queue for sending emails with amazon ses
  • image uploading & retrieval

Data Access

  • data access done using mongodb.entities library
  • most data access logic is self contained in each vertical slice.
  • shared data access logic is located in the Logic.* namespace.

Integration Tests