Code Monkey home page Code Monkey logo

blazorservertemplate's Introduction

BlazorServerTemplate

Features

  • Animated Splash Screen
  • Third-party service to log in (Facebook, Twitter, Google, Microsoft)
  • Email Verification Service
  • Auto-navigate to sign in/log in page if not authenticated from home screen
  • Swagger UI configured for easy API documentation and testing
  • Counter and reactive variable
  • Nested child layouts with conditional output component
  • Sample Model class and controllers (GET, POST, PUT, DELETE) are provided, all organized in appropriate folders and corresponding UI element
  • File upload to blob storage is configured
  • Role-based authorization is provdided with a GUI implementation to manage roles

Setup Instructions

  • Download and install .NET framework. This will also install the .NET Cli.
  • To run the development server enter "dotnet watch" in the terminal. This option is for cross-platform development using VS Code. Alternatively, you can also click the .sln file included to open the project in Visual Studio. This also works for both Mac and Windows but the preferred method for cross-platform development is VS Code with the .NET Cli.

Here are setup instructions for login providers:

  • Google Setup Instructions

    • dotnet user-secrets set "Authentication:Google:ClientId" "client-id"
    • dotnet user-secrets set "Authentication:Google:ClientSecret" "client-secret"
  • Facebook Setup Instructions

    • dotnet user-secrets set "Authentication:Facebook:AppId" "app-id"
    • dotnet user-secrets set "Authentication:Facebook:AppSecret" "app-secret"
  • Microsoft Instructions

    • dotnet user-secrets set "Authentication:Microsoft:ClientId" "client-id"
    • dotnet user-secrets set "Authentication:Microsoft:ClientSecret" "client-secret"
  • Twitter Instructions.

    • dotnet user-secrets set "Authentication:Twitter:ConsumerAPIKey" "consumer-api-key"
    • dotnet user-secrets set "Authentication:Twitter:ConsumerSecret" "consumer-secret"
  • Twilio Sendgrid Instructions.

    • dotnet user-secrets set "SendGridKey" "key"

Project Instructions

  • You will need to rename the project from BlazorServerTemplate to one of your own choosing. You can easily do this by using the built-in tool to refactor all occurances of a symbol. Make sure this also updates the namespaces of all the files as well.
  • You will need to change the splash screen to something else of your choosing.
  • If you do not plan on using the external login providers, please comment them out in Program.cs
  • The custom user class is located in BlazorServerTemplate.Data and is titled BlazorUser. It includes additional fields such as Age and Address, which are both optional. When you register as a new user, you are prompted to enter your age. This is something else that you should customize as per the requirements of your app.
  • To change the registration fields and/or the fields in the account management page, you need to edit Index.cshtml and Index.cshtml.cs in Areas/Identity/Pages/Account/Manage and Register.cshtml and Register.cshtml.cs in Areas/Identity/Pages/Account
  • BlazorServerTemplate.Shared contains the NavMenu.razor file, which is how the sidebar links are rendered.
  • To find the files for the pages themselves, look in the BlazorServerTemplate.Pages folder.
  • You can visit "/swagger" to access swagger for your APIs.
  • "/counter" will show you how to use reactive elements and variables
  • "child-layout-example" will show you how to use child elements and conditionally rendered outlets
    • Page 1 will show you how to use for loops in HTML
    • Page 2 will show you how to fetch data from the database and render it in a table, along with edit and delete functionalities.
    • Page 3 will allow you to POST data to the database.
  • "/upload-to-blob-storage" shows you a demo of how you can upload files to blob storage. Of course, you will need to supply it with your own blob storage connection string.
  • Speaking of which, to change database providers from SqlLite to use SqlServer, just provide the connection string in appsettings.json and uncomment the lines from Program.cs
  • "/manage-roles" shows you how to have role-based authorization. You can create, assign and delete roles from here. "/fetchdata" has an example of this in action.
  • Two factor authentication has been set up. Simply scan the QR code from the account page.
  • Areas/Identity contains the files from scaffolding identity.
  • The Data folder contains the Controllers, Models, Migrations and Services folders as well as the ApplicationDbContext file.
  • Pages are in the "Pages" folder. "Shared" contains the layouts for pages.

Screenshots

Animated Splash Screen

image

Log In Screen

image

Register Screen

image

Dashboard

image

Swagger

Swagger UI

Counter and reactive elements

image

Nested Child Layouts with switching output content. Demo showing for loops in HTML

image

Showing data fetching, in-line editing and deletion

image

Creation of new data

image

Configured page to upload files to blob storage

image

Showing data fetching from a service. Data hidden because role-based authorization is shown

image

Create, manage and delete roles

image

Manage your account. Example showing custom identity class (age property is added)

image

Change your email

image

Change your password

image

App configured to work with external logins. Only API keys are required to be filled in using secret manager

image

Two factor authentication is set up and ready to use with QR code generation also ready

image

Ability to download and delete data

image

blazorservertemplate's People

Contributors

shouryan01 avatar

Stargazers

 avatar

Watchers

 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.