re-added license, readme, etc.

This commit is contained in:
Dhravya 2024-05-25 18:43:58 -05:00
parent 7de11483c9
commit ccb1587ef5
4 changed files with 193 additions and 0 deletions

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule "apps/browser-rendering"]
path = apps/browser-rendering
url = https://github.com/dhravya/markdowner

21
LICENSE Normal file
View file

@ -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.

90
README.md Normal file
View file

@ -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.47AM.png)
## 👨‍💻 The Stack
![overview](https://i.dhr.wtf/r/Clipboard_Apr_14,_2024_at_4.52PM.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.10PM.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.54PM.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.56PM.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.

79
SETUP-GUIDE.md Normal file
View file

@ -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.