{"id":20879274,"url":"https://github.com/edsol/pg-apify","last_synced_at":"2026-02-15T00:31:38.848Z","repository":{"id":245443174,"uuid":"818260888","full_name":"Edsol/pg-apify","owner":"Edsol","description":" Automatically generate API (REST and GraphQL) endpoints directly from your PostgreSQL schema","archived":false,"fork":false,"pushed_at":"2024-07-05T11:18:54.000Z","size":96,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-05T01:23:30.393Z","etag":null,"topics":["database","graphql","openapi","postgresql","postgrest","rest-api","restapi","zero-coding"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Edsol.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":"2024-06-21T12:56:46.000Z","updated_at":"2024-07-06T09:40:35.000Z","dependencies_parsed_at":"2024-06-22T05:46:41.028Z","dependency_job_id":"ea703eae-15f4-4648-a7ac-620f2a5c09ec","html_url":"https://github.com/Edsol/pg-apify","commit_stats":null,"previous_names":["edsol/pg-apify"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Edsol/pg-apify","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Edsol%2Fpg-apify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Edsol%2Fpg-apify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Edsol%2Fpg-apify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Edsol%2Fpg-apify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Edsol","download_url":"https://codeload.github.com/Edsol/pg-apify/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Edsol%2Fpg-apify/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29461911,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T22:42:09.113Z","status":"ssl_error","status_checked_at":"2026-02-14T22:42:05.053Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","graphql","openapi","postgresql","postgrest","rest-api","restapi","zero-coding"],"created_at":"2024-11-18T07:15:47.489Z","updated_at":"2026-02-15T00:31:38.832Z","avatar_url":"https://github.com/Edsol.png","language":"TypeScript","funding_links":["https://www.buymeacoffee.com/edsol"],"categories":[],"sub_categories":[],"readme":"\u003cimg alt=\"GitHub License\" src=\"https://img.shields.io/github/license/edsol/pg-apify\"\u003e\n\u003cimg alt=\"NPM Version\" src=\"https://img.shields.io/npm/v/pg-apify\"\u003e\n\u003cimg alt=\"npm bundle size\" src=\"https://img.shields.io/bundlephobia/min/pg-apify\"\u003e\n\u003cimg alt=\"NPM Downloads\" src=\"https://img.shields.io/npm/dm/pg-apify\"\u003e\n\n\u003cbr/\u003e\n\n![Postgres](https://img.shields.io/badge/postgres-%23316192.svg?style=for-the-badge\u0026logo=postgresql\u0026logoColor=white)\n![GraphQL](https://img.shields.io/badge/-GraphQL-E10098?style=for-the-badge\u0026logo=graphql\u0026logoColor=white)\n![TypeScript](https://img.shields.io/badge/typescript-%23007ACC.svg?style=for-the-badge\u0026logo=typescript\u0026logoColor=white)\n\n# pg-apify\n\nEffortlessly transform your PostgreSQL database into a powerful REST and GraphQL API server with zero coding required\n\n## Features\n\n- **_Zero Coding Required:_** Instantly generate REST and GraphQL endpoints from your PostgreSQL schema without writing a single line of code.\n- **_Rapid Setup:_** Get your API server up and running in just a few seconds.\n- **_Seamless Integration:_** Easily integrates with your existing PostgreSQL databases, enabling quick and efficient data access.\n- **_Customizable Middleware:_** Enhance your API with custom logic using flexible middleware support.\n- **_Beautiful API:_** Automatically generate comprehensive API documentation using [Scalar](https://github.com/scalar/scalar) to ensure clear and detailed endpoint information.\n\n## Install and requirements\n\ninstall pg-apify:\n\n```bash\nbun install pg-apify\n// or\nnpm install pg-apify\n```\n\nlocal installation of `postgREST` is also required, follow [official wiki](https://postgrest.org/en/v12/explanations/install.html) to install correctly.\n\n## Usage\n\n### Zero-coding\n\ncreates and use `.env` file or passes the configuration directly via parameters and run server\n\n```typescript\nimport { pgApifyServer, postgraphileOptions, postgrestOptions } from \"pg-apify\";\nimport { dev as options } from \"./postgraphileOptions\";\n\nconst postgraphileServerOptions: postgraphileOptions = {\n  enabled: true,\n  databaseUrl: process.env.DATABASE_URL,\n  schema: process.env.PGSCHEMA,\n  options: options,\n};\n\nconst postgrestServerOptions: postgrestOptions = {\n  enabled: true,\n  enableDocs: true,\n};\npgApifyServer(postgraphileServerOptions, postgrestServerOptions);\n```\n\na GraphQL server, RestAPI and OpenAPI documentation will be launched\n\n```bash\n🚀 GraphQL server available at http://localhost:5000/graphql\n🚀 GraphiQL available at http://localhost:5000/graphiql\n📖 API docs is running at http://localhost:3000/docs\n🔥 API is running at http://localhost:3000\n```\n\n### note\n\nThe `postgraphileOptions` file contains the Postgraphile options ([docs](https://www.graphile.org/postgraphile/usage-library/#recommended-options)), see the [example file](example/postgraphileOptions.ts), copy it or create your own custom configuration file.\n\n### Request middleware\n\nintercepts all `GET` requests\n\n```typescript\nrequestHandler.registerHandler(\"get\", async (params, context, info) =\u003e {\n  // your code\n\n  return {\n    success: false,\n    status: 404,\n    message: \"Custom error message\",\n  };\n});\n```\n\nor specific `endpoint`\n\n```typescript\nrequestHandler.registerRouteHandler(\n  \"get\",\n  \"foo\",\n  async (params, context, info) =\u003e {\n    // your code\n\n    return {\n      success: false,\n      status: 404,\n      message: \"Custom error message\",\n    };\n  }\n);\n```\n\n## Under the hood\n\n### PostGraphile\n\npg-apify leverages [PostGraphile](https://github.com/graphile/crystal/tree/main/postgraphile/postgraphile), a powerful tool that automatically generates a GraphQL API from your PostgreSQL schema. PostGraphile inspects your database schema, including tables, columns, relationships, and constraints, and creates a fully-functional GraphQL API. This allows you to take advantage of GraphQL's flexibility and efficiency in querying and mutating data.\n\n### PostgREST\n\nIn addition to GraphQL, pg-apify also utilizes [PostgREST](https://github.com/PostgREST/postgrest), a standalone web server that turns your PostgreSQL database directly into a RESTful API. PostgREST reads the database schema and creates RESTful endpoints that correspond to your tables and views, enabling CRUD operations with ease.\n\n### Scalar\n\nUsing [scalar](https://github.com/scalar/scalar) to generate interactive API documentation from OpenAPI/Swagger documents.\n\n## Do you want to support my work? Buy me an espresso coffee (I'm Italian)\n\n\u003ca href=\"https://www.buymeacoffee.com/edsol\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png\" alt=\"Buy Me A Coffee\" style=\"height: 60px !important;width: 217px !important;\" \u003e\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedsol%2Fpg-apify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fedsol%2Fpg-apify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedsol%2Fpg-apify/lists"}