Install with the CLI
App Router
1
Environment variable
.env.local:2
Provider component
app/providers.tsx:3
Wire it into the root layout
app/layout.tsx:The CLI performs all three steps automatically for App Router.
Pages Router
1
Environment variable
.env.local:2
Wrap your app
pages/_app.tsx:Notes
LucentProvidermust be rendered in a client component. For App Router this means theProviderswrapper file needs"use client"at the top — the rest of your layout tree can stay a server component.- Use
NEXT_PUBLIC_prefix so the key is available to the browser. Never store a key that isn’t prefixedluc_pk_in a client‑accessible variable. - The provider should sit at the root of your tree and never remount. If you wrap per‑page it will reset the session on every navigation.