{"id":21769448,"url":"https://github.com/prostgles/prostgles-server-js","last_synced_at":"2026-03-02T22:13:22.731Z","repository":{"id":38379421,"uuid":"276640764","full_name":"prostgles/prostgles-server-js","owner":"prostgles","description":"Isomorphic TypeScript Client for Postgres. Realtime data, access control, file storage","archived":false,"fork":false,"pushed_at":"2025-04-09T17:29:45.000Z","size":37766,"stargazers_count":34,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-09T18:16:39.109Z","etag":null,"topics":["javascript","nodejs","pg-promise","postgresql","socketio","typescript"],"latest_commit_sha":null,"homepage":"https://prostgles.com","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/prostgles.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":"2020-07-02T12:30:12.000Z","updated_at":"2025-04-09T17:29:49.000Z","dependencies_parsed_at":"2024-05-09T08:38:46.508Z","dependency_job_id":"79d823d1-821f-4181-9f84-d06f07557f3c","html_url":"https://github.com/prostgles/prostgles-server-js","commit_stats":{"total_commits":1341,"total_committers":4,"mean_commits":335.25,"dds":"0.029082774049216997","last_synced_commit":"237e8df272cecad5a72113e2b2b5a3e6560f0229"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prostgles%2Fprostgles-server-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prostgles%2Fprostgles-server-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prostgles%2Fprostgles-server-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prostgles%2Fprostgles-server-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prostgles","download_url":"https://codeload.github.com/prostgles/prostgles-server-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248085323,"owners_count":21045139,"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":["javascript","nodejs","pg-promise","postgresql","socketio","typescript"],"created_at":"2024-11-26T14:08:50.630Z","updated_at":"2026-03-02T22:13:22.714Z","avatar_url":"https://github.com/prostgles.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# prostgles-server\n\nIsomorphic PostgreSQL client for [node](http://nodejs.org)\n\n[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/prostgles/prostgles-server-js/blob/master/LICENSE)\n[![npm version](https://img.shields.io/npm/v/prostgles-server.svg?style=flat)](https://www.npmjs.com/package/prostgles-server)\n![Tests](https://github.com/prostgles/prostgles-server-js/actions/workflows/main.yml/badge.svg)\n\n### New: JSONB schema runtime validation and TS types\n\n\u003cimg src=\"https://prostgles.com/tsdef2.png\" width=\"600px\" style=\"max-width: 90vw; \" /\u003e\n\n## Features\n\n- CRUD operations with end-to-end type safety\n- Auto-Generated TypeScript Definition for Database schema\n- Subscriptions to data and schema changes\n- Fine grained access control\n- Optimistic data replication\n\n## Installation\n\n```bash\n$ npm install prostgles-server\n```\n\n## Quick start\n\n```typescript\nimport prostgles from \"prostgles-server\";\n\nprostgles({\n  dbConnection: {\n    host: \"localhost\",\n    port: \"5432\",\n    user: process.env.PG_USER,\n    password: process.env.PG_PASS,\n  },\n  tsGeneratedTypesDir: __dirname,\n  onReady: async ({ dbo }) =\u003e {\n    const posts = await dbo.posts.find(\n      { title: { $ilike: \"%car%\" } },\n      {\n        orderBy: { created: -1 },\n        limit: 10,\n      },\n    );\n  },\n});\n```\n\n## Server-Client usage\n\nserver.js\n\n```js\nconst express = require(\"express\");\nconst app = express();\nconst path = require(\"path\");\nvar http = require(\"http\").createServer(app);\nvar io = require(\"socket.io\")(http);\nhttp.listen(3000);\n\nlet prostgles = require(\"prostgles-server\");\n\nprostgles({\n  dbConnection: {\n    host: \"localhost\",\n    port: \"5432\",\n    user: process.env.PRGL_USER,\n    password: process.env.PRGL_PWD,\n  },\n  io,\n  publish: \"*\", // Unrestricted INSERT/SELECT/UPDATE/DELETE access to the tables in the database\n  onReady: async ({ dbo }) =\u003e {},\n});\n```\n\nreact.tsx\n\n```jsx\nconst App = () =\u003e {\n  const { isLoading, dbo } = useProstglesClient();\n  if (isLoading) return null;\n  return \u003c\u003eDatabase tables: {Object.keys(dbo)}\u003c/\u003e;\n};\n```\n\n./public/index.html\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003ctitle\u003eProstgles\u003c/title\u003e\n\n    \u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1\" /\u003e\n    \u003cscript\n      src=\"https://unpkg.com/socket.io-client@latest/dist/socket.io.min.js\"\n      type=\"text/javascript\"\n    \u003e\u003c/script\u003e\n    \u003cscript\n      src=\"https://unpkg.com/prostgles-client@latest/dist/index.js\"\n      type=\"text/javascript\"\n    \u003e\u003c/script\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n    \u003cscript\u003e\n      prostgles({\n        socket: io(),\n        onReady: async ({ dbo, dbsMethods, schemaTables, auth }) =\u003e {},\n      });\n    \u003c/script\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprostgles%2Fprostgles-server-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprostgles%2Fprostgles-server-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprostgles%2Fprostgles-server-js/lists"}