Skip to main content

Overview

The Timeback SDK provides a SvelteKit adapter using hooks.

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:
src/lib/server/timeback.ts

Server Hooks

Add the Timeback handler to your hooks:
src/hooks.server.ts

Alternative: Route-Based Handler

For more control, you can use a route-based approach instead of hooks:
src/routes/api/timeback/[...path]/+server.ts

Client Setup

Initialize Timeback in your root layout:
src/routes/+layout.svelte

Usage

For the full client-side API, see the Svelte client adapter.
Use stores in components:
src/routes/+page.svelte

Profile Store

Next Steps

Svelte Client

Client-side Svelte integration

Identity

Authentication options

Custom Activities

Track learning sessions