Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
8d6d229
merge dev into docs/sdk-gen
madster456 Jan 11, 2026
ea94999
Ignore generated SDK docs
madster456 Jan 11, 2026
22049d4
Update meta.json for new files/sidebar
madster456 Jan 11, 2026
038444f
Connected account docs update
madster456 Jan 11, 2026
60e5a95
Move Customer.mdx into mixins from types and update for gen
madster456 Jan 11, 2026
cbb4f72
Update for scroll notice on larger TOCs on sdk pages
madster456 Jan 11, 2026
cdf9340
fix broken scrolling on TOCs in sdk pages
madster456 Jan 11, 2026
0d0795b
Update type-doc for generated docs
madster456 Jan 11, 2026
3a10519
Include connected account docs for OAuthConnection
madster456 Jan 11, 2026
966321b
Update scripts for new sdk gen
madster456 Jan 11, 2026
7eaa929
Desc for react hooks
madster456 Jan 11, 2026
9decffe
teams desc added
madster456 Jan 11, 2026
b1888b2
Add missing desc to users index
madster456 Jan 11, 2026
b818277
Code examples for email sdk pages
madster456 Jan 11, 2026
c386513
remove unused code-example refs
madster456 Jan 11, 2026
d9af601
mixin doc types added
madster456 Jan 11, 2026
dff7b7c
hook UI added for sdk generated docs
madster456 Jan 11, 2026
0d067a7
Object UI added - Not used yet, may keep object file hand written as …
madster456 Jan 11, 2026
ab71c40
meat of the SDK generation
madster456 Jan 11, 2026
10d6c6c
trailing space lint
madster456 Jan 11, 2026
cfcb91b
trailing space lint
madster456 Jan 11, 2026
a4c5072
Generate docs/public/sdk-docs if it does not exist
madster456 Jan 11, 2026
1da0396
Merge dev into docs/site/sdkgen
madster456 Feb 11, 2026
7bde36f
Update examples/desc
madster456 Feb 19, 2026
54c4ea2
Merge remote-tracking branch 'origin/dev' into docs/site/sdkgen
madster456 Mar 18, 2026
13952f5
fix anchor
madster456 Mar 18, 2026
143e5c5
Update script and package.json to reflect better naming
madster456 Mar 18, 2026
0666ad4
fix div inside inline code block
madster456 Mar 18, 2026
7683175
safe alphanumeric hash fragments
madster456 Mar 18, 2026
bb536c5
Better error handling
madster456 Mar 18, 2026
aa5a802
Better error handling
madster456 Mar 18, 2026
4ec19b9
More error handling
madster456 Mar 18, 2026
670c790
Remove hardcoded GetUserOptions
madster456 Mar 18, 2026
2d34671
Better logs/error handling
madster456 Mar 18, 2026
844643f
stable key in hooks documentation
madster456 Mar 18, 2026
024c0c8
Fix repo slug, fix anchors, fix SVG and span, remove animations per g…
madster456 Mar 18, 2026
53e2823
Index returns hookinfo | undefined.
madster456 Mar 18, 2026
c55038e
add abort/unmount guards
madster456 Mar 18, 2026
3932f31
Merge branch 'dev' into docs/site/sdkgen
madster456 Mar 19, 2026
69c9037
Merge branch 'dev' into docs/site/sdkgen
madster456 Mar 23, 2026
9391684
Merge branch 'dev' into docs/site/sdkgen
madster456 Apr 3, 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
1 change: 1 addition & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@ next-env.d.ts
/content/api/
/content/dashboard/
/public/openapi/
/public/sdk-docs/
/openapi/

4 changes: 4 additions & 0 deletions docs/code-examples/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { apiKeysExamples } from './api-keys';
import { conceptsExamples } from './concepts';
import { customizationExamples } from './customization';
import { paymentsExamples } from './payments';
import { sdkEmailsExamples } from './sdk-emails';
import { selfHostExamples } from './self-host';
import { setupExamples } from './setup';
import { viteExamples } from './vite-example';
Expand All @@ -12,6 +13,9 @@ const allExamples: Record<string, Record<string, Record<string, CodeExample[]>>>
'apps': {...apiKeysExamples, ...paymentsExamples },
'concepts': conceptsExamples,
'getting-started': viteExamples,
'sdk': {
...sdkEmailsExamples,
},
'others': selfHostExamples,
'customization': customizationExamples,
};
Expand Down
168 changes: 168 additions & 0 deletions docs/code-examples/sdk-emails.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@

export const sdkEmailsExamples = {
'types/email': {
'send-html-email': [
{
language: 'JavaScript',
framework: 'Next.js',
variant: 'client' as const,
code: `// ⚠️ Email sending is not available on the client side
//
// The sendEmail() method requires SECRET_SERVER_KEY and can only
// be used from server-side code (Server Components, API routes, etc.)
//
// To send emails from a client component, create an API route that
// calls stackServerApp.sendEmail() and call it from your client code.

// Example: Call a server API route from client
async function sendEmailFromClient() {
const response = await fetch('/api/send-email', {
method: 'POST',
body: JSON.stringify({
userIds: ['user-1', 'user-2'],
subject: 'Welcome!',
html: '<h1>Welcome!</h1>'
})
});

return response.json();
}`,
highlightLanguage: 'typescript',
filename: 'app/components/send-email-button.tsx'
},
{
language: 'JavaScript',
framework: 'Next.js',
variant: 'server' as const,
code: `import { stackServerApp } from "@/stack";

export default async function SendWelcomeEmail() {
const result = await stackServerApp.sendEmail({
userIds: ['user-1', 'user-2'],
subject: 'Welcome to our platform!',
html: '<h1>Welcome!</h1><p>Thanks for joining us.</p>',
});

if (result.status === 'error') {
console.error('Failed to send email:', result.error);
}

return <div>Email sent!</div>;
}`,
highlightLanguage: 'typescript',
filename: 'app/api/send-email/route.ts'
},
{
language: 'Python',
framework: 'Flask',
code: `import requests

def send_welcome_email():
response = requests.post(
'https://api.stack-auth.com/api/v1/emails/send',
headers={
'x-stack-access-type': 'server',
'x-stack-project-id': stack_project_id,
'x-stack-secret-server-key': stack_secret_server_key,
},
json={
'user_ids': ['user-1', 'user-2'],
'subject': 'Welcome to our platform!',
'html': '<h1>Welcome!</h1><p>Thanks for joining us.</p>',
}
)

return response.json()`,
highlightLanguage: 'python',
filename: 'send_email.py'
}
],
'send-template-email': [
{
language: 'JavaScript',
framework: 'Next.js',
variant: 'client' as const,
code: `// ⚠️ Email sending is not available on the client side
//
// The sendEmail() method requires SECRET_SERVER_KEY and can only
// be used from server-side code (Server Components, API routes, etc.)
//
// To send emails from a client component, create an API route that
// calls stackServerApp.sendEmail() and call it from your client code.

// Example: Call a server API route from client
async function sendTemplateEmailFromClient() {
const response = await fetch('/api/send-template-email', {
method: 'POST',
body: JSON.stringify({
userId: 'user-1',
templateId: 'welcome-template',
variables: { userName: 'John Doe' }
})
});

return response.json();
}`,
highlightLanguage: 'typescript',
filename: 'app/components/send-email-button.tsx'
},
{
language: 'JavaScript',
framework: 'Next.js',
variant: 'server' as const,
code: `import { stackServerApp } from "@/stack";

export default async function SendTemplateEmail() {
const result = await stackServerApp.sendEmail({
userIds: ['user-1'],
templateId: 'welcome-template',
variables: {
userName: 'John Doe',
activationUrl: 'https://app.com/activate/token123'
},
subject: 'Welcome aboard!',
notificationCategoryName: 'product_updates'
});

if (result.status === 'error') {
console.error('Failed to send email:', result.error);
}

return <div>Template email sent!</div>;
}`,
highlightLanguage: 'typescript',
filename: 'app/api/send-template-email/route.ts'
},
{
language: 'Python',
framework: 'Flask',
code: `import requests

def send_template_email():
response = requests.post(
'https://api.stack-auth.com/api/v1/emails/send',
headers={
'x-stack-access-type': 'server',
'x-stack-project-id': stack_project_id,
'x-stack-secret-server-key': stack_secret_server_key,
},
json={
'user_ids': ['user-1'],
'template_id': 'welcome-template',
'variables': {
'userName': 'John Doe',
'activationUrl': 'https://app.com/activate/token123'
},
'subject': 'Welcome aboard!',
'notification_category_name': 'product_updates'
}
)

return response.json()`,
highlightLanguage: 'python',
filename: 'send_template_email.py'
}
]
}
};

6 changes: 5 additions & 1 deletion docs/content/docs/sdk/hooks/use-stack-app.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: useStackApp

The `useStackApp` hook returns a `StackClientApp` object from the one that you provided in the [`StackProvider` component](../../components/stack-provider.mdx). If you want to learn more about the `StackClientApp` object, check out the [StackApp](../objects/stack-app.mdx) documentation.

Example:
## Usage Example

```jsx
import { useStackApp } from "@stackframe/stack";
Expand All @@ -14,3 +14,7 @@ function MyComponent() {
return <div>Sign In URL: {stackApp.urls.signIn}</div>;
}
```

## API Reference

<HookFromJson hookName="useStackApp" />
4 changes: 4 additions & 0 deletions docs/content/docs/sdk/hooks/use-user.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ title: useUser
This standalone React hook is an alias for `useStackApp().useUser()`. It only exists for convenience; it does not have any additional functionality.

For more information, please refer to the [documentation for `stackClientApp.useUser()`](../objects/stack-app.mdx#stackclientappuseuseroptions).

## API Reference

<HookFromJson hookName="useUser" />
19 changes: 18 additions & 1 deletion docs/content/docs/sdk/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const sdkSections = [
]
},
{
title: "Users & user data",
title: "Users & User Data",
items: [
{ name: "CurrentUser", href: "types/user#currentuser", icon: "type" },
{ name: "ServerUser", href: "types/user#serveruser", icon: "type" },
Expand All @@ -26,6 +26,14 @@ export const sdkSections = [
{ name: "ServerContactChannel", href: "types/contact-channel#servercontactchannel", icon: "type" },
]
},
{
title: "Authentication",
items: [
{ name: "OAuthProvider", href: "types/connected-account#oauthprovider", icon: "type" },
{ name: "OAuthConnection", href: "types/connected-account#oauthconnection", icon: "type" },
{ name: "ActiveSession", href: "types/connected-account#activesession", icon: "type" },
]
},
{
title: "Teams",
items: [
Expand All @@ -39,6 +47,15 @@ export const sdkSections = [
{ name: "ServerTeamProfile", href: "types/team-profile#serverteamprofile", icon: "type" },
]
},
{
title: "API Keys",
items: [
{ name: "UserApiKey", href: "types/api-key#userapikey", icon: "type" },
{ name: "UserApiKeyFirstView", href: "types/api-key#userapikeyfirstview", icon: "type" },
{ name: "TeamApiKey", href: "types/api-key#teamapikey", icon: "type" },
{ name: "TeamApiKeyFirstView", href: "types/api-key#teamapikeyfirstview", icon: "type" },
]
},
{
title: "Email",
items: [
Expand Down
12 changes: 8 additions & 4 deletions docs/content/docs/sdk/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,19 @@
"types/user",
"types/team",
"types/team-user",
"types/team-permission",
"types/team-profile",
"types/contact-channel",
"types/email",
"types/team-permission",
"types/api-key",
"types/item",
"types/project",
"types/connected-account",
"types/item",
"types/customer",
"---Mixins---",
"mixins/customer",
"mixins/auth",
"mixins/connection",
"---Shared Types---",
"types/email",
"---Hooks---",
"hooks/use-stack-app",
"hooks/use-user"
Expand Down
11 changes: 11 additions & 0 deletions docs/content/docs/sdk/mixins/auth.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: Auth
full: true
---

The `Auth` mixin provides session and authentication functionality. It is included in `CurrentUser`.

# `Auth`

<TypeFromJson typeName="Auth" />

11 changes: 11 additions & 0 deletions docs/content/docs/sdk/mixins/connection.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: Connection
full: true
---

The `Connection` mixin provides the base interface for OAuth connections. It is included in `OAuthConnection`.

# `Connection`

<TypeFromJson typeName="Connection" />

11 changes: 11 additions & 0 deletions docs/content/docs/sdk/mixins/customer.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: Customer
full: true
---

The `Customer` mixin provides payment and billing functionality. It is included in both `CurrentUser` and `Team` types.

# `Customer`

<TypeFromJson typeName="Customer" />

Loading
Loading