Server API
Connect Next.js to Streakfox
Send the action from the server once it succeeds, and render the streak wherever your members look.

Next.jsLesson finished ✓
7day streakThe fox is proud.
M✓
T✓
W✓
T✓
F✓
S✓
S✓
What can keep the streak alive
Pick one action per program. Daily streaks count the first action each day; running totals count distinct completions.
- Lesson finished
- Workout logged
- Onboarding step completed
- Any server action
Set it up in 5 steps
- Create a program and copy its incoming URL from setup.
- Store it as the server-only STREAKFOX_INCOMING_URL environment variable.
- POST member and completion_id to that URL after the action succeeds in a route handler or server action.
- Embed the widget for signed-in members, using the same member value as data-member and your program's action as data-event.
- Run a test action and check processed progress before going live.
// Copy your program's incoming URL from Streakfox setup.
// Keep it in a server-only environment variable.
const response = await fetch(process.env.STREAKFOX_INCOMING_URL!, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
member: member.id,
completion_id: `lesson_complete:${completion.id}`,
}),
});
if (!response.ok) throw new Error(await response.text());Questions
Can I count events from a server action?
Yes. POST member and completion_id to your program's incoming URL from server-side code after confirming the action succeeded.
Works well with
If it can send a webhook, it can keep a streak.
Start a program, send one test action and watch the flame light up.
Start free