{"id":19390902,"url":"https://github.com/kysely-org/kysely-postgres-js","last_synced_at":"2025-04-09T21:17:37.818Z","repository":{"id":153862036,"uuid":"625368721","full_name":"kysely-org/kysely-postgres-js","owner":"kysely-org","description":"Kysely dialect for PostgreSQL using the Postgres.js client.","archived":false,"fork":false,"pushed_at":"2025-04-08T22:45:04.000Z","size":616,"stargazers_count":78,"open_issues_count":3,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-09T21:17:30.912Z","etag":null,"topics":["dialect","kysely","postgres","postgresql","query-builder","sql","type-safety","typescript"],"latest_commit_sha":null,"homepage":"","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/kysely-org.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2023-04-08T22:33:09.000Z","updated_at":"2025-04-08T22:43:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"4ef1ded6-9ea8-44cf-8ab2-ee3bc7353ec3","html_url":"https://github.com/kysely-org/kysely-postgres-js","commit_stats":null,"previous_names":["igalklebanov/kysely-postgres-js"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kysely-org%2Fkysely-postgres-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kysely-org%2Fkysely-postgres-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kysely-org%2Fkysely-postgres-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kysely-org%2Fkysely-postgres-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kysely-org","download_url":"https://codeload.github.com/kysely-org/kysely-postgres-js/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248111973,"owners_count":21049578,"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","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":["dialect","kysely","postgres","postgresql","query-builder","sql","type-safety","typescript"],"created_at":"2024-11-10T10:23:54.419Z","updated_at":"2025-04-09T21:17:37.782Z","avatar_url":"https://github.com/kysely-org.png","language":"TypeScript","funding_links":[],"categories":["Projects by main language"],"sub_categories":["typescript"],"readme":"# kysely-postgres-js\n\n![Powered by TypeScript](https://img.shields.io/badge/powered%20by-typescript-blue.svg)\n\n[Kysely](https://github.com/koskimas/kysely) dialect for [PostgreSQL](https://www.postgresql.org/) using the [Postgres.js](https://github.com/porsager/postgres) client library under the hood (version \u003e= 3.4).\n\nThis dialect should not be confused with Kysely's built-in PostgreSQL dialect, which uses the [pg](https://github.com/brianc/node-postgres) client library instead.\n\n## Installation\n\n#### NPM 7+\n\n```bash\nnpm i kysely-postgres-js\n```\n\n#### NPM \u003c7\n\n```bash\nnpm i kysely-postgres-js kysely postgres\n```\n\n#### Yarn\n\n```bash\nyarn add kysely-postgres-js kysely postgres\n```\n\n#### PNPM\n\n```bash\npnpm add kysely-postgres-js kysely postgres\n```\n\n### Deno\n\nThis package uses/extends some [Kysely](https://github.com/koskimas/kysely) types and classes, which are imported using its NPM package name -- not a relative file path or CDN url. It also uses [Postgres.js] which is imported using its NPM package name -- not a relative file path or CDN url.\n\nTo fix that, add an [`import_map.json`](https://deno.land/manual@v1.26.1/linking_to_external_code/import_maps) file.\n\n```json\n{\n  \"imports\": {\n    \"kysely\": \"https://cdn.jsdelivr.net/npm/kysely@0.27.2/dist/esm/index.js\",\n    \"postgres\": \"https://deno.land/x/postgresjs@v3.4.3/mod.js\"\n  }\n}\n```\n\n## Usage\n\n```ts\nimport {type GeneratedAlways, Kysely} from 'kysely'\nimport {PostgresJSDialect} from 'kysely-postgres-js'\nimport postgres from 'postgres'\n\ninterface Database {\n  person: {\n    id: GeneratedAlways\u003cnumber\u003e\n    first_name: string | null\n    last_name: string | null\n    age: number\n  }\n}\n\nconst db = new Kysely\u003cDatabase\u003e({\n  dialect: new PostgresJSDialect({\n    postgres: postgres({\n      database: 'test',\n      host: 'localhost',\n      max: 10,\n      port: 5434,\n      user: 'admin',\n    }),\n  }),\n})\n```\n\n## License\n\nMIT License, see `LICENSE`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkysely-org%2Fkysely-postgres-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkysely-org%2Fkysely-postgres-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkysely-org%2Fkysely-postgres-js/lists"}