Convert to Single-Page Application (SPA) with MSAL Authentication #60
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR converts the BuildEvents application from a server-side rendered (SSR) web application to a Single-Page Application (SPA) with MSAL (Microsoft Authentication Library) for Azure AD authentication.
Problem Statement
The application architecture needed clarification regarding whether it should be a Single-Page Application or a Web Application, and which authentication pattern to use:
This PR implements the SPA architecture with MSAL React, following Microsoft's recommended pattern for browser-based applications.
Changes Made
1. SPA Mode Configuration
Changed
react-router.config.tsto enable SPA mode:2. MSAL Authentication Integration
@azure/msal-reactand@azure/msal-browserstore/authConfig.ts: MSAL configuration with environment variable supportstore/useuser.tsx: Now usesuseMsal()hook instead of server-side/.auth/meendpointapp/entry.client.tsx: Custom entry point that wraps the app withMsalProvider3. Client-Side Data Fetching
Converted all server-side loaders to client-side data fetching using
useEffect:app/routes/home.tsx- Design configuration loaded on clientapp/routes/app.tsx- Design configuration loaded on clientapp/favicon.tsx- Converted to static component4. Documentation
web/docs/AUTHENTICATION.md: Complete Azure AD setup guideweb/docs/SPA_CONVERSION_SUMMARY.md: Technical implementation detailsweb/.env.example: Environment variable templateweb/README.md: Describes the SPA architectureAuthentication Architecture
Local Development
For localhost development, the application uses a default user automatically:
This allows immediate development without requiring Azure AD configuration.
Production Setup
To enable Azure AD authentication in production:
build/clientdirectoryScreenshots
Home Page (SPA Mode):

App Page (showing default user for localhost):

Benefits
Testing
isSpaMode: trueDocumentation
References
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.