-
Notifications
You must be signed in to change notification settings - Fork 718
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
160 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,84 @@ | ||
![og image](https://supermemory.dhr.wtf/og-image.png) | ||
|
||
# SuperMemory | ||
|
||
## 👀 What is this? | ||
|
||
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) | ||
|
||
Well, here's the thing - me and @yxshv save a _lot_ of content on the internet. | ||
|
||
Twitter bookmarks, websites, snippets, etc. | ||
|
||
But we never look back to it - to us, it's like throwing information in the void. | ||
|
||
Supermemory fixes this. | ||
|
||
## How do I use this? | ||
|
||
Just go to [supermemory.dhr.wtf](https://supermemory.dhr.wtf) and sign in with your google account. | ||
|
||
To use the chrome extension, please download it from the [releases page](https://github.com/dhravya/supermemory/releases) and load it in chrome. | ||
|
||
## 👨💻 The Stack | ||
|
||
![overview](https://i.dhr.wtf/r/Clipboard_Apr_14,_2024_at_4.52 PM.png) | ||
|
||
Supermemory has three main modules, managed by [turborepo](https://turbo.build): | ||
|
||
#### `apps/web`: The main web UI. | ||
|
||
The database, auth etc logic is here | ||
|
||
![App preview](https://i.dhr.wtf/r/Clipboard_Apr_14,_2024_at_4.10 PM.png) | ||
|
||
Built with: | ||
|
||
- Nextjs 14 | ||
- [Next Auth](https://next-auth.js.org/) | ||
- [Drizzle ORM](https://drizzle.team/) | ||
- [Cloudflare D1 database](https://developers.cloudflare.com/d1/get-started/) | ||
- Cloudflare ratelimiter | ||
- [TailwindCSS](https://tailwindcss.com) | ||
- [shadcn-ui](https://ui.shadcn.com) | ||
- And some other amazing open source projects like [Novel](https://novel.sh) and [vaul](https://vaul.emilkowal.ski/) | ||
- Hosted on Cloudflare Pages | ||
|
||
#### `apps/extension`: Chrome extension | ||
|
||
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. | ||
|
||
![Chrome extension preview](https://i.dhr.wtf/r/Clipboard_Apr_14,_2024_at_3.54 PM.png) | ||
|
||
You can also use it to import all your twitter bookmarks! | ||
![Import bookmarks](https://i.dhr.wtf/r/Clipboard_Apr_14,_2024_at_3.56 PM.png) | ||
|
||
Built with: | ||
|
||
- [CRXJS](https://crxjs.dev/vite-plugin/getting-started/react/create-project) | ||
- Vite | ||
- [TailwindCSS](https://tailwindcss.com) | ||
- [shadcn-ui](https://ui.shadcn.com) | ||
- React | ||
|
||
#### `apps/cf-ai-backend`: This module handles the vector store and AI response generation | ||
|
||
This is where the magic happens! | ||
Built with: | ||
|
||
- Cloudflare Workers | ||
- [Cloudflare AI](https://ai.cloudflare.com) | ||
- [Cloudflare Vectorize](https://developers.cloudflare.com/vectorize/) | ||
- [Cloudflare Queues](https://developers.cloudflare.com/queues/) | ||
- [Cloudflare Browser Rendering](https://developers.cloudflare.com/browser-rendering/) | ||
- [Cloudflare KV](https://developers.cloudflare.com/kv) | ||
|
||
## Contribute or self host | ||
|
||
Supermemory is design to be set up easily locally and super duper easy to set up 💫 | ||
|
||
Please see the [SETUP-GUIDE.md](SETUP-GUIDE.md) for setup instructions. | ||
|
||
### Contributing | ||
|
||
Contributions are very welcome! A contribution can be as small as a ⭐ or even finding and creating issues. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# Setup guide | ||
|
||
## Prerequisites | ||
|
||
- [bun](https://bun.sh/) | ||
- [wrangler](https://developers.cloudflare.com/workers/cli-wrangler/install-update) | ||
|
||
## Steps | ||
|
||
1. Clone the repo | ||
2. Run `bun install` in the root directory | ||
3. Create a `.dev.vars` file in `apps/web` with the following content: | ||
|
||
```bash | ||
GOOGLE_CLIENT_ID="-" | ||
GOOGLE_CLIENT_SECRET="-" | ||
NEXTAUTH_SECRET='nextauthsecret' | ||
DATABASE_URL='database.sqlite' | ||
NEXTAUTH_URL='http://localhost:3000' | ||
BACKEND_SECURITY_KEY='veryrandomsecuritykey' | ||
``` | ||
|
||
4. 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. | ||
|
||
5. You need to host your own worker for the `apps/cf-ai-backend` module. | ||
|
||
To do this, first edit the `.dev.vars` file in `apps/cf-ai-backend` with the following content: | ||
|
||
```bash | ||
SECURITY_KEY ="veryrandomsecuritykey" | ||
// Why? to generate embeddings with 4000+ tokens | ||
OPENAI_API_KEY="sk-" | ||
``` | ||
|
||
6. Run this command to initialise vector database | ||
|
||
``` | ||
wrangler vectorize create --dimensions=1536 supermem-vector-1 --metric=cosine | ||
``` | ||
|
||
7. Change the `wrangler.toml` file in `apps/cf-ai-backend` to point to your KV namespace | ||
|
||
8. Run `bun dev` in the root directory and Voila! You have your own supermemory instance running! | ||
|
||
> Note: You need to replace the url `https://cf-ai-backend.dhr.wtf` everywhere 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters