You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -96,244 +96,67 @@ PUBLIC_CLERK_SIGN_UP_URL=/sign-up # update this if sign up page exists on anothe
96
96
97
97
### Add integrations
98
98
99
-
- Add the `clerk` integration in your `astro.config.mjs` file.
100
-
- (Optional) Install the `@astrojs/react` and add the `react` in your `astro.config.mjs` file. You only need to perform this action if you are planing to use react with your project or the React features that provided by `astro-clerk-auth`. [Instructions](https://docs.astro.build/en/guides/integrations-guide/react/)
101
-
- Install the `@astrojs/node` package and the `node` adapter in your `astro.config.mjs` file. [Instructions](https://docs.astro.build/en/guides/server-side-rendering/)
102
-
- Set `output` to `server`.
99
+
Follow [the instructions](https://clerk.com/docs/quickstarts/astro) in our documentation.
103
100
104
101
Example configuration file
105
102
106
103
```js
107
104
import { defineConfig } from'astro/config';
108
-
importreactfrom'@astrojs/react';
109
105
importnodefrom'@astrojs/node';
110
106
importclerkfrom'@clerk/astro';
111
107
112
108
exportdefaultdefineConfig({
113
-
integrations: [
114
-
react(),
115
-
clerk({
116
-
afterSignInUrl:'/',
117
-
afterSignUpUrl:'/',
118
-
}),
119
-
],
109
+
integrations: [clerk()],
110
+
adapter:node({ mode:'standalone' }),
120
111
output:'server',
121
-
adapter:node({
122
-
mode:'standalone',
123
-
}),
124
112
});
125
113
```
126
114
127
115
### Add a middleware file
128
116
129
117
This step is required in order to use SSR or any control component. Create a `middleware.ts` file inside the `src/` directory.
- Use `Astro.locals.auth()` to retrieve the [Authentication Object](https://clerk.com/docs/references/nextjs/authentication-object#authentication-object)
251
-
252
-
### Use Clerk react hooks
253
-
254
-
Example SignedIn React component that **supports SSR**
[Clerk Headless mode](https://clerk.com/docs/components/clerk-provider) (see `ClerkJSVariant` prop their docs) is a Clerk variant that is focused towards getting smaller bundle sizes. This variant does _not_ include React or any client side components for Clerk (e.g. their signin component). Because of that the bundle size is drastically smaller. On top of that it also lazy loads the JavaScript client side.
314
-
315
-
In order to use headless mode with this package, change your Astro configuration file to:
316
-
317
-
```diff
318
-
import { defineConfig } from "astro/config";
319
-
import react from "@astrojs/react";
320
-
import node from "@astrojs/node";
321
-
- import clerk from "@clerk/astro";
322
-
+ import clerk from "@clerk/astro/hotload";
323
-
324
-
export default defineConfig({
325
-
integrations: [
326
-
react(),
327
-
clerk({
328
-
+ clerkJSVariant: "headless"
329
-
}),
330
-
],
331
-
output: "server",
332
-
adapter: node({
333
-
mode: "standalone",
334
-
}),
335
-
});
336
-
```
158
+
_For further details and examples, please refer to
0 commit comments