{"id":20472732,"url":"https://github.com/greathayat/supabase-edge-functions-rag","last_synced_at":"2025-09-25T00:30:51.994Z","repository":{"id":241055735,"uuid":"804164065","full_name":"GreatHayat/supabase-edge-functions-rag","owner":"GreatHayat","description":"This is a repository to let you know the implementation of a basic RAG pipeline using LangChain in Supabase Edge Functions.","archived":false,"fork":false,"pushed_at":"2024-05-22T06:03:51.000Z","size":7,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-07T00:13:20.916Z","etag":null,"topics":["ai","edge-functions","embeddings","langchain","rag","supabase","vector-database"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GreatHayat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-22T04:37:56.000Z","updated_at":"2025-02-07T15:47:42.000Z","dependencies_parsed_at":"2024-05-22T07:25:08.082Z","dependency_job_id":"55ab9322-5967-49b2-b436-50696dbcb389","html_url":"https://github.com/GreatHayat/supabase-edge-functions-rag","commit_stats":null,"previous_names":["greathayat/langchain-edge-function","greathayat/supabase-edge-functions-rag"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/GreatHayat/supabase-edge-functions-rag","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GreatHayat%2Fsupabase-edge-functions-rag","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GreatHayat%2Fsupabase-edge-functions-rag/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GreatHayat%2Fsupabase-edge-functions-rag/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GreatHayat%2Fsupabase-edge-functions-rag/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GreatHayat","download_url":"https://codeload.github.com/GreatHayat/supabase-edge-functions-rag/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GreatHayat%2Fsupabase-edge-functions-rag/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276842164,"owners_count":25714202,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-24T02:00:09.776Z","response_time":97,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","edge-functions","embeddings","langchain","rag","supabase","vector-database"],"created_at":"2024-11-15T14:21:38.755Z","updated_at":"2025-09-25T00:30:51.500Z","avatar_url":"https://github.com/GreatHayat.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LangChain in Supabase Edge Functions\n\nInstalling NPM Packages in Supabase Edge Functions\nIf you're familiar with Supabase Edge Functions, you may know that installing npm packages is not as straightforward as in a typical Node.js or Express application. However, there are several methods to include npm packages in Supabase Edge Functions. In this guide, I'll demonstrate how to use the import_map.json file to achieve this.\n\n---\n\n## Initialize \u0026 Start Supabase Project\n\n\u003e Ensure Docker is installed on your machine.\n\n### Step 1: Initialize the Project\n\nChoose your directory and run the following command:\n\n```sh\nnpx supabase init\n```\n\nThis will create a `supabase` folder in your directory.\n\n### Step 2: Start the Supabase Project\n\nRun the following command to start the project:\n\n```sh\nnpx supabase start\n```\n\nThis process may take a few minutes as it pulls Docker images and starts the containers.\n\n### Step 3: Create a Supabase Edge Function\n\nOpen the directory in your favorite code editor and run the following command to create a new Supabase Edge Function:\n\n```sh\nnpx supabase functions new \u003cyour-function-name\u003e\n```\n\nThis will create a folder with the name of your function inside the `functions` directory.\n\n## Install NPM Packages\n\n\u003e You can install any npm package. For this example, we'll install LangChain packages to create a basic RAG pipeline.\n\n### Step 4: Create `import_map.json`\n\nCreate a file named `import_map.json` in your `functions` folder and add the following JSON block:\n\n```json\n{\n  \"imports\": {\n    \"@supabase/supabase-js\": \"npm:@supabase/supabase-js@2.43.1\",\n    \"langchain/\": \"https://esm.sh/langchain@0.2.0/\",\n    \"@langchain/openai/\": \"https://esm.sh/@langchain/openai@0.0.28/\",\n    \"@langchain/core/\": \"https://esm.sh/@langchain/core@0.1.62/\",\n    \"@langchain/community/\": \"https://esm.sh/@langchain/community@0.0.56/\"\n  }\n}\n```\n\n### Important Instructions\n\n\u003e If you want to use submodules of an npm package, ensure you add a `/` at the end of the package name. For reference, see the import of `@supabase/supabase-js` and the remaining `langchain` packages.\n\n## Deploy Your Edge Function to Production\n\n\u003e Ensure your project is linked with your Supabase cloud project.\n\nTo deploy your edge function to Supabase, run the following command:\n\n```sh\nnpx supabase functions deploy\n```\n\nThis command will deploy all functions.\n\nTo deploy a specific function, use:\n\n```sh\nnpx supabase functions deploy \u003cfunction-name\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgreathayat%2Fsupabase-edge-functions-rag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgreathayat%2Fsupabase-edge-functions-rag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgreathayat%2Fsupabase-edge-functions-rag/lists"}