{"id":43705127,"url":"https://github.com/zeropaper/dupachain","last_synced_at":"2026-02-05T05:39:32.636Z","repository":{"id":209989436,"uuid":"725247696","full_name":"zeropaper/dupachain","owner":"zeropaper","description":"A supabase + langchain R.A.G. stack scratchpad","archived":false,"fork":false,"pushed_at":"2024-03-09T18:10:27.000Z","size":4186,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-04-14T09:11:37.871Z","etag":null,"topics":["langchain-js","openai-api","rag","socket-io","supabase"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":false,"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/zeropaper.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}},"created_at":"2023-11-29T18:42:31.000Z","updated_at":"2023-12-06T08:00:56.000Z","dependencies_parsed_at":"2024-01-04T09:40:20.470Z","dependency_job_id":"fc07bf9e-a386-48e6-a428-f80215bb4f83","html_url":"https://github.com/zeropaper/dupachain","commit_stats":null,"previous_names":["zeropaper/dupachain"],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/zeropaper/dupachain","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeropaper%2Fdupachain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeropaper%2Fdupachain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeropaper%2Fdupachain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeropaper%2Fdupachain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zeropaper","download_url":"https://codeload.github.com/zeropaper/dupachain/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeropaper%2Fdupachain/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29113891,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-05T05:31:32.482Z","status":"ssl_error","status_checked_at":"2026-02-05T05:31:29.075Z","response_time":65,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["langchain-js","openai-api","rag","socket-io","supabase"],"created_at":"2026-02-05T05:39:32.028Z","updated_at":"2026-02-05T05:39:32.629Z","avatar_url":"https://github.com/zeropaper.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Supabase - LangChain playground\n\nThis is a playground for [supabase](https://supabase.com)d\n[LangChain](https://js.langchain.com/docs/get_started/introduction) project.\n\nIts aim is to provide some structure and a starting point for the project by putting together\na stack of open-source tools that can help developing LangChain chains, tools and apps.\nIt considers the usual deterministic approach of engineering and tries to provide a set of tools\nthat allow assessing the quality of the chain and its tools.\n\nOne of the goals is to provide a lightweight Web Socket server that can handle chats with an AI based agent.\nThe other goal is to provide a way to evaluate the quality of the AI agent and the chain with variety of settings\nand spot weaknesses in development stages.\n\n[![Made with Supabase](https://supabase.com/badge-made-with-supabase.svg)](https://supabase.com)\n\n## Work in progress\n\nThis is an early stage prototype and there are a lot of things that are not yet ideal.\n\n### TODOs\n\nThe code contains a lot of `TODO`s that need attention.\n\n### Bigger changes\n\n- figure a way to render the \"eval\" results in a more readable way\n- deeper integration with langfuse (user feedback / scores) and supabase (langchain caching / memory)\n- add options to the eval files to allow for more flexibility\n- re-organize code scaffolding to allow better sharing of types\n\n## Prerequisites\n\n### Node\n\n- `node`: install using [NVM](https://github.com/nvm-sh/nvm/blob/master/README.md#installing-and-updating)\n  (`nvm install 20 \u0026\u0026 nvm use 20`)\n- `pnpm`: is the package manager that is used in this project, install with `npm i -g pnpm`\n\n### Supabase\n\nIn order to run supabase locally, you also need to ensure\n[their prerequisites are met](https://github.com/supabase/supabase/blob/master/DEVELOPERS.md#local-development).\n\n### Langfuse\n\nIs used log LLM and chat model calls. You can run it locally or use their hosted version.\nThe integration is done through the\n[`langfuse-langchain` package](https://langfuse.com/docs/langchain/typescript).\n\n## Setup\n\n1. `pnpm i` to install the dependencies\n1. `pnpm sb:start` to start the Supabase DB\n1. `pnpm sb:db:reset` this will:\n   1. import the base SQL files from [`./supbabase/migrations`](./supbabase/migrations)\n   1. import the [`./supbabase/seed.sql`](./supbabase/seed.sql)\n   1. generate the TypeScript types based on the DB schema  \n      (and put them in the [`@local/supabase-types`](./packages/supabase-types))\n1. Enable the \"realtime\" feature on the `chat_messages` table (see below)\n1. `pnpm dev` will run the [\"gateway\" app](./apps/gateway) in \"dev\" mode\n\n**Notes:**\n\n- Everytime you use the `pnpm sb:db:reset` script, you will need to enable the \"realtime\"\n  feature of the `chat_messages` table  \n  ![image](https://github.com/zeropaper/dupachain/assets/65971/a650efe4-233d-4d77-8cf2-8eb3e4d4240d)\n\n### Environment variables\n\nYou will need to create a `.env` in the root directory and should look like:\n\n```txt\nOPENAI_API_KEY=\u003cno i'm not giving you mine\u003e\n\n# get the values from running `npm supabase status`\nSUPABASE_URL=\u003cusually: http://127.0.0.1:54321\u003e\nSUPABASE_ANON_KEY=\u003cthe anon key\u003e\nSUPABASE_SERVICE_ROLE_KEY=\u003cthe service key\u003e\n\nLANGFUSE_BASE_URL=http://localhost:8000\nLANGFUSE_PUBLIC_KEY=\u003cstarts with pk-lf-\u003e\nLANGFUSE_SECRET_KEY=\u003cstarts with sk-lf-\u003e\n\nCORS_ORIGINS=http://localhost:3030,http://localhost:5173\n```\n\n**Note:** if you are using the `.env` with Docker (see below), you will need to\nensure that the values are NOT quoted.\n\n## Structure\n\n### Gateway app\n\nThe \"server\" part of the project and the stuff you may want to make public\nis in the [\"gateway\" app](./apps/gateway) directory.\n\nIt is made of a very simple [ExpressJS](https://expressjs.com/) server that\nutilizes [supabase-js](https://www.npmjs.com/package/@supabase/supabase-js)\nand [socket.io](https://www.npmjs.com/package/socket.io) to provide an\nAPI for realtime communication.\n\nThe most interesting bits are probably located in the\n[`answerUser.ts`](./apps/gateway/src/chats/answerUser.ts) file and the\n[POST `/api/documents` handler](./apps/gateway/src/createAPIRouter.ts).\n\nThe \"ingestion\" of the content is done by sending \"POST\" requests to the\n`/api/documents` endpoint. The body of the request should be a JSON object with\nthe following structure:\n\n```json\n{\n  \"content\": \"The content of the document\",\n  \"reference\": \"A unique identifier for the document\",\n  \"metadata\": { \"whatever\": \"you want\" },\n  \"format\": \"html\" // or \"markdown\"\n}\n```\n\n### Local chat\n\nYou can chat locally with the \"gateway\" app by running the\nthe `dev` npm script of the `@local/ui` package with `pnpm -C packages/ui dev`\n(if you are in the root directory).\n\nYou will also need to run the `pnpm -C dev` script in the \"gateway\" app.\n\n### Evaluations\n\nIn order to evaluate the quality of a chat agent, you can run\n[default.evalsconfig.yml file](./apps/gateway/default.evalsconfig.yml) in the app directory.\n\nYou can run the script with `pnpm eval`.\n\n## Docker\n\n### Build\n\n```sh\nDOCKER_BUILDKIT=1 docker build . --target gateway --tag gateway:latest\n```\n\n### Run\n\n```sh\ndocker run -it \\\n-p 3050:3040 \\\n--env-file .env \\\n-e SUPABASE_URL=\"http://host.docker.internal:54321\" \\\ndocker.io/library/gateway:latest\n```\n\nhttp://localhost:3050\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzeropaper%2Fdupachain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzeropaper%2Fdupachain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzeropaper%2Fdupachain/lists"}