Skip to content
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

Open
wants to merge 26 commits into
base: main
Choose a base branch
from

Conversation

ebettenga
Copy link

No description provided.

Comment on lines +57 to +71
### 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
Copy link
Author

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

Copy link
Collaborator

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!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ebettenga

  1. 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.
  2. This totally worked.
  3. I got stuck here for a second before I realized it wasn't on port 3000
  4. I think I nailed this.
  5. Yup.
  6. Seems like we may need to adjust the package.json(s) and maybe throw an npm 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'

Comment on lines 1 to 14
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 };
Copy link
Author

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 ❤️

Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants