Skip to main content
Scaffold + manual step. The CLI writes a client plugin that reads config.public.lucentPublicKey from Nuxt runtime config, but it cannot safely modify nuxt.config.ts for you. Add the runtimeConfig.public entry after the CLI finishes.

Install with the CLI

Pick Nuxt when prompted.

Manual setup

1

Environment variable

.env:
2

Expose the key via runtimeConfig (manual)

nuxt.config.ts:
Nuxt reads NUXT_PUBLIC_LUCENT_PUBLIC_KEY from your environment and overrides the empty default at runtime. You don’t need to hardcode the key here.
3

Client plugin

plugins/lucent.client.ts:

Notes

  • Files ending in .client.ts inside plugins/ only run in the browser, which is exactly what you want for a session recorder.
  • The .client plugin auto‑loads — you don’t need to register it anywhere.
  • Access the tracker from any component with const { $lucent } = useNuxtApp().