localStorage, EIP-1193 events) so the integration centers around getting the 'use client' boundary right. A short Pages Router note is at the bottom.
Install
Requires React 18 or 19 and Next.js 13.4+ (App Router).
1. Create the Aurum instance
lib/aurum.ts
Use
NEXT_PUBLIC_* env vars — both project IDs are needed in the browser. Never put a server-only secret here.Aurum constructor is SSR-safe — it guards window / localStorage access internally — so importing this module from a Server Component will not throw. But the modal, hooks, and event listeners only run in the browser, so any component that uses Aurum must be a Client Component.
2. Create a client-side provider
TheAurumProvider itself is a client boundary, so it lives in its own 'use client' file.
app/providers.tsx
3. Wrap the root layout
app/layout.tsx
layout.tsx itself stays a Server Component — only the Providers wrapper crosses into the client.
4. Build a connect button
Any component that calls Aurum hooks needs'use client'.
app/components/ConnectButton.tsx
<ConnectButton /> into any Server Component page; the 'use client' boundary stays inside the component tree without infecting the rest of the page.
app/page.tsx
5. Sign a message
app/components/SignMessageButton.tsx
Server-side caveats
A few things that don’t work the way you might expect:- Server Components cannot use Aurum hooks. Wallet state lives in the browser. Read it from a Client Component and pass it down via context or props.
- Middleware and Route Handlers cannot read wallet state. They run on the server, where there is no wallet connection. If you need server-side auth, sign a SIWE message client-side and verify it in a Route Handler.
- Don’t dynamic-import Aurum with
ssr: falseunless you’re seeing a real hydration warning. The SDK is SSR-safe out of the box andssr: falsewould defeat the persisted-connection restore on first paint. - Don’t construct multiple
Auruminstances per route. The constructor returns the existing instance and warns if the new config differs. Keep onelib/aurum.tsimport everywhere.
Pages Router
The Pages Router setup is the same idea — wrap<Component /> in _app.tsx:
pages/_app.tsx
'use client' directives in the Pages Router — every component is rendered on the client by default.
Next steps
Customization
Theme the modal
Headless mode
Build a fully custom UI
React Hooks
Hooks API reference