Browser extension
WXT extension in apps/extension sharing Better Auth and tRPC with the web app.
The browser extension (apps/extension, @zts/extension) is built with WXT. It reuses the web app’s Better Auth session and /api/trpc endpoint.
Develop
- Start the web app from the monorepo root:
pnpm dev - Configure trusted origins in
.env: For production, use the unpacked extension ID fromchrome://extensions(also shown on the extension options page). - Run the extension:
pnpm dev:extension - Load the unpacked build from
apps/extension/.output/chrome-mv3-devin Chrome
Configuration
- Options page: set the web app URL (default
http://127.0.0.1:3000) - tRPC client:
apps/extension/src/lib/trpc-client.ts→{baseUrl}/api/trpc - Auth:
apps/extension/src/lib/extension-auth-client.tsshares cookies on the web origin
Features
- Popup sign-in / sign-up / password reset (same Better Auth API as web and mobile)
- Session via cookies on the web app origin
- Signed-in popup: user summary, billing state, links to app settings
- Background bridge for session sync and opening app tabs
Build
Output: apps/extension/.output/chrome-mv3
Related
- Monorepo
- Better Auth —
BETTER_AUTH_TRUSTED_ORIGINS - Public API — extension uses tRPC, not REST/MCP