Create Client

Initialize the EnterestOS client with your project key.

2 minPrerequisites: SDK installed

Problem: The SDK is installed but you do not know how to create a client or where to put the initialization code.

Solution: Call createEnterestOS() once at module level with your project key — reuse it across all forms in the same project.

Basic Setup

typescript
import { createEnterestOS } from '@enterestos/sdk';

const enterestos = createEnterestOS({
  projectKey: 'pk_live_abc123def456'
});
typescript
import { createEnterestOS } from '@enterestos/sdk';

const enterestos = createEnterestOS({
  projectKey: process.env.NEXT_PUBLIC_ENTERESTOS_PROJECT_KEY!
});
bash
# .env.local
NEXT_PUBLIC_ENTERESTOS_PROJECT_KEY=pk_live_abc123def456

Parameters

PropertyTypeRequiredDescription
projectKeystringYesRoutes all submissions to this project

Common Errors

  • Project key is required — you did not pass a projectKey
  • Invalid project key — the key does not match any project in your account

Result: You now have a client ready to call trackResponse() from any form submit handler.

Common Questions

How do I create an EnterestOS client?

Import createEnterestOS, pass your project key, and store the result in a variable. Create it at module level so it is reused across all form submissions in that file.

Is it safe to put the project key in frontend code?

Yes. Project keys are public identifiers. They can only create responses — not read, update, or delete them. They cannot access other projects or your account credentials.