-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/db with Appwrite #36
base: main
Are you sure you want to change the base?
Conversation
### Wtih Docker | ||
|
||
**If you have docker, you can host a local version of appwrite to faclilty development. To get set up clone the repo and follow the next steps** | ||
|
||
1. Copy .env.example and create a .env file. | ||
2. Run `make appwrite` to initilize the appwrite containers. This will prompt you with some setup options. all defaults should be fine | ||
3. Head to http://localhost and create a local appwrite account and a project | ||
4. Create an api key in the project. to do this I went to settings -> view api keys -> add api key. It's recommended to provide it complete access locally. | ||
5. Open the .env file (listed in step 1) and fill in the top variables with your projects information. (Locally you can leave APPWRITE_URL as it is. It's using a docker network to directly connect the server to appwrite) | ||
6. Run `make up logs migrate`. This will do the following: | ||
- start your server | ||
- show you the logs for your server | ||
- run the migration file to initilize your project | ||
|
||
Congrats! you're up and running |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instructions for how to start the project. @JoePShoulak can you try this and see if you can follow along plz
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just seeing this, will do tonight!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I copied the .env and made no changes to it
1a. I got an error saying the Docker Daemon wasn't running. Launching the Docker app on Windows fixed that. - This totally worked.
- I got stuck here for a second before I realized it wasn't on port 3000
- I think I nailed this.
- Yup.
- Seems like we may need to adjust the
package.json
(s) and maybe throw annpm i
into the makefile somewhere for good measure.
node:internal/modules/cjs/loader:1085
[0] throw err;
[0] ^
[0]
[0] Error: Cannot find module 'node-appwrite'
server/db/client.js
Outdated
const { Client } = require("node-appwrite"); | ||
const { Databases, ID, Storage } = require("node-appwrite"); | ||
|
||
// Init a client to share | ||
const client = new Client() | ||
.setEndpoint(process.env.APPWRITE_URL) // Your API Endpoint | ||
.setProject(process.env.APPWRITE_PROJECT_ID) // Your project ID | ||
.setKey(process.env.APPWRITE_KEY); // Your secret API key | ||
|
||
const database = new Databases(client); | ||
|
||
const storage = new Storage(client); | ||
|
||
module.exports = { database, storage }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is basically all of the setup to appwrite ❤️
server/db/init.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what I don't like about Baas in general is that it just becomes a lot of button clicking as you create your whole setup in a UI. If you don't code that's really handy, but I want to be able to recreate this app with minimal work, and I don't want our readme to become a 47 step instruction guide on how to use the backend.
Cool for us, appwrite has this pretty cool api to interact with the schema, so I threw together this file that basically acts as a migration file. pretty low tech but it works pretty well.
No description provided.