Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Appwrite Configuration
APPWRITE_API_KEY=
APPWRITE_FUNCTION_PROJECT_ID=resonate
APPWRITE_ENDPOINT=https://cloud.appwrite.io/v1

# Livekit Configuration
LIVEKIT_HOST=
LIVEKIT_API_KEY=
LIVEKIT_API_SECRET=

# Email Configuration (for OTP)
SENDER_MAIL=
SENDER_PASSWORD=

# Database IDs
VERIFICATION_DATABASE_ID=64a7bfd6b09121548bfe
OTP_COLLECTION_ID=64a7bfe3a3a7ee5bf7f8
VERIFY_COLLECTION_ID=64a7c0100eabfe8d3844
MASTER_DATABASE_ID=64a521785f5be62b796f
ROOMS_COLLECTION_ID=64a5217e695bf2c4ec9c
PARTICIPANTS_COLLECTION_ID=64a63e508145d1084abf
ACTIVE_PAIRS_COLLECTION_ID=64d980cd65ff2e08ab97
REQUESTS_COLLECTION_ID=64d980211f1395263ebe
DATABASE_ID=64a521785f5be62b796f

# Upcoming Rooms
UPCOMING_ROOMS_DATABASE_ID=6522fcf27a1bbc4238df
UPCOMING_ROOMS_COLLECTION_ID=6522fd163103bd453183
SUBSCRIBER_COLLECTION_ID=6522fd267db6fdad3392

# User Data
USER_DATA_DATABASE_ID=64a1319104a149e16f5c
USERS_COLLECTION_ID=64a52f0a6c41ded09def

# Database Cleaner
RETENTION_PERIOD_DAYS=0
57 changes: 52 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,64 @@

Go to [this repository](https://github.com/AOSSIE-Org/Resonate) to know more about the project.

## Environment Setup :
## Environment Setup

1. Pre-requisites :
1. Pre-requisites

(a) Fork the Repo

(b) Clone the Repo : `git clone https://github.com/AOSSIE-Org/Resonate-Backend`
(b) Clone the Repo: `git clone https://github.com/AOSSIE-Org/Resonate-Backend`

2. Follow [this guide](https://docs.livekit.io/cloud/project-management/keys-and-tokens/) to obtain your `HOST`, `API-KEY`, `API-SECRET` from [livekit-cloud](https://livekit.io/cloud).
Copy link
Contributor

Choose a reason for hiding this comment

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

This was necessary as part of the README, please revert

2. Follow this guide to obtain your Livekit credentials

3. Create a new project on [Appwrite Cloud](https://appwrite.io/) or self host it locally by pulling their [docker image](https://appwrite.io/docs/self-hosting). Know more about Appwrite [here](https://appwrite.io/docs).
Copy link
Contributor

Choose a reason for hiding this comment

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

This was necessary as part of the README, please revert

- Guide: https://docs.livekit.io/cloud/project-management/keys-and-tokens/
- You will need `LIVEKIT_HOST`, `LIVEKIT_API_KEY`, `LIVEKIT_API_SECRET`.

3. Set up environment variables

```bash
cp .env.example .env
```
Comment on lines +25 to +27
Copy link
Contributor

Choose a reason for hiding this comment

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

There was no .env.example added with the PR, and bash commands work only on Unix systems, the README should also include instructions for Windows


Windows:

```powershell
Copy-Item .env.example .env
```

or (CMD):

```cmd
copy .env.example .env
```

Then fill in the values in `.env`:
- Leave the database/collection IDs as they are (they match the project structure)
- Add your Livekit credentials (see step 2)
- Add your email credentials (see step 5)

4. Set up Appwrite

- Create a new project on [Appwrite Cloud](https://appwrite.io/) or self host it locally by pulling their [docker image](https://appwrite.io/docs/self-hosting). Know more about Appwrite [here](https://appwrite.io/docs).
- Create an API key with necessary scopes.
- Import the database structure: `appwrite deploy collection`.
- Copy the generated database and collection IDs into your `.env` file.
- Important: Appwrite functions do not read from your local `.env`. You must set function variables in Appwrite:
- Console: Go to Project → Functions → Select a function → Settings → Variables → add keys/values.
- CLI example:
- `appwrite client --endpoint https://cloud.appwrite.io/v1 --projectId <PROJECT_ID> --key <API_KEY>`
- `appwrite functions update --functionId <FUNCTION_ID> --vars APPWRITE_API_KEY=<...>,VERIFICATION_DATABASE_ID=<...>,OTP_COLLECTION_ID=<...>,SENDER_MAIL=<...>,SENDER_PASSWORD=<...>`

5. Email configuration (for OTP functionality)

- Set `SENDER_MAIL` to your email address.
- Set `SENDER_PASSWORD` to your app password (Gmail guide: https://support.google.com/accounts/answer/185833?hl=en).

6. Security note

- Do not hardcode secrets in `appwrite.json`. Use environment variables. The template `.env.example` lists all variables required across functions.
- Note: `appwrite.json` does not read from `.env`. Set function variables in the Appwrite Console (or via Appwrite CLI) for cloud execution; `.env` is for local configuration/reference.
- Tip: Keep `.env` as a convenient record of values; replicate them into Appwrite Function Variables for actual use.

## Functions :

Expand Down
4 changes: 2 additions & 2 deletions appwrite.json
Copy link
Contributor

Choose a reason for hiding this comment

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

JSONs do not have notions of env vars and setting them like this will cause the email and password to be set as literal placeholder strings

Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@
"vars": [
{
"key": "SENDER_MAIL",
"value": "[email protected]"
"value": ""
},
{
"key": "VERIFICATION_DATABASE_ID",
"value": "64a7bfd6b09121548bfe"
},
{
"key": "SENDER_PASSWORD",
"value": "xizkyvzhduejxjel"
"value": ""
},
{
"key": "OTP_COLLECTION_ID",
Expand Down
1 change: 1 addition & 0 deletions functions/match-maker/src/main.js
Copy link
Contributor

Choose a reason for hiding this comment

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

Unnecessary and breaking change

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { throwIfMissing } from './utils.js';
export default async ({ req, res, log, error }) => {
throwIfMissing(process.env, [
'APPWRITE_API_KEY',
'APPWRITE_FUNCTION_PROJECT_ID',
'DATABASE_ID',
'REQUESTS_COLLECTION_ID',
'ACTIVE_PAIRS_COLLECTION_ID',
Expand Down