Getting Started

Quickstart

From sign-in to first log. Create your project, get an API key, and send a structured event.

1. Install the SDK

Requires Node.js >=18. No runtime dependencies.

bash
npm install @delok/sdk

2. Log in to Delok

Sign in with your Google or GitHub account at /sign-in. After authentication you will be redirected to your organizations.

3. Open your organization

Delok organizes work by organization. Select an existing organization from /orgs or create a new one. All projects belong to an organization.

4. Create a project

Inside your organization, go to Projects and create a new project. Each project isolates its own logs and API keys.

Clear project names recommended. For example api-production or web-production. You can create multiple projects per organization.

5. Generate an API key

Open your project, go to Settings → API Keys and generate a new key. Copy it immediately, it will be shown only once.

Store the key in an environment variable, for example DELOK_API_KEY. Never commit it to git or expose it to the browser.

6. Initialize Delok

Connect the SDK to your project by initializing it with the API key and environment.

typescript
import { Delok } from "@delok/sdk";

const delok = new Delok({
  apiKey: process.env.DELOK_API_KEY,
  environment: "development", // "development" | "staging" | "production"
});

Supported environment values are development, staging, and production.

7. Send your first log

typescript
delok.info({
  event: "user_login",
  message: "User successfully logged in",
});

event is required. message is optional. The method returns void (fire-and-forget) on validation, network, timeout, or HTTP errors.

8. Add structured data

typescript
delok.info({
  event: "user_created",
  message: "New user created",
  payload: {
    userId: "123",
    plan: "pro",
  },
});

payload is optional structured JSON. You can filter the stored logs by the level, environment, occurredAt, or search it through the message or payload in the dashboard.

Next steps

Your log is now visible in the project's log view. Try varying the level with warn(), error(), and fatal().

Continue with Logging