aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDhravya <[email protected]>2024-05-25 18:43:58 -0500
committerDhravya <[email protected]>2024-05-25 18:43:58 -0500
commitccb1587ef58ae9b8068f02ad79dcabd979c27d03 (patch)
treeb3157f12834a875cb93742c776ba517d11cbcd6f
parentrefactored UI, with shared components and UI, better rules and million lint (diff)
downloadsupermemory-ccb1587ef58ae9b8068f02ad79dcabd979c27d03.tar.xz
supermemory-ccb1587ef58ae9b8068f02ad79dcabd979c27d03.zip
re-added license, readme, etc.
-rw-r--r--.gitmodules3
-rw-r--r--LICENSE21
-rw-r--r--README.md90
-rw-r--r--SETUP-GUIDE.md79
4 files changed, 193 insertions, 0 deletions
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 00000000..b3c8135a
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "apps/browser-rendering"]
+ path = apps/browser-rendering
+ url = https://github.com/dhravya/markdowner \ No newline at end of file
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 00000000..c50f32c7
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2024 Dhravya Shah
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100644
index 00000000..0fbe3e85
--- /dev/null
+++ b/README.md
@@ -0,0 +1,90 @@
+![og image](https://supermemory.dhr.wtf/og-image.png)
+
+# SuperMemory
+
+Interested in helping build the best second brain for everyone? Join the discord https://discord.gg/2X2XsKz5AU. Contributions welcome.
+
+## 👀 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,
+
+1. Get the chrome ext (click on the button)
+2. Click on the "Extension Auth" button so the extension knows who you are :)
+ ![chrome](https://i.dhr.wtf/r/Clipboard_Apr_15,_2024_at_10.47 AM.png)
+
+## 👨‍💻 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](https://pages.cloudflare.com/)
+
+#### `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.
diff --git a/SETUP-GUIDE.md b/SETUP-GUIDE.md
new file mode 100644
index 00000000..7d69b545
--- /dev/null
+++ b/SETUP-GUIDE.md
@@ -0,0 +1,79 @@
+# Setup guide
+
+## Prerequisites
+
+- [bun](https://bun.sh/)
+- [turbo](https://turbo.build/repo/docs/installing)
+- [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
+ > Note: You need to use the workers paid plan to use vectorize for now.
+
+```
+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.