{"id":42602,"library":"db-seeder-postgres","title":"db-seeder-postgres","description":"A lightweight PostgreSQL seeding server designed for E2E tests, version 0.2.0. It runs as an HTTP server that auto-generates REST endpoints for each database table, allowing tests to seed or truncate data via POST requests. Integrates easily with Cypress and Playwright. Requires an existing database schema. Can be deployed via Docker compose or npm. No CLI or programmatic API beyond the HTTP server.","status":"active","version":"0.2.0","language":"javascript","source_language":"en","source_url":"https://github.com/hammerpath/db-seeder","tags":["javascript","postgres","seed","database","testing","e2e","integration","playwright","cypress"],"install":[{"cmd":"npm install db-seeder-postgres","lang":"bash","label":"npm"},{"cmd":"yarn add db-seeder-postgres","lang":"bash","label":"yarn"},{"cmd":"pnpm add db-seeder-postgres","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The package provides a CLI binary, not a JavaScript module. Use via npm script or npx.","wrong":"import { something } from 'db-seeder-postgres'","symbol":"db-seeder-postgres (server process)","correct":"script: 'db-seeder-postgres run' in package.json, then run with npm"},{"note":"Only POST method is supported for seeding.","wrong":"GET or PUT request","symbol":"HTTP endpoint (seed)","correct":"POST http://localhost:3000/seed/{tableName} with JSON body"},{"note":"Truncation is also via POST, with optional query params.","wrong":"GET /truncate or DELETE request","symbol":"HTTP endpoint (truncate)","correct":"POST http://localhost:3000/truncate/{tableName} or /truncate"}],"quickstart":{"code":"// Ensure PostgreSQL is running and tables exist\n// Start the seeder server via Docker compose or npm script\n// Then in your test:\nconst baseUrl = 'http://localhost:3000';\n\n// Seed table 'users' with two rows\nconst users = [\n  { id: 1, name: 'John Doe' },\n  { id: 2, name: 'Jane Doe' }\n];\n\n// Using Cypress\ncy.request('POST', `${baseUrl}/seed/users`, users);\n\n// Using Playwright\nawait request.post(`${baseUrl}/seed/users`, { data: users });\n\n// Truncate table 'users'\ncy.request('POST', `${baseUrl}/truncate/users`);\n\n// Truncate all tables\nawait request.post(`${baseUrl}/truncate`);","lang":"typescript","description":"Shows seeding and truncating a PostgreSQL table via HTTP POST using Cypress or Playwright."},"warnings":[{"fix":"Initialize database schema via SQL migration or entrypoint script before starting the seeder.","message":"Table must exist before seeding; the server does not create tables.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Use POST requests with the appropriate JSON body.","message":"Only POST method is supported for seeding and truncation – GET, PUT, DELETE are not implemented.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Ensure all four variables are available to the server process.","message":"Environment variables POSTGRES_HOST, POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DB must be set, or the server will fail to connect.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Pass query parameter ?noCascade=true if you do not want cascading truncation.","message":"Truncate with CASCADE by default; use ?noCascade=true to avoid cascading.","severity":"gotcha","affected_versions":">=0.2.0"}],"env_vars":null,"search_vec":"'0.2.0':15 'allow':32 'api':65 'auto':24 'auto-gener':23 'beyond':66 'cli':62 'compos':58 'cypress':45,78 'data':38 'databas':30,51,73 'db':2 'db-seeder-postgr':1 'deploy':55 'design':10 'docker':57 'e2e':12,75 'easili':43 'endpoint':27 'exist':50 'generat':25 'http':20,68 'integr':42,76 'javascript':70 'lightweight':6 'npm':60 'playwright':47,77 'post':40 'postgr':4,71 'postgresql':7 'programmat':64 'request':41 'requir':48 'rest':26 'run':17 'schema':52 'seed':8,35,72 'seeder':3 'server':9,21,69 'tabl':31 'test':13,33,74 'truncat':37 'version':14 'via':39,56","created_at":"2026-06-05T16:55:46.653545+00:00","updated_at":"2026-06-05T16:55:46.653545+00:00","problems":[{"fix":"Start the server with `npm run db-seeder` or via Docker compose, ensure port 3000 is exposed and accessible.","cause":"Database seeder server not running or wrong port.","error":"Error: connect ECONNREFUSED 127.0.0.1:3000"},{"fix":"Create the table via SQL before starting the seeder, e.g., by adding an init SQL script to Docker entrypoint.","cause":"Table 'users' does not exist in the target database.","error":"error: relation \"users\" does not exist"},{"fix":"Set POSTGRES_PASSWORD in .env file or environment of the seeder container/process.","cause":"POSTGRES_PASSWORD environment variable is missing or incorrect.","error":"error: password authentication failed for user \"postgres\""}],"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":"https://github.com/hammerpath/db-seeder/tree/master/packages/postgres-provider","github":"https://github.com/hammerpath/db-seeder","docs":null,"changelog":null,"pypi":null,"npm":"db-seeder-postgres","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing","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}}