百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
W

web-app-starter

> 前端框架
开源

使用 Azure (MSAL) 进行身份验证的 Web 应用程序的模板 (基于 React 和 .Net Core)

100 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

使用 Azure (MSAL) 进行身份验证的 Web 应用程序的模板 (基于 React 和 .Net Core)

DNE Web App Starter

This starter kit is a boilerplate based on the https://github.com/Azure-Samples/ms-identity-ciam-javascript-tutorial/tree/main/2-Authorization/1-call-api-react. It demonstrates how to build a web application with a React SPA (Single Page Application) client and a .NET 8 backend, leveraging Azure AD and MSAL for authentication. For detailed guidance on configuring Azure AD and MSAL, please refer to the there.

Scenario

  1. The client React SPA uses the to sign-in a user and obtain a JWT ID Token from Azure AD for Customers.
  2. The ID Token proves that the user has successfully authenticated against Azure AD for Customers.

Prerequisites

  • Either Visual Studio or Visual Studio Code and .NET Core SDK
  • Node.js.
  • An Azure AD tenant.

Setup the starter

Setup the Client

For details on setting up and running the client, see the Client documentation

Setup the API

For details on setting up and running the service, see the Service documentation

Create new database migration

bash
dotnet ef migrations add {MigrationName} -s src/Api -p src/Infrastructure -o Data/Migrations

Apply migration to the database

bash
dotnet ef database update -s src/Api -p src/Infrastructure 

Format and lint

bash
dotnet format style
dotnet format analyzers
dotnet csharpier .

Docker

Create a .env file at the root of the project and populate it with the following values to configure your environment:

bash
AZURE_TENANT_ID={your_azure_tenant_id}
AZURE_CLIENT_ID={your_azure_api_application_client_id}
VITE_AZURE_CLIENT_ID={your_azure_spa_application_client_id}
VITE_AZURE_AUTHORITY=https://login.microsoftonline.com/{your_tenant_id}
VITE_TODO_API_ENDPOINT_URL=http://localhost:8080
VITE_TODO_API_SCOPES_READ=["api://{your_azure_api_application_id}/ToDoList.Read"]
VITE_TODO_API_SCOPES_WRITE=["api://{your_azure_api_application_id}/ToDoList.ReadWrite"]
bash
docker compose up

Running the app in a Dev Container

This project supports opening directly in a fully configured development container using Visual Studio Code's Dev Container feature. The provided Docker image comes pre-configured with the .NET SDK and Node.js, setting up a ready-to-run development environment for the application.

  1. Install Prerequisites:

Ensure that you have Visual Studio Code installed along with the Remote - Containers extension. You will also need Docker installed and running on your machine.

  1. Open the Project in VS Code:

Open the project folder in Visual Studio Code. VS Code may prompt you to reopen the project in a container. If it does not, you can manually reopen it in a container by following the next step.

  1. Reopen in Container:

Use the Command Palette (Ctrl+Shift+P or Cmd+Shift+P on Mac) and select 'Remote-Containers: Reopen in Container'. This command will start the process of building the Docker image (if it's not already built) and configuring the container.

  1. Verify Environment:

Once the container is running, open a terminal in VS Code to verify that the .NET SDK and Node.js are installed correctly by running dotnet --version and node --version.

Running the App in Production Using Docker

This project can be deployed and run within a Docker container. First, ensure you have created and configured the .env file as described in the previous documentation sections. This file should contain all necessary environment variables for the application to run correctly in production.

Once the .env file is set up, execute the following command to build and start the Docker container:

bash
docker compose up --build -d

This command performs the following actions:

  • --build: This option ensures that Docker builds the images before starting the containers, which is essential if you have made changes to the Dockerfile or other components of the Docker setup.

  • -d: This runs the containers in detached mode, meaning they run in the background and do not block the terminal.

Ensure Docker is installed and running on your machine before executing the command. This setup allows for a streamlined deployment process, encapsulating the application within a container for consistent performance across different environments.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C#antdazure-adboilerplateclean-architecture

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类前端框架
定价开源

> 相关工具

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架