Streaks

alpha!

An API to track and calculate your users' streaks

For apps like habit trackers, fitness trackers, education platforms, etc.

it lets you make something like this:
current streak0
example events
options

Here is an example using the NodeJS SDK (examples using the API directly here):

npm i streaksapi

setup:

import { Streaks } from "streaksapi"; const streaks = new Streaks( <your API Key>, <your project Id> ); const config: StreakConfigDTO = { frequencyType: FrequencyType.Daily, customFrequencyMS: 0, weekStartDay: WeekStartDay.Monday, countSamePeriod: true, };

send events:

const event: CreateStreakEventDto = { projectId: <your projectId>, userId: "user123", streakId: "user123StreakOne", timestampISO: DateTime.now().toISO(), }; await streaks.addEvent(event);

get streak:

const streak = await streaks.getStreak(config, "user123StreakOne");
0.0.10-a