Skip to main content

Overview

The Timeback SDK provides a Next.js adapter for the App Router with route handlers. If you are using coding agents, pair this page with timeback-server from the AI Skills catalog.

Installation

Server Setup

Create a server-only Timeback instance. The session helpers below belong to your application: persist the callback user in your authenticated session, and return that session user (including email) or null from getUser. These helpers are not SDK exports. Keep API and SSO secrets on the server:
lib/timeback.ts

Route Handler

Create a catch-all route handler:
app/api/timeback/[...timeback]/route.ts
This handles all Timeback routes:

Client Provider

Wrap your app with the TimebackProvider:
app/providers.tsx
app/layout.tsx

Usage

For the full client-side API, see the React client adapter.
Use hooks in client components:
components/UserStatus.tsx

Next Steps

React Client

Client-side React integration

Identity

Authentication options

Custom Activities

Track learning sessions