Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
ad303f3
feat(svelte): scaffold package
Chamal1120 Jun 27, 2026
f59bb9e
feat(svelte): add client, models, api wrappers, context keys
Chamal1120 Jun 27, 2026
712c17f
feat(svelte): add reactive auth state with runes
Chamal1120 Jun 27, 2026
b0ed9f0
feat(svelte): add ThunderID provider component
Chamal1120 Jun 27, 2026
44abb6f
feat(svelte): rewrite SDK with full SvelteKit SSR support
Chamal1120 Jun 27, 2026
71cd5c1
feat(svelte): add token refresh, org switch, route guard, type augmen…
Chamal1120 Jun 27, 2026
62fbd59
feat(svelte): add branding support, test suite, and fix cookie name i…
Chamal1120 Jun 27, 2026
5a53413
docs(svelte): add comprehensive README with SSR setup guide
Chamal1120 Jun 27, 2026
8069ca6
docs(svelte): fix README exports to match factory functions
Chamal1120 Jun 27, 2026
7d85f9a
docs(svelte): add sv create scaffold step to SSR guide
Chamal1120 Jun 27, 2026
ddf4152
docs(svelte): fix scaffold command to npx sv create, add apps/ to wor…
Chamal1120 Jun 27, 2026
c7338bd
docs(svelte): fix step 7 — ssrData prop not spread, show layout example
Chamal1120 Jun 27, 2026
a6771a5
fix(svelte): make all server factories accept optional config with en…
Chamal1120 Jun 27, 2026
c2674dd
fix(svelte): complete OAuth sign-in flow with PKCE, SSR hydration, an…
Chamal1120 Jun 28, 2026
8a74114
docs(svelte): remove untested SPA quick-start, keep only SSR docs
Chamal1120 Jun 28, 2026
f02403a
docs(svelte): update README
Chamal1120 Jun 28, 2026
de765bd
docs(svelte): update README
Chamal1120 Jun 28, 2026
a969f2c
fix(svelte): implement critical-tier spec compliance gaps
Chamal1120 Jun 30, 2026
58d55e6
refactor: move SvelteKit test app to samples/apps/sveltekit-b2c per S…
Chamal1120 Jul 16, 2026
d8ce9bb
refactor(sveltekit): rename @thunderid/svelte to @thunderid/sveltekit
Chamal1120 Jul 16, 2026
9f7fd87
Merge remote-tracking branch 'upstream/main' into sv-package-dev
Chamal1120 Jul 16, 2026
819daf6
chore: regenerate lockfile after merge
Chamal1120 Jul 16, 2026
789ad77
docs: add sveltekit to AGENTS.md hierarchy and file layout
Chamal1120 Jul 16, 2026
9229e26
chore: remove temporary working files
Chamal1120 Jul 16, 2026
1dee815
refactor: move sample app to samples/sveltekit to match upstream conv…
Chamal1120 Jul 16, 2026
243c199
fix: remove debug logging from callback handler
Chamal1120 Jul 16, 2026
374d81c
chore: update lockfile after workspace pattern change
Chamal1120 Jul 16, 2026
4ca45b9
refactor: restructure sveltekit sample to match upstream convention (…
Chamal1120 Jul 16, 2026
12e6a81
feat: add thunderid-config to sveltekit sample
Chamal1120 Jul 16, 2026
9b4b427
docs: update README with @thunderid/sveltekit package
Chamal1120 Jul 16, 2026
13d402d
docs: add README for @thunderid/sveltekit
Chamal1120 Jul 16, 2026
e5501db
docs: add quick start guide to sveltekit README
Chamal1120 Jul 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ on:
type: boolean
default: false

sdk_svelte:
description: '@thunderid/svelte'
required: false
type: boolean
default: false

permissions:
contents: write
# IMPORTANT: DO NOT REMOVE. `id-token` is required for OIDC publishing.
Expand Down Expand Up @@ -530,6 +536,63 @@ jobs:
--generate-notes \
"${{ steps.pack.outputs.archive }}"

release-sveltekit:
name: 🧡 Release @thunderid/sveltekit
needs: [validate, release-browser]
if: ${{ always() && needs.validate.result == 'success' && (needs.release-browser.result == 'success' || needs.release-browser.result == 'skipped') && github.event.inputs.sdk_svelte == 'true' }}
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout Code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
token: ${{ secrets.THUNDERID_AUTOMATION_BOT }}

- name: 📦 Set up pnpm
uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4.3.0
with:
version: latest

- name: ⚙️ Set up Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: 'https://registry.npmjs.org'
cache: 'pnpm'

- name: 📦 Install Dependencies
run: pnpm install --frozen-lockfile

- name: 🏷️ Bump Version
id: bump
run: |
cd packages/sveltekit
pnpm version ${{ github.event.inputs.bump_type }} --no-git-tag-version
echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT

- name: 🔨 Build
run: pnpm turbo run build --filter=@thunderid/sveltekit

- name: 📤 Commit, Tag & Push
run: |
git config user.name "${{ env.RELEASE_GIT_USER_NAME }}"
git config user.email "${{ env.RELEASE_GIT_USER_EMAIL }}"
git add packages/sveltekit/package.json
git diff --cached --quiet || git commit -m "[Release] @thunderid/sveltekit@${{ steps.bump.outputs.version }}"
for i in $(seq 1 5); do
git pull --rebase origin ${{ github.ref_name }}
git push origin HEAD:${{ github.ref_name }} && break
[ "$i" -eq 5 ] && exit 1
sleep $((i * 3))
done
git tag "sdk/sveltekit/v${{ steps.bump.outputs.version }}"
git push origin "sdk/sveltekit/v${{ steps.bump.outputs.version }}"

- name: 📦 Publish to npm
run: pnpm publish --no-git-checks --access public --provenance
working-directory: packages/sveltekit
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

# ── Level 3: depends on react / node+react / browser+node+vue ──────────────
release-react-router:
name: 🔀 Release @thunderid/react-router
Expand Down
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -147,5 +147,12 @@ vite.config.ts.timestamp-*
.DS_Store
Thumbs.db

# Test apps
/apps/

# Nx
.nx/cache
.nx/workspace-data

# Turbo
.turbo
2 changes: 2 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ shared utils). Every other package depends on it, directly or transitively:
- `@thunderid/nextjs` → `@thunderid/node` + `@thunderid/react`.
- `@thunderid/nuxt` → `@thunderid/node` + `@thunderid/vue`.
- `@thunderid/express` → `@thunderid/node`.
- `@thunderid/sveltekit` → `@thunderid/browser`.
- `@thunderid/react-router`, `@thunderid/tanstack-router` → `@thunderid/react`.

**Before adding a helper/util/constant to a framework package, check whether it belongs lower in this
Expand Down Expand Up @@ -80,6 +81,7 @@ packages/
nextjs/ Next.js SDK (client + server)
nuxt/ Nuxt module
express/ Express middleware
sveltekit/ SvelteKit SDK (client + server)
react-router/ React Router integration
tanstack-router/ TanStack Router integration
samples/ Standalone quickstart demo apps, one per framework
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ JavaScript SDKs for ThunderID. Provides authentication and user management for b
| [`@thunderid/nextjs`](packages/nextjs) | ![npm](https://img.shields.io/npm/v/@thunderid/nextjs) | Next.js SDK |
| [`@thunderid/react-router`](packages/react-router) | ![npm](https://img.shields.io/npm/v/@thunderid/react-router) | React Router integration |
| [`@thunderid/vue`](packages/vue) | ![npm](https://img.shields.io/npm/v/@thunderid/vue) | Vue SDK |
| [`@thunderid/sveltekit`](packages/sveltekit) | ![npm](https://img.shields.io/npm/v/@thunderid/sveltekit) | SvelteKit SDK |
| [`@thunderid/nuxt`](packages/nuxt) | ![npm](https://img.shields.io/npm/v/@thunderid/nuxt) | Nuxt SDK |
| [`@thunderid/express`](packages/express) | ![npm](https://img.shields.io/npm/v/@thunderid/express) | Express.js SDK |
| [`@thunderid/tanstack-router`](packages/tanstack-router) | ![npm](https://img.shields.io/npm/v/@thunderid/tanstack-router) | TanStack Router integration |
Expand Down
4 changes: 4 additions & 0 deletions packages/sveltekit/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules/
.svelte-kit/
dist/
*.log
83 changes: 83 additions & 0 deletions packages/sveltekit/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
![ThunderID SvelteKit SDK](https://raw.githubusercontent.com/thunder-id/thunderid/refs/heads/main/docs/static/assets/images/readme/repo-banner-sveltekit-sdk.png)

SvelteKit SDK for ThunderID. Provides hooks, components, and server-side utilities for authentication in SvelteKit applications.

## Installation

```bash
npm install @thunderid/sveltekit
```

```bash
pnpm add @thunderid/sveltekit
```

```bash
yarn add @thunderid/sveltekit
```

## Quick Start

### 1. Configure the server hook

```ts
// src/hooks.server.ts
import {createThunderIDHandle} from '@thunderid/sveltekit/server';

export const handle = createThunderIDHandle({
baseUrl: 'https://localhost:8090',
clientId: 'YOUR_CLIENT_ID',
clientSecret: 'YOUR_CLIENT_SECRET',
sessionSecret: 'YOUR_SESSION_SECRET',
});
```

### 2. Load session data on the server

```ts
// src/routes/+layout.server.ts
import {loadThunderID} from '@thunderid/sveltekit/server';
import type {LayoutServerLoad} from './$types';

export const load: LayoutServerLoad = (event) => {
return {thunderid: loadThunderID(event)};
};
```

### 3. Wrap your app with the provider

```svelte
<!-- src/routes/+layout.svelte -->
<script lang="ts">
import {ThunderID} from '@thunderid/sveltekit';
let {children, data} = $props();
let ssrData = $derived(data?.thunderid);
</script>

<ThunderID {ssrData}>
{@render children()}
</ThunderID>
```

### 4. Use components and hooks

```svelte
<!-- src/routes/+page.svelte -->
<script lang="ts">
import {useThunderID, SignedIn, SignedOut, SignInButton, SignOutButton} from '@thunderid/sveltekit';
const tid = useThunderID();
</script>

<SignedIn>
<p>Welcome, {tid.user?.name}!</p>
<SignOutButton />
</SignedIn>

<SignedOut>
<SignInButton />
</SignedOut>
```

## License

This project is licensed under the [Apache License 2.0](https://github.com/thunder-id/thunderid/blob/main/LICENSE).
26 changes: 26 additions & 0 deletions packages/sveltekit/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import thunderIdPlugin from '@thunderid/eslint-plugin';

export default [
{
ignores: ['.svelte-kit/**', 'dist/**', 'build/**', 'node_modules/**', 'coverage/**'],
},
...thunderIdPlugin.configs.typescript,
];
78 changes: 78 additions & 0 deletions packages/sveltekit/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{
"name": "@thunderid/sveltekit",
"version": "0.1.0",
"description": "SvelteKit SDK for ThunderID — Svelte 5 / SvelteKit authentication with CSR and SSR support",
"keywords": [
"thunderid",
"svelte",
"sveltekit",
"auth",
"oauth",
"oidc"
],
"homepage": "https://github.com/thunder-id/javascript-sdks/tree/main/packages/sveltekit#readme",
"bugs": {
"url": "https://github.com/thunder-id/thunderid/issues"
},
"author": "WSO2",
"license": "Apache-2.0",
"type": "module",
"svelte": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"svelte": "./dist/index.js",
"default": "./dist/index.js"
},
"./server": {
"types": "./dist/server/index.d.ts",
"default": "./dist/server/index.js"
}
},
"files": [
"dist",
"README.md",
"LICENSE"
],
"scripts": {
"build": "pnpm clean:dist && svelte-package -i src -o dist",
"clean": "pnpm clean:node_modules && pnpm clean:dist",
"clean:dist": "rimraf dist",
"clean:node_modules": "rimraf node_modules",
"format:check": "prettier --check --cache .",
"format:fix": "prettier --write --cache .",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"test": "vitest --passWithNoTests",
"typecheck": "svelte-check --tsconfig ./tsconfig.lib.json"
},
"devDependencies": {
"@sveltejs/kit": "catalog:",
"@sveltejs/package": "catalog:",
"@sveltejs/vite-plugin-svelte": "catalog:",
"@thunderid/eslint-plugin": "catalog:",
"@thunderid/prettier-config": "catalog:",
"@types/node": "catalog:",
"eslint": "catalog:",
"prettier": "catalog:",
"rimraf": "catalog:",
"svelte": "catalog:",
"svelte-check": "catalog:",
"typescript": "catalog:",
"vitest": "catalog:"
},
"peerDependencies": {
"@sveltejs/kit": ">=2.0.0",
"svelte": ">=5.0.0"
},
"dependencies": {
"@thunderid/browser": "workspace:^",
"@thunderid/node": "workspace:^",
"jose": "catalog:",
"tslib": "catalog:"
},
"publishConfig": {
"access": "public"
}
}
Loading