
talking about this example right here:
const sdk = require('node-appwrite'); // also is this possible to turn into an import module?
const client = new sdk.Client();
const databases = new sdk.Databases(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('xxx') // Your project ID
.setKey('???') // Your secret API key
;
i also have Client.js and i wanna know if this code above is gonna mess with this:
import { Client, Account } from 'appwrite';
export const client = new Client();
client
.setEndpoint(import.meta.env.VITE_REACT_ENDPOINT)
.setProject(import.meta.env.VITE_REACT_PROJ); // Replace with your project ID
export const account = new Account(client);
export { ID } from 'appwrite';
i was thinking of doing something like
import { Client, Account, Databases } from 'appwrite';
export const client = new Client();
client
.setEndpoint(import.meta.env.VITE_REACT_ENDPOINT)
.setProject(import.meta.env.VITE_REACT_PROJ); // Replace with your project ID
export const account = new Account(client);
export const databases = new Databases(client);
export { ID } from 'appwrite';
but i dont really know if thats going to work, anyone could help me?

where do i get my secret api key? (beginner)

In client side you should not set API key

Or this is server side?

idk its in my project

its kinda both things at the same time

but im using an ENV file

This is a react web app?

yessir

Then that's client side

yeah

idk where to actually put stuff

Not needed using server side SDK, use web SDK and don't use any API key

What code?

no api key?

Nope, don't use it

wait then how do i access my database?

Set permissions for such user

Or users

the thing is

the database is a collection of posts

like its not just users

Yes

i wanna access the "posts" database rn

You should set permissions for it
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...
