Skip to content

Example project using .NET Aspire with a Next.js (React) frontend, an ASP.NET Core backend, and Keycloak for authentication.

License

Notifications You must be signed in to change notification settings

jonathanpotts/AspireNextjsKeycloak

Repository files navigation

AspireNextjsKeycloak

Example project using .NET Aspire with a Next.js (React) frontend, an ASP.NET Core backend, and Keycloak for authentication.

Requirements

This project requires the following:

Running

To run this project, do the following:

  1. In the AspireNextjsKeycloak.Web directory, run: npm install
  2. Start Docker Desktop or Podman if it is not already running
  3. Either:
    • In the AspireNextjsKeycloak.AppHost directory, run: dotnet run -lp https and then open the dashboard using the URL output to the console
    • Open AspireNextjsKeycloak.sln in an IDE (e.g. Visual Studio, Rider) and run the AspireNextjsKeycloak.AppHost project

The default users are:

Username Password
alice alice
bob bob

Projects

AspireNextjsKeycloak.AppHost

An Aspire app host which handles orchestration and hosts the Aspire dashboard.

Uses:

AspireNextjsKeycloak.ApiService

An ASP.NET Core minimal APIs backend which requires authorization from Keycloak.

Uses:

AspireNextjsKeycloak.Web

A Next.js frontend using the App Router and React Server Components that authenticates the user and displays data from the backend.

Uses:

  • OpenTelemetry - Adds observability to the Next.js server (modified to support gRPC endpoints when using the Node.js runtime)
  • NextAuth.js (a.k.a. next-auth) - Handles the auth flows
  • Material UI (a.k.a. MUI) - Provides Material Design 2-based components for React

Notice

Please do not use the realm data from this repository in production as the secrets are exposed to the public.

About

Example project using .NET Aspire with a Next.js (React) frontend, an ASP.NET Core backend, and Keycloak for authentication.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published