
Heyo,
The web-sdk is client based, I think. Is there an sdk that supports server components?

node-appwrite

If I try to use this, i get: ⨯ ./node_modules/node-appwrite/lib/client.js:1:11 Module not found: Can't resolve 'os'

It seems to be the only way is to use the Rest API? I don't find any info about using it in server components, and installing fs etc. won't work.

honestly, i would advise against using all the server-side related stuff, especially because you're going to run into problems with authentication and sessions.
You may be able to use the web SDK, but you would need to manually manage the session.
Module not found: Can't resolve 'os'
Ya....NextJS has multiple runtimes so the code may not actually be running in a node runtime 😑

Hey, I understand with authentication etc. But what about getting documents? Or would you rather use api routes for this?

I would try to avoid connecting to Appwrite server-side. I would only fetch the documents client-side.

I do have one more question, is there a proper example on how to use authentication and get a cookie instead of local storage?

Every time i login, I get it as local storage, however sometimes it seems to make a cookie, but rarely.

(using the example btw)

The cookie is should always be set (when the session is created client side). Maybe if you weren't using HTTPS or if there's some other SSL issue between the client and Appwrite.

Alright, thanks.

[SOLVED] Can I use appwrite sdk using nextjs server components?
Recommended threads
- Need help setting up this error is showi...
You can't sign in to this app because it doesn't comply with Google's OAuth 2.0 policy. If you're the app developer, register the redirect URI in the Google Cl...
- Appwrite stopped working, I can't authen...
I'm having an issue with Appwrite. It was working fine just a while ago, but suddenly it stopped working for me and can't authenticate accounts. I even went bac...
- Fail to receive the verification email a...
I added my email address to prevent it from showing "appwrite," but now I'm not receiving emails for verification or password resets. The function appears to be...
