Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/build-lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 10.18.0
version: 10.18.3

- name: Install Node.js
uses: actions/setup-node@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/bump_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ on:
type: choice
options:
- canary
- stable
- release-candidate
- stable
type:
description: "Type of package to publish"
required: true
Expand Down Expand Up @@ -52,7 +52,7 @@ jobs:
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 10.18.0
version: 10.18.3

- name: Install Node.js
uses: actions/setup-node@v4
Expand Down
32 changes: 16 additions & 16 deletions apps/api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "api",
"version": "1.2.0-canary.56",
"version": "1.2.0-canary.59",
"private": true,
"type": "module",
"scripts": {
Expand All @@ -14,28 +14,28 @@
"lint:fix": "eslint . --fix"
},
"dependencies": {
"@hono/zod-openapi": "^1.1.3",
"@hono/zod-validator": "^0.7.3",
"@hono/zod-openapi": "^1.1.4",
"@hono/zod-validator": "^0.7.4",
"@vitnode/core": "workspace:*",
"drizzle-kit": "^0.31.5",
"drizzle-orm": "^0.44.6",
"hono": "^4.9.9",
"next-intl": "^4.3.9",
"drizzle-kit": "^0.31.6",
"drizzle-orm": "^0.44.7",
"hono": "^4.10.4",
"next-intl": "^4.5.0",
"react": "^19.2.0",
"react-dom": "^19.2.0",
"use-intl": "^4.3.9",
"zod": "^4.1.11"
"use-intl": "^4.5.0",
"zod": "^4.1.12"
},
"devDependencies": {
"@hono/node-server": "^1.19.5",
"@react-email/components": "^0.5.5",
"@types/node": "^24.6.2",
"@types/react": "^19.2.0",
"@types/react-dom": "^19.2.0",
"@hono/node-server": "^1.19.6",
"@react-email/components": "^1.0.0",
"@types/node": "^24.10.0",
"@types/react": "^19.2.2",
"@types/react-dom": "^19.2.2",
"@vitnode/config": "workspace:*",
"dotenv": "^17.2.3",
"eslint": "^9.36.0",
"react-email": "^4.2.12",
"eslint": "^9.39.1",
"react-email": "^5.0.1",
"tsc-alias": "^1.8.16",
"tsx": "^4.20.6",
"typescript": "^5.9.3"
Expand Down
6 changes: 3 additions & 3 deletions apps/docs/content/docs/dev/plugins.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ By creating a plugin, you can extend the functionality like:

## Prerequisites

<Callout title="TurboRepo Only">
To create a plugin, you need to have a TurboRepo setup.
<Callout title="Turborepo Only (Monorepo)" type="info">
To create a plugin, you need to have a Turborepo setup.
</Callout>

## Create a Plugin

import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
import { Tab, Tabs } from "fumadocs-ui/components/tabs";

<Tabs groupId='package-manager' persist items={['bun', 'pnpm', 'npm']} label='Create a Plugin'>

Expand Down
80 changes: 42 additions & 38 deletions apps/docs/content/docs/dev/sso/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import { SSOApiPlugin, getRedirectUri } from "@vitnode/core/api/models/sso";

export const DiscordSSOApiPlugin = ({
clientId,
clientSecret
clientSecret,
}: {
clientId: string;
clientSecret: string;
Expand All @@ -66,7 +66,7 @@ import { SSOApiPlugin, getRedirectUri } from "@vitnode/core/api/models/sso";

export const DiscordSSOApiPlugin = ({
clientId,
clientSecret
clientSecret,
}: {
clientId: string;
clientSecret: string;
Expand Down Expand Up @@ -94,14 +94,14 @@ export const DiscordSSOApiPlugin = ({
// [!code ++]
return url.toString();
// [!code ++]
}
},
};
};
```

<Callout type="warn">
Always include the `state` parameter - it's your security guard against CSRF attacks. Don't worry,
VitNode handles this automatically!
Always include the `state` parameter - it's your security guard against CSRF
attacks. Don't worry, VitNode handles this automatically!
</Callout>

</Step>
Expand All @@ -120,12 +120,12 @@ import { z } from "zod";

const tokenSchema = z.object({
access_token: z.string(),
token_type: z.string()
token_type: z.string(),
});

export const DiscordSSOApiPlugin = ({
clientId,
clientSecret
clientSecret,
}: {
clientId: string;
clientSecret: string;
Expand All @@ -137,7 +137,7 @@ export const DiscordSSOApiPlugin = ({
id,
name: "Discord",
// [!code ++]
fetchToken: async (code) => {
fetchToken: async code => {
// [!code ++]
const res = await fetch("https://discord.com/api/oauth2/token", {
// [!code ++]
Expand All @@ -147,7 +147,7 @@ export const DiscordSSOApiPlugin = ({
// [!code ++]
"Content-Type": "application/x-www-form-urlencoded",
// [!code ++]
Accept: "application/json"
Accept: "application/json",
// [!code ++]
},
// [!code ++]
Expand All @@ -161,9 +161,9 @@ export const DiscordSSOApiPlugin = ({
// [!code ++]
client_id: clientId,
// [!code ++]
client_secret: clientSecret
client_secret: clientSecret,
// [!code ++]
})
}),
// [!code ++]
});

Expand All @@ -176,9 +176,9 @@ export const DiscordSSOApiPlugin = ({
// [!code ++]
{
// [!code ++]
message: "Internal error requesting token"
message: "Internal error requesting token",
// [!code ++]
}
},
// [!code ++]
);
// [!code ++]
Expand All @@ -187,11 +187,11 @@ export const DiscordSSOApiPlugin = ({
// [!code ++]
const { data, error } = tokenSchema.safeParse(await res.json());
// [!code ++]
if (error || !data) {
if (error ?? !data) {
// [!code ++]
throw new HTTPException(400, {
// [!code ++]
message: "Invalid token response"
message: "Invalid token response",
// [!code ++]
});
// [!code ++]
Expand All @@ -210,7 +210,7 @@ export const DiscordSSOApiPlugin = ({
url.searchParams.set("state", state);

return url.toString();
}
},
};
};
```
Expand All @@ -232,12 +232,12 @@ import { z } from "zod";
const userSchema = z.object({
id: z.number(),
email: z.string(),
username: z.string()
username: z.string(),
});

export const DiscordSSOApiPlugin = ({
clientId,
clientSecret
clientSecret,
}: {
clientId: string;
clientSecret: string;
Expand All @@ -255,20 +255,20 @@ export const DiscordSSOApiPlugin = ({
// [!code ++]
headers: {
// [!code ++]
Authorization: `${token_type} ${access_token}`
Authorization: `${token_type} ${access_token}`,
// [!code ++]
}
},
// [!code ++]
});

// [!code ++]
const { data, error } = userSchema.safeParse(await res.json());
// [!code ++]
if (error || !data) {
if (error ?? !data) {
// [!code ++]
throw new HTTPException(400, {
// [!code ++]
message: "Invalid user response"
message: "Invalid user response",
// [!code ++]
});
// [!code ++]
Expand All @@ -278,32 +278,35 @@ export const DiscordSSOApiPlugin = ({
return data;
// [!code ++]
},
fetchToken: async (code) => {
fetchToken: async code => {
const res = await fetch("https://discord.com/api/oauth2/token", {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
Accept: "application/json"
Accept: "application/json",
},
body: new URLSearchParams({
code,
redirect_uri: redirectUri,
grant_type: "authorization_code",
client_id: clientId,
client_secret: clientSecret
})
client_secret: clientSecret,
}),
});

if (!res.ok) {
throw new HTTPException(+res.status.toString() as ContentfulStatusCode, {
message: "Internal error requesting token"
});
throw new HTTPException(
+res.status.toString() as ContentfulStatusCode,
{
message: "Internal error requesting token",
},
);
}

const { data, error } = tokenSchema.safeParse(await res.json());
if (error || !data) {
if (error ?? !data) {
throw new HTTPException(400, {
message: "Invalid token response"
message: "Invalid token response",
});
}

Expand All @@ -318,14 +321,15 @@ export const DiscordSSOApiPlugin = ({
url.searchParams.set("state", state);

return url.toString();
}
},
};
};
```

<Callout type="warn">
Pro tip: Some OAuth providers might return unverified email addresses. If your provider gives you
an email verification status, add it to your validation to keep things secure!
Pro tip: Some OAuth providers might return unverified email addresses. If your
provider gives you an email verification status, add it to your validation to
keep things secure!
</Callout>

</Step>
Expand Down Expand Up @@ -354,11 +358,11 @@ VitNodeAPI({
// [!code ++]
clientId: process.env.DISCORD_CLIENT_ID,
// [!code ++]
clientSecret: process.env.DISCORD_CLIENT_SECRET
clientSecret: process.env.DISCORD_CLIENT_SECRET,
// [!code ++]
})
}),
// [!code ++]
]
}
],
},
});
```
4 changes: 2 additions & 2 deletions apps/docs/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '3.8'
version: "3.8"

services:
database:
Expand All @@ -12,7 +12,7 @@ services:
volumes:
- ../../docker/dev:/var/lib/postgresql/data
ports:
- '5432:5432'
- "5432:5432"
networks:
- vitnode_dev

Expand Down
7 changes: 1 addition & 6 deletions apps/docs/next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ const withBundleAnalyzer = nextAnalyzer({
enabled: process.env.ANALYZE === "true",
});

const nextConfig: NextConfig = {
experimental: {
inlineCss: true,
ppr: "incremental",
},
};
const nextConfig: NextConfig = {};

export default withBundleAnalyzer(withMDX(vitNodeNextConfig(nextConfig)));
Loading