{"id":14968989,"url":"https://github.com/sandromaglione/supabase-ts","last_synced_at":"2026-02-11T16:33:25.599Z","repository":{"id":45926425,"uuid":"407540922","full_name":"SandroMaglione/supabase-ts","owner":"SandroMaglione","description":"Use supabase with Functional Programming and fp-ts","archived":false,"fork":false,"pushed_at":"2021-11-27T15:54:50.000Z","size":223,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-09T16:51:37.034Z","etag":null,"topics":["fp-ts","functional-programming","io-ts","javascript","supabase","supabase-js","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/supabase-ts","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SandroMaglione.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-09-17T12:57:38.000Z","updated_at":"2023-12-01T06:20:47.000Z","dependencies_parsed_at":"2022-08-30T16:11:40.692Z","dependency_job_id":null,"html_url":"https://github.com/SandroMaglione/supabase-ts","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/SandroMaglione/supabase-ts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SandroMaglione%2Fsupabase-ts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SandroMaglione%2Fsupabase-ts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SandroMaglione%2Fsupabase-ts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SandroMaglione%2Fsupabase-ts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SandroMaglione","download_url":"https://codeload.github.com/SandroMaglione/supabase-ts/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SandroMaglione%2Fsupabase-ts/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271746658,"owners_count":24813575,"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-08-23T02:00:09.327Z","response_time":69,"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":["fp-ts","functional-programming","io-ts","javascript","supabase","supabase-js","typescript"],"created_at":"2024-09-24T13:40:54.937Z","updated_at":"2026-02-11T16:33:25.545Z","avatar_url":"https://github.com/SandroMaglione.png","language":"TypeScript","funding_links":["https://www.buymeacoffee.com/sandromaglione","https://shields.io/badge/sandromaglione-Support--me-FFDD00?logo=buy-me-a-coffee\u0026style=for-the-badge\u0026link=https://www.buymeacoffee.com/sandromaglione"],"categories":[],"sub_categories":[],"readme":"# `supabase-ts`\n\n\u003cp\u003e\n  \u003ca href=\"https://github.com/SandroMaglione/supabase-ts\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/stars/SandroMaglione/supabase-ts?logo=github\" /\u003e\n  \u003c/a\u003e\n  \u003cimg src=\"https://img.shields.io/github/repo-size/SandroMaglione/supabase-ts\" /\u003e\n  \u003cimg src=\"https://img.shields.io/github/license/SandroMaglione/supabase-ts?logo=github\" /\u003e\n  \u003cimg src=\"https://img.shields.io/github/contributors-anon/SandroMaglione/supabase-ts\" /\u003e\n  \u003ca href=\"https://github.com/SandroMaglione\"\u003e\n    \u003cimg alt=\"GitHub: SandroMaglione\" src=\"https://img.shields.io/github/followers/SandroMaglione?label=Follow\u0026style=social\" target=\"_blank\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://twitter.com/SandroMaglione\"\u003e\n    \u003cimg alt=\"Twitter: SandroMaglione\" src=\"https://img.shields.io/twitter/follow/SandroMaglione.svg?style=social\" target=\"_blank\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003ca href=\"https://www.buymeacoffee.com/sandromaglione\"\u003e\n    \u003cimg src=\"https://shields.io/badge/sandromaglione-Support--me-FFDD00?logo=buy-me-a-coffee\u0026style=for-the-badge\u0026link=https://www.buymeacoffee.com/sandromaglione\" /\u003e\n\u003c/a\u003e\n\nWhat happens when the type of the response from a supabase request is different from expected? We don't want our app to crash, do we? \n\nWelcome `supabase-ts`!\n\nMake request to [supabase](https://supabase.io/) using the power of [fp-ts](https://gcanti.github.io/fp-ts/), [io-ts](https://gcanti.github.io/io-ts/), and parsing.\n\nUse [supabase](https://supabase.io/) with Functional Programming and [fp-ts](https://gcanti.github.io/fp-ts/).\n\n## Getting started\n\n```shell\nnpm install supabase-ts\n```\n\nExtend your usual `SupabaseClient` using `createClientIO` from `supabase-ts`.\n\n`createClientIO` accepts two generic types:\n- A union of `string` with the names of all the tables/views of your database. `supabase-ts` will enforce the correct table names, no more typos!\n- The default request error type\n\n```ts\nimport { createClient } from '@supabase/supabase-js';\nimport { createClientIO } from 'supabase-ts';\n\n// Enforce tables and views names\ntype SupabaseTable = 'table1' | 'table2';\ntype SupabaseView = 'view1' | 'view2';\n\n// Define default request error type\ntype ErrorMessage = string;\n\nconst supabaseClient = createClient('URL', 'KEY');\nexport const supabase = createClientIO\u003cSupabaseTable | SupabaseView, ErrorMessage\u003e(supabaseClient);\n\n```\n\nUse the exported `supabase` client to perform requests:\n- `requestListWithValidation`: Perform a request to supabase and return a list of values.\n- `requestSingleWithValidation`: Perform a request to supabase and return a single value.\n\nFor every request you must provide an [`io-ts`](https://github.com/gcanti/io-ts) type used to validate the response from supabase. `supabase-ts` will make sure that the shape of the return data respects the defined schema from `io-ts`.\n\n```ts\nconst schema = t.type({ name: t.string });\ntype Schema = t.TypeOf\u003ctypeof schema\u003e;\nconst tableValidated = {\n  name: 'table1', // Required to be `string` from `SupabaseTable | SupabaseView`!\n  schema,\n} as const; // Required to be `const` for type-safety\n\nconst responseList: TE.TaskEither\u003cstring, readonly Schema[]\u003e =\n  supabaseClientIO.requestListWithValidation(tableValidated)(\n    (query) =\u003e query.select(),\n    {\n      // Handle all possible errors\n      onNoDataError: () =\u003e '',\n      onRequestError: () =\u003e '',\n      onValidationError: () =\u003e '',\n    }\n  );\n\nconst responseSingle: TE.TaskEither\u003cstring, Schema\u003e =\n  supabaseClientIO.requestSingleWithValidation(tableValidated)(\n    (query) =\u003e query.select(),\n    {\n      // Handle all possible errors\n      onZeroData: () =\u003e '',\n      onNoDataError: () =\u003e '',\n      onRequestError: () =\u003e '',\n      onValidationError: () =\u003e '',\n    }\n  );\n```\n\n\n## 📃 Versioning\n\n- `v0.2.1` - 27 November 2021\n- `v0.1.3` - 24 September 2021\n- `v0.1.2` - 18 September 2021\n- `v0.1.1` - 17 September 2021\n- `v0.1.0` - 17 September 2021\n\n## 😀 Support\n\nCurrently the best way to support me would be to follow me on my [**Twitter**](https://twitter.com/SandroMaglione).\n\nAnother option (or `Option`) would be to buy me a coffee.\n\n\u003ca href=\"https://www.buymeacoffee.com/sandromaglione\"\u003e\n\u003cimg src=\"https://shields.io/badge/sandromaglione-Support--me-FFDD00?logo=buy-me-a-coffee\u0026style=for-the-badge\u0026link=https://www.buymeacoffee.com/sandromaglione\" /\u003e\n\u003c/a\u003e\n\n## 👀 License\n\nMIT License, see the [LICENSE.md](https://github.com/SandroMaglione/supabase-ts/blob/main/LICENSE) file for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsandromaglione%2Fsupabase-ts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsandromaglione%2Fsupabase-ts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsandromaglione%2Fsupabase-ts/lists"}