CriffisOriginal post
Web Developer
Hi there, I asked a similar question before, sorry in advance. I'm now implementing this self-hosted (will use cloud as soon as 1.5 is released).
How do I initialize an SDK in SSR if I want to use GraphQL?
https://appwrite.io/docs/tutorials/nextjs-ssr-auth/step-3
How do I hook onto that createSessionClient to query/mutate?
The GraphQL docs section only shows
const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your Appwrite Endpoint
.setProject('<PROJECT_ID>'); // Your project ID
const graphql = new Graphql(client);
But that's for Client SDK. I need to hook on to the Account(client) account session somehow, right?
Summary
Developers want to initialize the Appwrite SDK in SSR to use GraphQL. They need to hook onto `createSessionClient` to query/mutate, which isn't clear in the documentation. To achieve this, developers should use the following code to initialize the SDK:
```
const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your Appwrite Endpoint
.setProject('<PROJECT_ID>'); // Your project ID
const account = new Account(client);
const graphql = new Graphql(client);
```
By adding `const account = new Account(client);`, developers can hook onto the