@wacht/nextjs
v1.0.0-beta.3
Published
Next.js adapter for Wacht authentication library
Maintainers
Readme
Install
pnpm add @wacht/nextjs @wacht/jsx @wacht/typesEnvironment
NEXT_PUBLIC_WACHT_PUBLISHABLE_KEY=pk_test_xxx
WACHT_API_KEY=wk_live_xxxApp usage
import { DeploymentProvider } from "@wacht/nextjs";
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html>
<body>
<DeploymentProvider publicKey={process.env.NEXT_PUBLIC_WACHT_PUBLISHABLE_KEY!}>
{children}
</DeploymentProvider>
</body>
</html>
);
}Server usage
@wacht/nextjs/server exports:
- Middleware/auth:
wachtMiddleware,createRouteMatcher,auth,getAuth,requireAuth - Client access:
wachtClient,createWachtServerClient - Types: auth payload/protect option types and related auth models
Notes
frontendApiUrlshould be derived from the publishable key flow.- Middleware and server helpers are designed for framework-level request handling.
Build
pnpm buildLicense
Apache License 2.0. See LICENSE.md.
