Git Product home page Git Product logo

blazorapp1's Introduction

BlazorApp sample

Simple app including everything needed for a enterprise-grade Blazor app that is hosted in an ASP.NET Core app together with a Web API.

The main purpose is to show how to set all this up.

This project started off as a merger of the Blazor Hosted with Individual Auth template and the MudBlazor Hosted templates.

Recently, the project has been restructured into a layered app, adhering to the practices of Domain-driven design (DDD). It implements Command Query Responsibility Segregation (CQRS) with the Mediator pattern.

Contents described further below:

Contents

The app comes with this:

  • MudBlazor component library
  • Web API
    • Open API (w. Swagger)
  • Entity Framework Core
  • Authentication
    • Identity Server (OIDC endpoint)
    • ASP.NET Core Identity (individual accounts)
    • Support for external providers (Google, Azure AD etc.)
  • SignalR
  • Localization
  • CQRS with MediatR
  • .NET Tye - Development orchestrator

There is also a Worker service, using MassTransit with RabbitMQ as transport.

Some other notable features:

  • Multi-tenancy - at Data Access Layer
  • Azure Blob storage integration (Emulated)
  • Smtp4Dev as a test e-mail server.
  • Light/Dark mode

Prerequisites

The project requires these dependencies to be built and to run:

And then an IDE of your preference, such as VS Code, full Visual Studio for Mac or Windows, or Rider.

Run the app

Run this in the solution folder.

$ tye run

This will launch the app and SQL Server running in a container.

To make the services restart on changes:

$ tye run --watch

Tye

Tye is an orchestrator that can be used to develop distributed applications. It orchestrates services - projects and containers, without developers having to think about configuration. Declare dependencies and run. It also handles service discovery.

Services are declared in tye.yaml.

It also makes it easy to deploy services to Kubernetes.

Set up Azurite Storage Emulator

To publicly expose Blobs via their URLs you have to change Azurite's configuration.

(This requires Azurite to have been run once for the files to be created)

Open the file .data/azurite/__azurite_db_blob__.json:

Add the "publicAccess": "blob" key-value in the image container section shown below:

{
    "name": "$CONTAINERS_COLLECTION$",
    "data": [
        {
            "accountName": "devstoreaccount1",
            "name": "images",
            "properties": {
                "etag": "\"0x1C839AE6CDF11F0\"",
                "lastModified": "2021-05-14T15:08:51.726Z",
                "leaseStatus": "unlocked",
                "leaseState": "available",
                "hasImmutabilityPolicy": false,
                "hasLegalHold": false,
           -->  "publicAccess": "blob" <-- 
            },
            // Omitted
},

Then, restart Azurite.

Just restart the whole system. Exit Tye, and restart it.

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.