Custom UI: Integration with popular vite powered UI libraries - #346
Open
vitorfigmgs wants to merge 10 commits into
Open
Custom UI: Integration with popular vite powered UI libraries#346vitorfigmgs wants to merge 10 commits into
vitorfigmgs wants to merge 10 commits into
Conversation
…ct client hydration
vitorfigmgs
marked this pull request as draft
July 30, 2026 20:27
This was referenced Jul 30, 2026
vitorfigmgs
marked this pull request as ready for review
July 31, 2026 19:11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Related Pull requests
Overview
This PR introduces a Vite-powered meta-framework that enables fully customizable UIs for the password provider pages (It can easily be extended to support other providers later). It allows you to use any modern UI framework (initially React) with with full HMR support and SSR with just a few lines of configuration.
How to Use It
1. Configuration
Create an
openauth.config.tsfile to define your plugins and integrations:2. Setup the Provider
Use
CustomPasswordUIinside your issuer configuration:3. Define Pages & Entrypoints
src/pages/): Create components to render each route (e.g.,src/pages/login.tsx).main.tsx: Required client-only entrypoint for browser hydration.layout.tsx: Server-only Hono component used to build the HTML shell (head and meta tags).4. Data Loading (Optional)
You can use
loaderfunctions to run server-side logic (like database fetching) and pass data to your page components or customize response headers:5. OpenAuth CLI
Use the CLI from the
@openauthjs/vitepackage to manage your project:Run the dev server:
Build for production:
6. Deploy to Production
Use the
sst.aws.Authcomponent alongside these CLI commands to deploy your auth server to an AWS Lambda function, or to run dev mode integrated with your other SST components.How it works
@openauthjs/vite: The main package for this feature. It compiles server/client code (making a heavy usage of vite virtual modules plugins) to provide an SSR and dev mode HMR experience experience similar to Next.js or TanStack Start.CustomPasswordUI: Implements the Password provider interface. It renders the Hono layout shell and triggers the specific Renderer for the active route.How to Test
To test these changes, please use the companion SST example PR
Related Issues
Small change in the packages/openauth/src/provider/oauth2.ts
To reference the
virtual.d.tstype in@openauthjs/openauthwithout type errors, I updated the TypeScript config with:"lib": ["ESNext"]"types": ["node"]"rootDir": "./src"This resolved the underlying issue from
provider/oauth2.ts, so I had to remove remove the @ts-ignore from this file.