mirror of
https://github.com/LukeHagar/website.git
synced 2025-12-10 12:57:49 +00:00
57 lines
1.7 KiB
Plaintext
57 lines
1.7 KiB
Plaintext
---
|
|
layout: tutorial
|
|
title: Set up Appwrite
|
|
description: Import and configure a project with Appwrite Cloud and Vue.js.
|
|
step: 3
|
|
---
|
|
|
|
# Create project {% #create-project %}
|
|
|
|
Head to the [Appwrite Console](https://cloud.appwrite.io/console).
|
|
|
|
{% only_dark %}
|
|

|
|
{% /only_dark %}
|
|
{% only_light %}
|
|

|
|
{% /only_light %}
|
|
|
|
If this is your first time using Appwrite, create an account and create your first project.
|
|
|
|
Then, under **Add a platform**, add a **Web app**. The **Hostname** should be localhost.
|
|
|
|
{% only_dark %}
|
|

|
|
{% /only_dark %}
|
|
{% only_light %}
|
|

|
|
{% /only_light %}
|
|
|
|
You can skip optional steps.
|
|
|
|
# Initialize Appwrite SDK {% #init-sdk %}
|
|
|
|
To use Appwrite in our Vue app, we'll need to find our project ID. Find your project's ID in the **Settings** page.
|
|
|
|
{% only_dark %}
|
|

|
|
{% /only_dark %}
|
|
{% only_light %}
|
|

|
|
{% /only_light %}
|
|
Create a new file `src/appwrite.js` to hold our Appwrite related code.
|
|
Only one instance of the `Client()` class should be created per app.
|
|
Add the following code to it, replacing `<PROJECT_ID>` with your project ID.
|
|
|
|
```client-web
|
|
import { Client, Databases, Account } from "appwrite";
|
|
|
|
const client = new Client();
|
|
client
|
|
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1")
|
|
.setProject("<PROJECT_ID>"); // Replace with your project ID
|
|
|
|
export const account = new Account(client);
|
|
export const databases = new Databases(client);
|
|
```
|