2.2 KiB
Setup guide
Prerequisites
Steps
- Clone the repo
- Run
bun installin the root directory - Create a
.dev.varsfile inapps/webwith the following content:
GOOGLE_CLIENT_ID="-"
GOOGLE_CLIENT_SECRET="-"
NEXTAUTH_SECRET='nextauthsecret'
DATABASE_URL='database.sqlite'
NEXTAUTH_URL='http://localhost:3000'
BACKEND_SECURITY_KEY='veryrandomsecuritykey'
- Setup the database:
First, edit the wrangler.toml file in apps/web to point the d1 database to your account.
You can create a d1 database by running this command
wrangler d1 create DATABASE_NAME
And then replace these values
[[d1_databases]]
binding = "DATABASE"
database_name = "YOUR_DATABASE_NAME"
database_id = "YOUR_DB_ID"
Simply run this command in apps/web
wrangler d1 execute dev-d1-anycontext --local --file=db/prepare.sql
If it runs, you can set up the cloud database as well by removing the --local flag.
- You need to host your own worker for the
apps/cf-ai-backendmodule.
To do this, first edit the .dev.vars file in apps/cf-ai-backend with the following content:
SECURITY_KEY="veryrandomsecuritykey"
// Why? to generate embeddings with 4000+ tokens
OPENAI_API_KEY="sk-"
- Run this command to initialise vector database
Note: You need to use the workers paid plan to use vectorize for now.
wrangler vectorize create --dimensions=1536 supermem-vector-1 --metric=cosine
-
Change the
wrangler.tomlfile inapps/cf-ai-backendto point to your KV namespace -
Run
bun devin the root directory and Voila! You have your own supermemory instance running!
Note: You need to replace the url
https://cf-ai-backend.dhr.wtfeverywhere with your own url for the cf-ai-backend module.
Deploying
To deploy the web app, run bun deploy in the apps/web directory.
To deploy the cf-ai-backend module, run wrangler publish in the apps/cf-ai-backend directory.
To get the extension running, you need to build it first. Run bun build in the apps/extension directory and then load the extension in chrome.