Skip to content

Commit 205575c

Browse files
committed
added readme
1 parent 96e5861 commit 205575c

File tree

4 files changed

+160
-52
lines changed

4 files changed

+160
-52
lines changed

README.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,84 @@
11
![og image](https://supermemory.dhr.wtf/og-image.png)
2+
3+
# SuperMemory
4+
5+
## 👀 What is this?
6+
7+
Build your own second brain with supermemory. It's a ChatGPT for your bookmarks. Import tweets or save websites and content using the [chrome extension](https://chromewebstore.google.com/detail/supermemory/afpgkkipfdpeaflnpoaffkcankadgjfc?hl=en-GB&authuser=0) (the extension on webstore is not updated, please use the one in the repo)
8+
9+
Well, here's the thing - me and @yxshv save a _lot_ of content on the internet.
10+
11+
Twitter bookmarks, websites, snippets, etc.
12+
13+
But we never look back to it - to us, it's like throwing information in the void.
14+
15+
Supermemory fixes this.
16+
17+
## How do I use this?
18+
19+
Just go to [supermemory.dhr.wtf](https://supermemory.dhr.wtf) and sign in with your google account.
20+
21+
To use the chrome extension, please download it from the [releases page](https://github.com/dhravya/supermemory/releases) and load it in chrome.
22+
23+
## 👨‍💻 The Stack
24+
25+
![overview](https://i.dhr.wtf/r/Clipboard_Apr_14,_2024_at_4.52 PM.png)
26+
27+
Supermemory has three main modules, managed by [turborepo](https://turbo.build):
28+
29+
#### `apps/web`: The main web UI.
30+
31+
The database, auth etc logic is here
32+
33+
![App preview](https://i.dhr.wtf/r/Clipboard_Apr_14,_2024_at_4.10 PM.png)
34+
35+
Built with:
36+
37+
- Nextjs 14
38+
- [Next Auth](https://next-auth.js.org/)
39+
- [Drizzle ORM](https://drizzle.team/)
40+
- [Cloudflare D1 database](https://developers.cloudflare.com/d1/get-started/)
41+
- Cloudflare ratelimiter
42+
- [TailwindCSS](https://tailwindcss.com)
43+
- [shadcn-ui](https://ui.shadcn.com)
44+
- And some other amazing open source projects like [Novel](https://novel.sh) and [vaul](https://vaul.emilkowal.ski/)
45+
- Hosted on Cloudflare Pages
46+
47+
#### `apps/extension`: Chrome extension
48+
49+
The chrome extension is one of the most important part of the setup, but is not required.This is to easily add pages to your memory.
50+
51+
![Chrome extension preview](https://i.dhr.wtf/r/Clipboard_Apr_14,_2024_at_3.54 PM.png)
52+
53+
You can also use it to import all your twitter bookmarks!
54+
![Import bookmarks](https://i.dhr.wtf/r/Clipboard_Apr_14,_2024_at_3.56 PM.png)
55+
56+
Built with:
57+
58+
- [CRXJS](https://crxjs.dev/vite-plugin/getting-started/react/create-project)
59+
- Vite
60+
- [TailwindCSS](https://tailwindcss.com)
61+
- [shadcn-ui](https://ui.shadcn.com)
62+
- React
63+
64+
#### `apps/cf-ai-backend`: This module handles the vector store and AI response generation
65+
66+
This is where the magic happens!
67+
Built with:
68+
69+
- Cloudflare Workers
70+
- [Cloudflare AI](https://ai.cloudflare.com)
71+
- [Cloudflare Vectorize](https://developers.cloudflare.com/vectorize/)
72+
- [Cloudflare Queues](https://developers.cloudflare.com/queues/)
73+
- [Cloudflare Browser Rendering](https://developers.cloudflare.com/browser-rendering/)
74+
- [Cloudflare KV](https://developers.cloudflare.com/kv)
75+
76+
## Contribute or self host
77+
78+
Supermemory is design to be set up easily locally and super duper easy to set up 💫
79+
80+
Please see the [SETUP-GUIDE.md](SETUP-GUIDE.md) for setup instructions.
81+
82+
### Contributing
83+
84+
Contributions are very welcome! A contribution can be as small as a ⭐ or even finding and creating issues.

SETUP-GUIDE.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Setup guide
2+
3+
## Prerequisites
4+
5+
- [bun](https://bun.sh/)
6+
- [wrangler](https://developers.cloudflare.com/workers/cli-wrangler/install-update)
7+
8+
## Steps
9+
10+
1. Clone the repo
11+
2. Run `bun install` in the root directory
12+
3. Create a `.dev.vars` file in `apps/web` with the following content:
13+
14+
```bash
15+
GOOGLE_CLIENT_ID="-"
16+
GOOGLE_CLIENT_SECRET="-"
17+
NEXTAUTH_SECRET='nextauthsecret'
18+
DATABASE_URL='database.sqlite'
19+
NEXTAUTH_URL='http://localhost:3000'
20+
BACKEND_SECURITY_KEY='veryrandomsecuritykey'
21+
```
22+
23+
4. Setup the database:
24+
25+
First, edit the `wrangler.toml` file in `apps/web` to point the d1 database to your account.
26+
27+
You can create a d1 database by running this command
28+
29+
```
30+
wrangler d1 create DATABASE_NAME
31+
```
32+
33+
And then replace these values
34+
35+
```
36+
[[d1_databases]]
37+
binding = "DATABASE"
38+
database_name = "YOUR_DATABASE_NAME"
39+
database_id = "YOUR_DB_ID"
40+
```
41+
42+
Simply run this command in `apps/web`
43+
44+
```
45+
wrangler d1 execute dev-d1-anycontext --local --file=db/prepare.sql
46+
```
47+
48+
If it runs, you can set up the cloud database as well by removing the `--local` flag.
49+
50+
5. You need to host your own worker for the `apps/cf-ai-backend` module.
51+
52+
To do this, first edit the `.dev.vars` file in `apps/cf-ai-backend` with the following content:
53+
54+
```bash
55+
SECURITY_KEY ="veryrandomsecuritykey"
56+
// Why? to generate embeddings with 4000+ tokens
57+
OPENAI_API_KEY="sk-"
58+
```
59+
60+
6. Run this command to initialise vector database
61+
62+
```
63+
wrangler vectorize create --dimensions=1536 supermem-vector-1 --metric=cosine
64+
```
65+
66+
7. Change the `wrangler.toml` file in `apps/cf-ai-backend` to point to your KV namespace
67+
68+
8. Run `bun dev` in the root directory and Voila! You have your own supermemory instance running!
69+
70+
> Note: You need to replace the url `https://cf-ai-backend.dhr.wtf` everywhere with your own url for the cf-ai-backend module.
71+
72+
## Deploying
73+
74+
To deploy the web app, run `bun deploy` in the `apps/web` directory.
75+
To deploy the cf-ai-backend module, run `wrangler publish` in the `apps/cf-ai-backend` directory.
76+
77+
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.

apps/cf-ai-backend/wrangler.toml

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -27,51 +27,3 @@ binding = "MYBROWSER"
2727

2828
[placement]
2929
mode = "smart"
30-
31-
# Variable bindings. These are arbitrary, plaintext strings (similar to environment variables)
32-
# Note: Use secrets to store sensitive data.
33-
# Docs: https://developers.cloudflare.com/workers/platform/environment-variables
34-
# [vars]
35-
# MY_VARIABLE = "production_value"
36-
37-
# Bind a KV Namespace. Use KV as persistent storage for small key-value pairs.
38-
# Docs: https://developers.cloudflare.com/workers/runtime-apis/kv
39-
# [[kv_namespaces]]
40-
# binding = "MY_KV_NAMESPACE"
41-
# id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
42-
43-
# Bind an R2 Bucket. Use R2 to store arbitrarily large blobs of data, such as files.
44-
# Docs: https://developers.cloudflare.com/r2/api/workers/workers-api-usage/
45-
# [[r2_buckets]]
46-
# binding = "MY_BUCKET"
47-
# bucket_name = "my-bucket"
48-
49-
# Bind a Queue producer. Use this binding to schedule an arbitrary task that may be processed later by a Queue consumer.
50-
# Docs: https://developers.cloudflare.com/queues/get-started
51-
# [[queues.producers]]
52-
# binding = "MY_QUEUE"
53-
# queue = "my-queue"
54-
55-
# Bind a Queue consumer. Queue Consumers can retrieve tasks scheduled by Producers to act on them.
56-
# Docs: https://developers.cloudflare.com/queues/get-started
57-
# [[queues.consumers]]
58-
# queue = "my-queue"
59-
60-
# Bind another Worker service. Use this binding to call another Worker without network overhead.
61-
# Docs: https://developers.cloudflare.com/workers/platform/services
62-
# [[services]]
63-
# binding = "MY_SERVICE"
64-
# service = "my-service"
65-
66-
# Bind a Durable Object. Durable objects are a scale-to-zero compute primitive based on the actor model.
67-
# Durable Objects can live for as long as needed. Use these when you need a long-running "server", such as in realtime apps.
68-
# Docs: https://developers.cloudflare.com/workers/runtime-apis/durable-objects
69-
# [[durable_objects.bindings]]
70-
# name = "MY_DURABLE_OBJECT"
71-
# class_name = "MyDurableObject"
72-
73-
# Durable Object migrations.
74-
# Docs: https://developers.cloudflare.com/workers/learning/using-durable-objects#configure-durable-object-classes-with-migrations
75-
# [[migrations]]
76-
# tag = "v1"
77-
# new_classes = ["MyDurableObject"]

apps/web/wrangler.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ name = "web"
22
compatibility_date = "2024-03-29"
33
compatibility_flags = ["nodejs_compat"]
44

5-
[[vectorize]]
6-
binding = "VECTORIZE_INDEX"
7-
index_name = "anycontext-idx"
8-
95
[[d1_databases]]
106
binding = "DATABASE"
117
database_name = "dev-d1-anycontext"

0 commit comments

Comments
 (0)