{"id":19666768,"url":"https://github.com/herrmannplatz/fastify-postgresjs","last_synced_at":"2025-04-28T22:31:55.904Z","repository":{"id":40289866,"uuid":"237781644","full_name":"herrmannplatz/fastify-postgresjs","owner":"herrmannplatz","description":"Fastify postgres.js plugin","archived":false,"fork":false,"pushed_at":"2023-01-05T06:17:32.000Z","size":2516,"stargazers_count":5,"open_issues_count":22,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-19T16:02:14.574Z","etag":null,"topics":["database","fastify-plugin","postgresql"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/fastify-postgresjs","language":"JavaScript","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/herrmannplatz.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}},"created_at":"2020-02-02T14:15:35.000Z","updated_at":"2023-03-04T05:35:55.000Z","dependencies_parsed_at":"2023-02-03T15:16:49.615Z","dependency_job_id":null,"html_url":"https://github.com/herrmannplatz/fastify-postgresjs","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/herrmannplatz%2Ffastify-postgresjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/herrmannplatz%2Ffastify-postgresjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/herrmannplatz%2Ffastify-postgresjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/herrmannplatz%2Ffastify-postgresjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/herrmannplatz","download_url":"https://codeload.github.com/herrmannplatz/fastify-postgresjs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251397657,"owners_count":21583050,"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":["database","fastify-plugin","postgresql"],"created_at":"2024-11-11T16:28:56.352Z","updated_at":"2025-04-28T22:31:50.874Z","avatar_url":"https://github.com/herrmannplatz.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fastify-postgresjs\n\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](http://standardjs.com/) [![Build Status](https://travis-ci.org/fastify/fastify-postgres.svg?branch=master)](https://travis-ci.org/herrmannplatz/fastify-postgresjs)\n\nFastify PostgreSQL connection plugin, based on [postgres](https://github.com/porsager/postgres).\n\n## Install\n\n```\nnpm i postgres fastify-postgresjs --save\n```\n\n## Usage\n\nAdd it to you project with `register` and you are done!\nThis plugin will add the `sql` namespace in your Fastify instance.\n\nExample:\n\n```js\nconst fastify = require('fastify')()\n\nconst url = 'postgres://postgres@localhost/postgres'\n\nconst options = { /* postgres.js options */ }\n\nfastify.register(require('fastify-postgresjs'), {\n  url, ...options\n})\n\nfastify.get('/users/:id', async (req, reply) =\u003e {\n  const users = await fastify.sql`\n    select * from users\n    where id = ${req.params.id}\n  `\n  return users\n})\n\nfastify.listen(3000, err =\u003e {\n  if (err) throw err\n  console.log(`server listening on ${fastify.server.address().port}`)\n})\n```\n\n## Development and Testing\n\nFirst, start postgres with:\n\n```\n$ docker run --rm -d -p 5432:5432 --name fastify-postgresjs postgres:11-alpine\n```\n\nRun the tests.\n\n```\n$ npm test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fherrmannplatz%2Ffastify-postgresjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fherrmannplatz%2Ffastify-postgresjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fherrmannplatz%2Ffastify-postgresjs/lists"}