Setup CLI
rabolic is the setup CLI. Run it in your project's folder:
npx rabolic init
It looks at the folder you run it in, then:
- installs the right SDK with your package manager (npm, pnpm, yarn or bun;
flutter pub addfor Flutter); - adds one file that starts the SDK;
- puts the key in your env file;
- sends one test event (
rabolic_cli_check), so you can watch it arrive on the Live page; - prints the one line you add yourself.
It only adds new files and appends to the env file. It never edits your existing code, and it never overwrites a file or an env value that is already there.
npm create rabolic does the same as npx rabolic init.
What it sets up
| Project | Package | File it adds | Env variable |
|---|---|---|---|
| Next.js (App or Pages Router) | @rabolic/web | app/rabolic.tsx (a client component) | NEXT_PUBLIC_RABOLIC_KEY in .env.local |
| Nuxt | @rabolic/web | plugins/rabolic.client.ts | NUXT_PUBLIC_RABOLIC_KEY in .env |
| Vite (React, Vue, Svelte, …) | @rabolic/web | src/rabolic.ts | VITE_RABOLIC_KEY in .env.local |
| Node.js server | @rabolic/node | src/rabolic.ts | RABOLIC_SECRET_KEY in .env |
| Expo | @rabolic/react-native and AsyncStorage, with npx expo install | rabolic.ts | EXPO_PUBLIC_RABOLIC_KEY in .env |
| React Native (bare) | @rabolic/react-native and AsyncStorage | src/rabolic.ts, with the publishable key in it | none |
| Flutter | rabolic_flutter | none: prints the Rabolic.init call for main.dart | none |
Static site (index.html) | none | none: prints the <script> tag | none |
Sites and apps use the project's publishable key (rb_pub_…). A server uses a secret key (rb_live_… or rb_test_…). The CLI refuses the wrong kind. Both are in Integrations → API keys. See Keys.
The line you add yourself
The CLI doesn't edit your code, so it prints one step for you. For example:
- Next.js: render
<Rabolic />from the new file in your root layout, inside<body>. - Nuxt: add
runtimeConfig: { public: { rabolicKey: '' } }tonuxt.config. Nuxt fills it fromNUXT_PUBLIC_RABOLIC_KEY. - Vite: import the new file at the top of your entry file, such as
src/main.ts. - Node.js: import
rabolicfrom the new file where you track server events or purchases. - Expo Router: import the new file at the top of
app/_layout.tsx, and pass the navigation ref torabolic.trackNavigationfor screens. - Flutter: call
Rabolic.initinlib/main.dartbeforerunApp(). - Static site: paste the
<script>tag into<head>on every page.
Options
npx rabolic init [--key <key>] [--host <url>] [--yes] [--dry-run] [--skip-install]
npx rabolic check --key <key> [--host <url>]
| Option | |
|---|---|
--key | The key, instead of pasting it when asked |
--host | Your ingest host, if you proxy it (default https://ingest.rabolic.com) |
--yes, -y | Don't ask before installing and writing files |
--dry-run | Print the plan and the files, change nothing |
--skip-install | Don't run the package manager |
npx rabolic check --key … only sends the test event: a quick way to test a key, a host or a proxy.
What the test event tells you
| The CLI says | It means |
|---|---|
| Rabolic received a test event (rabolic_cli_check). Open Live in your project to see it. | It works. |
| The key was refused. | The key is wrong, unknown or revoked. Copy it again. |
| The test event was dropped (the organization is over its limit). | The organization isn't taking events: the trial ended, there is no plan, or a cap was reached. See Usage and overage. |
| The test event was rejected: … | The event failed a check. The reason is one of the rejection reasons. |
| Couldn't reach … | The host is wrong, or your network or proxy blocks it. |
Keys
Rabolic's publishable keys (rb_pub_) for websites and apps and secret keys (rb_live_, rb_test_) for servers. Where to find them, how to create and revoke them, and their environments.
Trial
Rabolic's 3-day free trial with Growth's features and a 250,000-event cap. It starts with your first accepted event, needs no card, and is one per person.