Spaces:
Running
Running
Ctrl+K

add more feuatuires so to manage the ememoreis and retriveby coincidence and ggorup anf gorp the related ones etc. u knwo... lsit the 20 CCRUD and proceed imeplemntin ======================== CODE SNIPPETS ======================== TITLE: Setting Up and Running Development Environment (npm) DESCRIPTION: This snippet provides the commands to install project dependencies and start the local development server for a Node.js/JavaScript project using npm. 'npm install' fetches all required packages, and 'npm run dev' typically starts a development server or build process. SOURCE: https://github.com/supermemoryai/supermemory/blob/main/apps/backend/README.md#_snippet_0 LANGUAGE: Shell CODE: ``` npm install npm run dev ``` ---------------------------------------- TITLE: Installing Project Dependencies with Bun DESCRIPTION: This command installs all necessary project dependencies using Bun, a fast JavaScript runtime and package manager. It's the initial step required before running the application development servers. SOURCE: https://github.com/supermemoryai/supermemory/blob/main/SELF-HOSTING-GUIDE.md#_snippet_5 LANGUAGE: bash CODE: ``` bun install ``` ---------------------------------------- TITLE: Starting Supermemory Development Servers with Bun DESCRIPTION: This command initiates the development servers for the Supermemory application using Bun. It allows developers to run and test the application locally during development. SOURCE: https://github.com/supermemoryai/supermemory/blob/main/SELF-HOSTING-GUIDE.md#_snippet_6 LANGUAGE: bash CODE: ``` bun run dev ``` ---------------------------------------- TITLE: Starting Local Wrangler Server DESCRIPTION: After building the application, this command starts the local Wrangler server, allowing developers to test their Cloudflare Worker and Pages functions in a local environment that mimics Cloudflare's infrastructure. SOURCE: https://github.com/supermemoryai/supermemory/blob/main/apps/web/README.md#_snippet_2 LANGUAGE: Shell CODE: ``` npm run start ``` ---------------------------------------- TITLE: Building Application for Production Deployment (Cloudflare Pages) DESCRIPTION: This command prepares the Remix application for production by compiling and optimizing it, which is the first step before deploying to Cloudflare Pages. SOURCE: https://github.com/supermemoryai/supermemory/blob/main/apps/web/README.md#_snippet_4 LANGUAGE: Shell CODE: ``` npm run build ``` ---------------------------------------- TITLE: Running Development Server (Remix + Cloudflare) DESCRIPTION: This command initiates the local development server for a Remix application, providing live reloading and a local environment for testing and development. SOURCE: https://github.com/supermemoryai/supermemory/blob/main/apps/web/README.md#_snippet_0 LANGUAGE: Shell CODE: ``` npm run dev ``` ---------------------------------------- TITLE: Deploying Application to Cloudflare Pages DESCRIPTION: This command pushes the pre-built Remix application to Cloudflare Pages, making it publicly accessible and hosted on Cloudflare's global network. SOURCE: https://github.com/supermemoryai/supermemory/blob/main/apps/web/README.md#_snippet_5 LANGUAGE: Shell CODE: ``` npm run deploy ``` ---------------------------------------- TITLE: Supermemory API Base URL DESCRIPTION: Specifies the base URL for all Supermemory API requests. This is the root endpoint to which all specific API paths are appended. SOURCE: https://github.com/supermemoryai/supermemory/blob/main/apps/docs/quickstart.mdx#_snippet_0 LANGUAGE: text CODE: ``` https://v2.api.supermemory.ai ``` ---------------------------------------- TITLE: Running Mintlify Local Development Server (Shell) DESCRIPTION: This command starts the local development server for your Mintlify documentation. It allows you to preview changes in real-time and must be executed from the root directory where your `mint.json` configuration file is located. SOURCE: https://github.com/supermemoryai/supermemory/blob/main/apps/docs/README.md#_snippet_1 LANGUAGE: Shell CODE: ``` mintlify dev ``` ---------------------------------------- TITLE: Installing Mintlify CLI Globally (Shell) DESCRIPTION: This command uses npm to globally install the Mintlify Command Line Interface (CLI). The CLI is essential for previewing documentation changes locally and interacting with Mintlify features. SOURCE: https://github.com/supermemoryai/supermemory/blob/main/apps/docs/README.md#_snippet_0 LANGUAGE: Shell CODE: ``` npm i -g mintlify ``` ---------------------------------------- TITLE: Building Application for Local Wrangler Testing DESCRIPTION: This command compiles the Remix application for production, a prerequisite for running it locally with Cloudflare's Wrangler CLI to simulate the Cloudflare Workers environment. SOURCE: https://github.com/supermemoryai/supermemory/blob/main/apps/web/README.md#_snippet_1 LANGUAGE: Shell CODE: ``` npm run build ``` ---------------------------------------- TITLE: Spinning up PostgreSQL Database with Docker Compose DESCRIPTION: This command uses Docker Compose to start a PostgreSQL database instance locally, including the pgvector extension, making it accessible at `localhost:5432` for the Supermemory application. SOURCE: https://github.com/supermemoryai/supermemory/blob/main/SELF-HOSTING-GUIDE.md#_snippet_0 LANGUAGE: bash CODE: ``` docker-compose up -d ``` ---------------------------------------- TITLE: Cloning the Supermemory Repository and Installing Dependencies (Bash) DESCRIPTION: This snippet provides the commands to clone the Supermemory GitHub repository, navigate into the project directory, install Bun globally, and then install all project dependencies using Bun. SOURCE: https://github.com/supermemoryai/supermemory/blob/main/apps/docs/self-hosting.mdx#_snippet_0 LANGUAGE: bash CODE: ``` git clone https://github.com/supermemoryai/supermemory.git cd supermemory npm i -g bun bun install ``` ---------------------------------------- TITLE: Starting Development Servers (Bun/Bash) DESCRIPTION: This command initiates the development servers for the Supermemory application, allowing local development and testing. SOURCE: https://github.com/supermemoryai/supermemory/blob/main/apps/docs/self-hosting.mdx#_snippet_6 LANGUAGE: bash CODE: ``` bun run dev ``` ---------------------------------------- TITLE: Installing Application Dependencies (Bun/Bash) DESCRIPTION: This command installs all required project dependencies for the Supermemory application using the Bun package manager. SOURCE: https://github.com/supermemoryai/supermemory/blob/main/apps/docs/self-hosting.mdx#_snippet_5 LANGUAGE: bash CODE: ``` bun install ``` ---------------------------------------- TITLE: Deploying Project (npm) DESCRIPTION: This snippet shows the command to trigger the deployment process for a Node.js/JavaScript project. 'npm run deploy' is a common script name used to build the project for production and push it to a deployment target. SOURCE: https://github.com/supermemoryai/supermemory/blob/main/apps/backend/README.md#_snippet_1 LANGUAGE: Shell CODE: ``` npm run deploy ``` ---------------------------------------- TITLE: Spinning Up Local Database with Docker Compose (Bash) DESCRIPTION: This command uses Docker Compose to start a local PostgreSQL database instance, including the pgvector extension, accessible at `localhost:5432`. SOURCE: https://github.com/supermemoryai/supermemory/blob/main/apps/docs/self-hosting.mdx#_snippet_1 LANGUAGE: bash CODE: ``` docker-compose up -d ``` ---------------------------------------- TITLE: Searching Memories in Supermemory API (curl) DESCRIPTION: Shows how to search for existing memories in the Supermemory account using a `curl` POST request. It requires an API key for authentication and sends the search query (`q`) as a JSON payload. SOURCE: https://github.com/supermemoryai/supermemory/blob/main/apps/docs/quickstart.mdx#_snippet_2 LANGUAGE: bash CODE: ``` curl -X POST https://v2.api.supermemory.ai/search \ -H "x-api-key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"q": "This is the content of my first memory."}' ``` ---------------------------------------- TITLE: Adding New Memory to Supermemory API (curl) DESCRIPTION: Demonstrates how to add a new memory to the Supermemory account using a `curl` POST request. It requires an API key for authentication and sends the memory content as a JSON payload. SOURCE: https://github.com/supermemoryai/supermemory/blob/main/apps/docs/quickstart.mdx#_snippet_1 LANGUAGE: bash CODE: ``` curl -X POST https://v2.api.supermemory.ai/add \ -H "x-api-key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"content": "This is the content of my first memory."}' ``` ---------------------------------------- TITLE: Generating Cloudflare Binding Types (TypeScript) DESCRIPTION: This command generates TypeScript type definitions for Cloudflare bindings specified in `wrangler.toml`, enhancing type safety and developer experience. It must be re-executed whenever `wrangler.toml` is modified. SOURCE: https://github.com/supermemoryai/supermemory/blob/main/apps/web/README.md#_snippet_3 LANGUAGE: Shell CODE: ``` npm run typegen ``` ---------------------------------------- TITLE: Applying Local Database Migrations with Bun DESCRIPTION: This command applies pending database migrations to the local PostgreSQL database using Bun, ensuring the database schema is up-to-date with the application's requirements. It's crucial for schema synchronization. SOURCE: https://github.com/supermemoryai/supermemory/blob/main/SELF-HOSTING-GUIDE.md#_snippet_2 LANGUAGE: bash CODE: ``` bun run migrate:local ``` ---------------------------------------- TITLE: Configuring Web Application Environment Variables DESCRIPTION: This snippet outlines the environment variables necessary for the Supermemory web application. It includes configurations for WorkOS authentication, database connection, Cloudflare R2 storage, backend URL, OpenAI, Notion integration, Node environment, and Stripe payment keys. SOURCE: https://github.com/supermemoryai/supermemory/blob/main/SELF-HOSTING-GUIDE.md#_snippet_4 LANGUAGE: env CODE: ``` WORKOS_CLIENT_ID=your_workos_client_id WORKOS_API_KEY=your_workos_api_key WORKOS_REDIRECT_URI="http://localhost:3000/callback" WORKOS_COOKIE_PASSWORD=your_cookie_password DATABASE_URL="postgresql://postgres:postgres@localhost:5432/supermemorydhravya" CLOUDFLARE_ACCOUNT_ID=your_cloudflare_account_id R2_ACCESS_KEY_ID=your_r2_access_key_id R2_SECRET_ACCESS_KEY=your_r2_secret_access_key BACKEND_URL=http://localhost:8787 OPENAI_API_KEY=your_openai_api_key NOTION_CLIENT_ID=your_notion_client_id NOTION_CLIENT_SECRET=your_notion_client_secret NODE_ENV=development STRIPE_CHECKOUT_KEY=your_stripe_checkout_key STRIPE_WEBHOOK_SECRET=your_stripe_webhook_secret ``` ---------------------------------------- TITLE: Configuring Backend Environment Variables DESCRIPTION: This snippet shows the essential environment variables required for the Supermemory backend application. These variables configure API keys for various services (WorkOS, Gemini, OpenAI, Braintrust, Resend, Turnstile), database connection, and content workflow settings. SOURCE: https://github.com/supermemoryai/supermemory/blob/main/SELF-HOSTING-GUIDE.md#_snippet_3 LANGUAGE: env CODE: ``` WORKOS_API_KEY=your_workos_api_key WORKOS_CLIENT_ID=your_workos_client_id WORKOS_COOKIE_PASSWORD=your_cookie_password DATABASE_URL="postgresql://postgres:postgres@localhost:5432/supermemory" CONTENT_WORKFLOW=your_content_workflow GEMINI_API_KEY=your_gemini_api_key NODE_ENV=development OPEN_AI_API_KEY=your_openai_api_key BRAINTRUST_API_KEY=your_braintrust_api_key RESEND_API_KEY=your_resend_api_key TURNSTILE_SECRET_KEY=your_turnstile_secret_key ``` ---------------------------------------- TITLE: Generating Drizzle ORM Database Migration DESCRIPTION: This command generates a new database migration file using Bun, based on changes made to the Drizzle ORM schema. It's a prerequisite for applying schema updates to the database. SOURCE: https://github.com/supermemoryai/supermemory/blob/main/SELF-HOSTING-GUIDE.md#_snippet_1 LANGUAGE: bash CODE: ``` bun run generate-migration ``` ---------------------------------------- TITLE: Example Metadata for Exact Search - JSON DESCRIPTION: Illustrates a JSON metadata object with string values, suitable for properties like 'classId' and 'year' when exact search matching is desired. SOURCE: https://github.com/supermemoryai/supermemory/blob/main/apps/docs/api-reference/endpoints/memory-management/post-add.mdx#_snippet_0 LANGUAGE: json CODE: ``` { "classId": "21412", "year": "fifth" } ``` ---------------------------------------- TITLE: Example Metadata for Range Search - JSON DESCRIPTION: Demonstrates a JSON metadata object using a numeric value for 'price', enabling range-based searches for numerical or time-based properties. SOURCE: https://github.com/supermemoryai/supermemory/blob/main/apps/docs/api-reference/endpoints/memory-management/post-add.mdx#_snippet_1 LANGUAGE: json CODE: ``` { "price": 1250 } ``` ---------------------------------------- TITLE: Initializing supermemory Client and Performing Operations (JavaScript) DESCRIPTION: This snippet demonstrates how to initialize the supermemory client using an API key, add content to a knowledge base from a URL with associated metadata, and then query the knowledge base for relevant information based on a natural language question. It showcases the basic workflow of content ingestion and semantic retrieval. SOURCE: https://github.com/supermemoryai/supermemory/blob/main/README.md#_snippet_0 LANGUAGE: javascript CODE: ``` // Install: npm install supermemory import { supermemory } from 'supermemory'; const client = new supermemory({ apiKey: 'YOUR_API_KEY', }); // Add content to your knowledge base await client.memory.create({ content: "https://en.wikipedia.org/wiki/Artificial_intelligence", metadata: { source: "wikipedia", category: "AI" } }); // Query your knowledge base const results = await client.search.create({ q: "What are the ethical considerations in AI development?", limit: 5 }); ``` ---------------------------------------- TITLE: Generating and Applying Database Migrations (Bun/Bash) DESCRIPTION: These commands are used to generate new database migrations based on schema changes and then apply those migrations to the local PostgreSQL database. It's crucial to use `drizzle-orm` functions for database interactions. SOURCE: https://github.com/supermemoryai/supermemory/blob/main/apps/docs/self-hosting.mdx#_snippet_2 LANGUAGE: bash CODE: ``` bun run generate-migration bun run migrate:local ``` ---------------------------------------- TITLE: Configuring Backend Environment Variables (.env) DESCRIPTION: This snippet shows the essential environment variables required for the Supermemory backend application, including API keys for various services like WorkOS, Gemini, OpenAI, Braintrust, Resend, Turnstile, and the local PostgreSQL database URL. SOURCE: https://github.com/supermemoryai/supermemory/blob/main/apps/docs/self-hosting.mdx#_snippet_3 LANGUAGE: env CODE: ``` WORKOS_API_KEY=your_workos_api_key WORKOS_CLIENT_ID=your_workos_client_id WORKOS_COOKIE_PASSWORD=your_cookie_password DATABASE_URL="postgresql://postgres:postgres@localhost:5432/supermemorylocal" CONTENT_WORKFLOW=your_content_workflow GEMINI_API_KEY=your_gemini_api_key NODE_ENV=development OPEN_AI_API_KEY=your_openai_api_key BRAINTRUST_API_KEY=your_braintrust_api_key RESEND_API_KEY=your_resend_api_key TURNSTILE_SECRET_KEY=your_turnstile_secret_key ``` ---------------------------------------- TITLE: Configuring Web Application Environment Variables (.env) DESCRIPTION: This snippet lists the necessary environment variables for the Supermemory web application, covering WorkOS authentication, Cloudflare R2 storage, backend URL, OpenAI and Notion API keys, and Stripe integration details. SOURCE: https://github.com/supermemoryai/supermemory/blob/main/apps/docs/self-hosting.mdx#_snippet_4 LANGUAGE: env CODE: ``` WORKOS_CLIENT_ID=your_workos_client_id WORKOS_API_KEY=your_workos_api_key WORKOS_REDIRECT_URI="http://localhost:3000/callback" WORKOS_COOKIE_PASSWORD=your_cookie_password DATABASE_URL="postgresql://postgres:postgres@localhost:5432/supermemorylocal" CLOUDFLARE_ACCOUNT_ID=your_cloudflare_account_id R2_ACCESS_KEY_ID=your_r2_access_key_id R2_SECRET_ACCESS_KEY=your_r2_secret_access_key BACKEND_URL=http://localhost:8787 OPENAI_API_KEY=your_openai_api_key NOTION_CLIENT_ID=your_notion_client_id NOTION_CLIENT_SECRET=your_notion_client_secret NODE_ENV=development STRIPE_CHECKOUT_KEY=your_stripe_checkout_key STRIPE_WEBHOOK_SECRET=your_stripe_webhook_secret ``` ---------------------------------------- TITLE: Performing a Filtered Search Request with Supermemory API - cURL Bash DESCRIPTION: This cURL command demonstrates how to make a search request to the Supermemory API, including a query string (`q`), a limit on results, and a complex `AND` filter. The filter specifies that results must match both "book": "maths" and "author": "r.d. sharma", showcasing how to apply specific metadata filters to search queries. SOURCE: https://github.com/supermemoryai/supermemory/blob/main/apps/docs/essentials/metadata-filtering.mdx#_snippet_1 LANGUAGE: bash CODE: ``` curl --location 'https://v2.api.supermemory.ai/search' \ --header 'x-api-key: supermemory_RXPx' \ --header 'Content-Type: application/json' \ --data '{ "q": "How to use teamcity to set up a project?", "limit": 10, "filters": { "AND": [ { "key": "book", "value": "maths", "negate": false }, { "key": "author", "value": "r.d. sharma", "negate": false } ] } }' ``` ---------------------------------------- TITLE: Composing Advanced Filters for Supermemory API Search - JSON DESCRIPTION: This JSON snippet demonstrates how to construct complex filter conditions for Supermemory API search queries using `AND`, `OR`, and `numeric` operators. It shows filtering by timestamp, user group, and either team name or organization name, allowing for precise control over search results in multi-user environments. SOURCE: https://github.com/supermemoryai/supermemory/blob/main/apps/docs/essentials/metadata-filtering.mdx#_snippet_0 LANGUAGE: json CODE: ``` { "AND": [ { "filterType": "numeric", "key": "timestamp", "value": "1742745777", "negate": false, "numericOperator": ">" }, { "key": "group", "value": "jira_users", "negate": false }, { "OR": [ { "key": "team_name", "value": "engineering", "negate": false }, { "key": "org_name", "value": "supermemory", "negate": false } ] } ] } ``` - Initial Deployment
95d95a7
verified