Documentation

Streakline is a REST API with thin SDKs and an agent-native setup flow. Send events, and scoring, levels, streaks, achievements, and leaderboards update for you. Most teams are live the same day.

Preview. The CLI, MCP server, and Agent Skills are early. The REST API and the TypeScript & Swift SDKs are the stable surfaces today.

Quickstart

Install the server SDK, point it at your workspace with a secret key, and track your first event.

terminalbash
bun add @streakline/sdk   # or: npm install @streakline/sdk
server.tstypescript
import { StreaklineClient } from "@streakline/sdk";

const bl = new StreaklineClient({ secretKey: process.env.STREAKLINE_SECRET_KEY! });

// Track an event. Scoring, levels, and streaks update automatically.
await bl.track("user_123", "lesson.completed", {
  metadata: { courseId: "intro" },
});

// Read the user's gamification profile.
const profile = await bl.getProfile("user_123");
// → { score, level, currentStreak, ... }

Authentication

Every request carries a Bearer key. There are two kinds, and the difference matters:

  • pk_ public keys are safe to embed in client apps (mobile, browser). They can write events and read public data.
  • sk_ secret keys are server-only and must never ship to a client. They have full workspace access.
headerhttp
Authorization: Bearer pk_live_xxx     # client SDKs
Authorization: Bearer sk_live_xxx     # server SDK

Core concepts

The model is five primitives — events, points & levels, streaks, achievements, leaderboards — wired into one feedback loop. Scoring is governed by a versioned config so you can change your economy safely. See how it works for the full picture.

CLI

The CLI inspects your repository and drafts a scoring model mapped to your real product journeys, then deploys it as a versioned config.

terminalbash
npx streakline init       # inspect repo → draft streakline.config.ts
npx streakline preview    # dry-run scoring against sample events
npx streakline deploy     # publish the active scoring version

MCP server

Add the MCP server to your agent and it can read your config, propose scoring changes, and deploy versions over Model Context Protocol — no context-switching to a dashboard.

.mcp.jsonjson
{
  "mcpServers": {
    "streakline": {
      "command": "npx",
      "args": ["-y", "@streakline/mcp"],
      "env": { "STREAKLINE_SECRET_KEY": "sk_live_xxx" }
    }
  }
}

Agent Skills

Drop-in skills give Claude and other coding agents the recipes to wire gamification end-to-end — from mapping events to rendering the SDK in your UI. Point the agent at your repo and let it work.

TypeScript SDK

The server SDK wraps the REST API with full types. Use it anywhere you hold an sk_ key.

server.tstypescript
const bl = new StreaklineClient({ secretKey: process.env.STREAKLINE_SECRET_KEY! });

await bl.track("user_123", "purchase.made", { idempotencyKey: "ord_991" });

const profile = await bl.getProfile("user_123");
const board   = await bl.getLeaderboard("weekly", { limit: 20 });
const badges  = await bl.getAchievements("user_123");

Swift / iOS SDK

The iOS SDK is configured once with a public key, then identifies the current user. Add it via Swift Package Manager.

App.swiftswift
import Streakline

StreaklineSDK.shared.configure(apiKey: "pk_live_xxx")
StreaklineSDK.shared.identify(userId: "user_123")

let result  = try await StreaklineSDK.shared.track(event: "lesson.completed")
let profile = try await StreaklineSDK.shared.profile()
let board   = try await StreaklineSDK.shared.leaderboard(type: .weekly)

REST

Every SDK is a thin wrapper over the same REST API. Call it directly from any language.

terminalbash
curl -X POST https://api.streakline.dev/api/v1/events \
  -H "Authorization: Bearer pk_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{"user_id":"user_123","event_type":"lesson.completed","source":"web"}'

API endpoints

The full v1 surface. All routes require a Bearer key; write routes accept an optional idempotency_key.

POST /api/v1/events Track an event
GET /api/v1/users/:id/profile Score, level, streak
GET /api/v1/users/:id/achievements Unlocked achievements
GET /api/v1/users/:id/events Recent events (paginated)
GET /api/v1/leaderboards/:type daily · weekly · monthly · all_time
GET /api/v1/challenges Active challenges
GET /api/v1/challenges/:userId A user's challenge progress

Open the full interactive reference ↗

Tech stack

Streakline is a Bun monorepo: the hosted API plus its data layer, with the SDKs and marketing site alongside.

Runtime
Bun
API
Hono
Database
PostgreSQL + Drizzle ORM
Cache / realtime
Redis
Auth
Better Auth + API keys (pk_/sk_)
Billing
Stripe
Web
Astro + React
SDKs
TypeScript · Swift · Kotlin
Monorepo
Turborepo + Bun workspaces
API docs
OpenAPI + Scalar