An example Next.js app using the Settie API. Log in with Settie to chart body weight and training volume over the last 12 weeks.
- OAuth sign-in with PKCE using
@settie/api/auth. - Server-side API requests and encrypted sessions with
iron-session. - A shadcn/ui chart showing weekly training volume and body weight in the user's preferred unit.
The app requests offline_access, measurements.read, sessions.read, and settings.read.
Requires Node.js 22.22.2 or later.
pnpm install
cp .env.example .env.localGenerate a secret with openssl rand -base64 32 and put it in SESSION_SECRET in .env.local. Keep APP_URL set to the exact origin where the app runs. Then start it:
pnpm devOpen http://localhost:3000. The app uses https://api.settie.app by default; set SETTIE_API_URL to another Settie API origin if needed. For deployment, set APP_URL to the public HTTPS origin and use a unique production session secret.
| File | Purpose |
|---|---|
app/page.tsx |
One-page layout and login/logout controls |
components/progress-chart.tsx |
shadcn/ui and Recharts chart |
app/api/auth |
OAuth login, callback, and logout routes |
lib/session.ts |
Encrypted session and token refresh |
app/api/chart/route.ts |
Server-side Settie API requests |
lib/chart-data.ts |
Weekly data aggregation |