Vercel Deployment
Vercel can be used to deploy the AuthHero React Admin interface. Note: Currently, only the React Admin application is supported for Vercel deployment, not the core authentication server.
Quick Deploy
The easiest way to deploy React Admin to Vercel is using the deploy button:
Or deploy to Cloudflare Pages:
Cloudflare Pages Setup
During setup:
- Select Pages as the deployment type
- Set Root directory to
apps/react-admin - Set Build command to
pnpm run build - Set Build output directory to
dist - Add environment variables:
VITE_AUTH0_DOMAIN- Your AuthHero domainVITE_AUTH0_CLIENT_ID- Client ID (usuallyauth-admin)VITE_AUTH0_API_URL- Your AuthHero API URLVITE_SINGLE_DOMAIN_MODE- Set totrueto skip domain selector :::
This will:
- Clone the repository to your GitHub account
- Set up the project with the correct root directory (
apps/react-admin) - Configure the build commands with proper pnpm compatibility
- Prompt you for the required environment variables
React Admin Deployment
The React Admin interface is a Vite-based single-page application that can be deployed to Vercel.
Prerequisites
- A Vercel account
- A GitHub, GitLab, or Bitbucket repository containing your AuthHero fork
Deployment Steps
Connect Repository to Vercel
- Go to Vercel Dashboard
- Click "Add New Project"
- Import your repository
Configure Project Settings
- Set the Root Directory to:
apps/react-admin - Set the Framework Preset to:
Vite - The Build Command should auto-detect as:
pnpm run build - The Output Directory should auto-detect as:
dist
- Set the Root Directory to:
Set Environment Variables
Required environment variables in Vercel:
bash# Enable corepack for pnpm compatibility ENABLE_EXPERIMENTAL_COREPACK=1 # AuthHero configuration VITE_AUTH0_DOMAIN=your-authhero-domain.com VITE_AUTH0_CLIENT_ID=auth-admin VITE_AUTH0_API_URL=https://your-authhero-api.com # Optional: Skip domain selector and use configured domain directly VITE_SINGLE_DOMAIN_MODE=trueImportant
You must set
ENABLE_EXPERIMENTAL_COREPACK=1as an environment variable in Vercel to avoid build errors with pnpm 10.x and Node.js 22.
Single Domain Mode
Set VITE_SINGLE_DOMAIN_MODE=true to skip the domain selector entirely and use the configured VITE_AUTH0_DOMAIN automatically. This is recommended for deployments that only need to connect to a single AuthHero instance.
- Deploy
- Click "Deploy"
- Vercel will automatically build and deploy your application
Configuration Files
The project includes a vercel.json file with the necessary configuration:
{
"rewrites": [
{
"source": "/(.*)manifest.json",
"destination": "/manifest.json"
},
{
"source": "/favicon.ico",
"destination": "/favicon.ico"
},
{
"source": "/(.*)",
"destination": "/index.html"
}
],
"installCommand": "corepack enable && corepack prepare pnpm@10.11.0 --activate && pnpm install --no-frozen-lockfile"
}Troubleshooting
Build Fails with ERR_INVALID_THIS
If you see errors like:
ERR_PNPM_META_FETCH_FAIL GET https://registry.npmjs.org/...
Value of "this" must be of type URLSearchParamsSolution: Add the ENABLE_EXPERIMENTAL_COREPACK=1 environment variable in your Vercel project settings under Settings → Environment Variables.
This error occurs due to a compatibility issue between certain pnpm versions and Vercel's build environment. Enabling experimental corepack resolves the issue.
Domain Selection
The React Admin app supports multiple domains through a domain selector UI. Users can:
- Add domains via the UI
- Store domain configurations in browser cookies
- Switch between different AuthHero instances
If you set VITE_AUTH0_DOMAIN and related variables, that domain will be pre-configured as the default.
Custom Domain
To add a custom domain:
- Go to your Vercel project settings
- Navigate to Domains
- Add your custom domain
- Follow Vercel's DNS configuration instructions
Automatic Deployments
Vercel automatically deploys:
- Production deployments from your main/master branch
- Preview deployments from pull requests and other branches
Limitations
- Only React Admin can be deployed to Vercel with this setup
- The core AuthHero authentication server requires a different deployment target (Cloudflare Workers, AWS, or VPS)
- React Admin needs to connect to an AuthHero API server deployed elsewhere
Alternative: Full Stack on Vercel
While the current setup only supports React Admin, you could potentially deploy the full AuthHero stack to Vercel using:
- Vercel Serverless Functions for the API
- Vercel Postgres or Vercel KV for storage
This would require creating a custom Vercel adapter for AuthHero, which is not currently available.
Next Steps
- Review React Admin documentation for app-specific configuration
- Set up your AuthHero API server on a supported platform
- Configure authentication between React Admin and your API server