Skip to content

AbrarJahin/Asp.NetCore_3.1-PostGRE_StartupProject

Repository files navigation

Startup Role Management Project for Asp.Net Core 3.1 with PostGRE - perfect for deployment in Linux Server

This application is created with ASP.Net Core 3.1 and PostGRE SQL (any version, tested with v11-v13). This project is a perfect startup place for a project targetting to deploy in Linux server. HTML, CSS, JS minifire all are configured in the project for better performance.

Easy Run and Deploy with Requirements

To run this project, CLI can be enough, but Visual Studio is recommanded because it offers various features to devs.

Prerequisite

  1. ASP.Net Core SDK
  2. PostGRE SQL Server, tested with 11+, should work with any version
  3. Visual Studio 2019

Running with VS

To run this project with Visual Studio 2019, you need to install the dotnet SDK in PC and a PostGRE connection string (connection string comes from PostGRE server which can exists in dev PC or remote server). After having both, you need to change this line in code with your connection string. Then if you build and run the code, everything would be OK.

To apply the migration, you need to run migration update command in package manager console. The command is-

Update-Database

To get the package manager console, you need to go here in VS 2019-

  • Tools -> Library Package Manager -> Package Manager Console

Most common migration commands are added in this project and can be found in here.

CSS and JS library with bundling and minification

Minimal configuration and easy to deploy library manager, bundler and minifire is used in this project which can be easily deployed in linux along with windows easily with zero configuration.

Library management with Libman with different source

All CSS and JS library are managed by libman which is one of the bset option for managing client side libraries. The file can be found in here and look like this- Libman file where default provider is set to cdnjs and can be set to anything like jsdelivr or anything. All file download directory is set and only required files are downloaded, so list of required files are found from the included file in the libman.json file. No custom CSS and no custom JS are applied

Bundling and Minification

Bundling and minification is configured with this file which is very easy to configure and used. More can be found in here. The file is looking like this-

libman easy configuration

which generates a css file named site.min.css and a js file named site.min.js which includes all CSS and js file compliation including all libraries.

In the project, there is stored 1 custom CSS file can be found in here and one custom js fle can be found in here which is also configured with bundler and minifire. No code is added in the 2 file because of providing freedom to the developer who wishesh to use this project and customize it on his demand. AS well this 2 file is added to the bundler so that a developer who forks this repo, can know how to configure his own repo. And finally, version number is appended with the CSS and JS so that CSS and JS caching issue can't happen because after each build, browser will treat every CSS and JS as new one.

Database and Migration with Seed

PostGRE SQL is used because it is most robust open source database having support for both relational DB and text based DB. In this project I am using the DB as a relational DB. The configuration of the database can be done from here so that anyone can configure individual DB for both deployment and development.

Migration

All migration files are configured to be stored in this folder. Useful migration commands can be found from here.

Seed

Seeds are configured in here. After adding a seed, you need to run this command-

Add-Migration <Seed_Migration_Name>
Update-Database

Replace <Seed_Migration_Name> with your seeder-migration name.

Default Superadmin set with seeder is-

  • Username - abrar@jahin.com
  • Password - abrar@jahin.com

Authentication and Authorization

In this project Role based authintication is implemented.

In this project, Role based authontication is implemented and some specific roles are created depending on an enum defined in here. And also Any user can be assigned with any role and a user can have multiple roles. Moreover, the filtering based on different places are applied in following places-

  1. Controller Level can be found in here
  2. Action level can be found in here
  3. Razor page sections can be filtered with role can be found in here
  4. Add multiple roles on a Cntroller/Action/Razor page can be found in here
  5. Username change limit added and set limit to 10 by default
  6. 2FA with Google authinticator is added Custom attributes are defined in here which is used to convert enum to attribute.

Application UI and Screen Shots

All forms has front end and back end validation at a same time.

  1. Landing Page Landing Page
  2. Registration page Login Page Design
  3. Login page Login Page Design
  4. Normal User View Login Page Design
  5. Super-Admin User View Login Page Design
  6. Access Denied page for any unauthorised access Login Page Design
  7. 2FA for user Login Page Design
  8. Profile Page Login Page Design
  9. Role Page Login Page Design
  10. User-Role Management Page Role List by User and Change User Role

and basic operation pages.

Some important partials

  1. Header partial are seperated and can be found in here
  2. Footer partial are seperated and can be found in here
  3. Navbar partial are seperated and can be found in here

About

A perfect role management App using Asp.Net Core for starting a project with complete management module

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages