{"id":43691,"library":"postgresws.server","title":"postgresws.server","description":"Postgres WebServices server for exposing PostgreSQL databases as web services via REST/WebSocket. Version 0.9.8 is the latest stable. Developed in Dogma and compiled to JavaScript. Suitable for building real-time data APIs directly from Postgres. No active releases since 2019; use at your own risk.","status":"maintenance","version":"0.9.8","language":"javascript","source_language":"en","source_url":null,"tags":["javascript"],"install":[{"cmd":"npm install postgresws.server","lang":"bash","label":"npm"},{"cmd":"yarn add postgresws.server","lang":"bash","label":"yarn"},{"cmd":"pnpm add postgresws.server","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"PostgreSQL client driver for database connections","package":"pg","optional":false},{"reason":"WebSocket server for real-time communication","package":"ws","optional":false},{"reason":"HTTP server framework for REST endpoints","package":"express","optional":false}],"imports":[{"note":"Package is CJS-only. ESM import will fail.","wrong":"import PostgresWS from 'postgresws.server'","symbol":"PostgresWS","correct":"const PostgresWS = require('postgresws.server')"},{"note":"Types are not exported. Use JSDoc or inline configuration.","wrong":"import { ServerOptions } from 'postgresws.server'","symbol":"ServerOptions","correct":"// No type exports; configure via options object"},{"note":"No named exports. Use default or property access.","wrong":"import { createServer } from 'postgresws.server'","symbol":"createServer","correct":"const wsServer = require('postgresws.server').createServer({...})"}],"quickstart":{"code":"const PostgresWS = require('postgresws.server');\n\nconst server = PostgresWS.createServer({\n  httpPort: 3000,\n  wsPort: 3001,\n  db: {\n    host: process.env.PG_HOST || 'localhost',\n    port: parseInt(process.env.PG_PORT) || 5432,\n    user: process.env.PG_USER || 'postgres',\n    password: process.env.PG_PASSWORD || '',\n    database: process.env.PG_DATABASE || 'postgres'\n  },\n  routes: {\n    '/api/users': {\n      query: 'SELECT * FROM users'\n    }\n  }\n});\n\nserver.start(err => {\n  if (err) { console.error(err); process.exit(1); }\n  console.log('PostgresWS server running');\n});","lang":"javascript","description":"Creates a PostgresWS server with HTTP and WebSocket endpoints, configured via environment variables, and starts it."},"warnings":[{"fix":"Evaluate if this package is still suitable. Consider alternatives like PostgREST or Hasura.","message":"No active development since 2019. Security vulnerabilities in dependencies may be unpatched.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use require() instead of import.","message":"Package is CJS-only. ESM imports will throw an error.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Create custom type declarations or use JSDoc comments.","message":"No TypeScript typings available. Type safety is not provided.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Set db config properties explicitly from environment variables in your code.","message":"PostgreSQL connection string must be configured via options object; no environment variable parsing built-in.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Ensure only one WebSocket server is running per port.","message":"WebSocket server may conflict with existing WebSocket libraries if both are used in the same process.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'0.9.8':15 '2019':42 'activ':39 'api':34 'build':29 'compil':24 'data':33 'databas':8 'develop':20 'direct':35 'dogma':22 'expos':6 'javascript':26,48 'latest':18 'postgr':2,37 'postgresql':7 'postgresws.server':1 'real':31 'real-tim':30 'releas':40 'rest/websocket':13 'risk':47 'server':4 'servic':11 'sinc':41 'stabl':19 'suitabl':27 'time':32 'use':43 'version':14 'via':12 'web':10 'webservic':3","created_at":"2026-06-05T17:01:01.331733+00:00","updated_at":"2026-06-05T17:01:01.331733+00:00","problems":[{"fix":"Run 'npm install postgresws.server' and use 'require()' instead of 'import'.","cause":"Package not installed or imported incorrectly (ESM vs CJS).","error":"Error: Cannot find module 'postgresws.server'"},{"fix":"Use 'const PostgresWS = require('postgresws.server');' then 'PostgresWS.createServer()'.","cause":"Incorrect import: using named import instead of default require.","error":"TypeError: PostgresWS.createServer is not a function"},{"fix":"Change port via options or kill the process using the port.","cause":"Port already in use by another process.","error":"Error: listen EADDRINUSE :::3000"},{"fix":"Check database schema and correct the route query.","cause":"SQL query references a table that does not exist.","error":"error: relation \"users\" does not exist"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"http://justo.ws","github":null,"docs":null,"changelog":null,"pypi":null,"npm":"postgresws.server","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-05","next_check":"2026-09-03","install_tag":null}}