{"id":49039481,"url":"https://github.com/pgenie-io/pgenie","last_synced_at":"2026-05-22T00:11:08.932Z","repository":{"id":343483685,"uuid":"1156609891","full_name":"pgenie-io/pgenie","owner":"pgenie-io","description":"Type-safe PostgreSQL client code generator","archived":false,"fork":false,"pushed_at":"2026-04-14T12:53:18.000Z","size":707,"stargazers_count":68,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-04-14T14:26:04.771Z","etag":null,"topics":["cli","compiler","db-first","sql","sql-first"],"latest_commit_sha":null,"homepage":"https://pgenie.io","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pgenie-io.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-12T21:04:04.000Z","updated_at":"2026-04-14T12:21:31.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/pgenie-io/pgenie","commit_stats":null,"previous_names":["pgenie-io/pgenie"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/pgenie-io/pgenie","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgenie-io%2Fpgenie","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgenie-io%2Fpgenie/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgenie-io%2Fpgenie/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgenie-io%2Fpgenie/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pgenie-io","download_url":"https://codeload.github.com/pgenie-io/pgenie/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgenie-io%2Fpgenie/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32009251,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T20:23:30.271Z","status":"online","status_checked_at":"2026-04-19T02:00:07.110Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["cli","compiler","db-first","sql","sql-first"],"created_at":"2026-04-19T14:10:36.058Z","updated_at":"2026-05-22T00:11:08.927Z","avatar_url":"https://github.com/pgenie-io.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pGenie\n\npGenie turns PostgreSQL migrations and parameterized queries into fully typed client code.\n\nYou write plain SQL. pGenie validates it against a real PostgreSQL instance and generates idiomatic, type-safe client libraries for your application.\n\nThis repository contains the source code for the `pgn` CLI tool.\n\n📚 **Full documentation:** [pgenie.io/docs](https://pgenie.io/docs/)\n\n## Quick Start\n\nNew to pGenie? The **[Learn pGenie in Y minutes](https://pgenie.io/docs/tutorials/learn-pgenie-in-y-minutes/)** tutorial gets you up and running fast.\n\nWant to explore a working project right away? Check out the **[demo repository](https://github.com/pgenie-io/demo)** — a ready-to-run project you can clone and experiment with immediately.\n\n## Installation\n\n### From a Binary Distribution\n\nPre-built binaries are available for common platforms. See the **[Installation Guide](https://pgenie.io/docs/guides/installation/)** for instructions.\n\n### Building from Source\n\n#### Prerequisites\n\n- **Docker** *(optional)* — Required only when `--database-url` is **not** provided. pGenie can spin up a temporary PostgreSQL container automatically, but you can skip Docker entirely by pointing it at a running server with `--database-url`.\n- **libpq** — Required for building the Haskell bindings to PostgreSQL. On Debian/Ubuntu, install with `sudo apt-get install libpq-dev`, on macOS with `brew install libpq`.\n\n#### Using Stack\n\n**Stack** is the quickest way to build and install pGenie from source.\n\n1. [Install `Stack`](https://docs.haskellstack.org/en/stable)\n\n2. Clone the repository and build:\n\n```bash\ngit clone https://github.com/pgenie-io/pgenie.git\ncd pgenie\nstack install\n```\n\n#### Using Cabal\n\n**Cabal** is the preferred option for Haskell developers already familiar with the ecosystem:\n\n1. [Install `Cabal`](https://www.haskell.org/cabal/)\n\n2. Clone the repository and build:\n\n```bash\ngit clone https://github.com/pgenie-io/pgenie.git\ncd pgenie\ncabal update\ncabal install\n```\n\n## Using a Running PostgreSQL Server\n\nBy default, `pgn` launches a temporary Docker container for each run. You can skip Docker entirely by supplying a PostgreSQL connection string with `--database-url`:\n\n```bash\npgn --database-url \"postgresql://user:password@localhost:5432/mydb\" analyse\npgn --database-url \"postgresql://user:password@localhost:5432/mydb\" generate\npgn --database-url \"host=localhost port=5432 user=myuser password=mypass dbname=mydb\" manage-indexes\n```\n\nBoth URI format (`postgresql://...`) and libpq keyword=value format are accepted.\n\n\u003e **Security note:** Credentials in command-line arguments may appear in shell history and process listings (e.g., `ps aux`). For production or shared environments, prefer using a [PostgreSQL connection service file](https://www.postgresql.org/docs/current/libpq-pgservice.html) (`~/.pg_service.conf`) or the `PGPASSFILE` / `PGPASSWORD` environment variables so that the URL itself contains no secrets.\n\n### Requirements\n\n- **CREATEDB privilege** — pGenie creates a temporary database on the server for each run and drops it afterwards. The connecting user must hold the `CREATEDB` privilege (or be a superuser).\n- **Version match** — The connected server's major version must match the `postgres` field in your project file (default: 18). If they differ, pGenie reports an error such as:\n\n  ```\n  PostgreSQL server version 16 does not match the project target version 18\n  ```\n\n  Fix this by either updating `postgres:` in `project1.pgn.yaml` to match your running server, or connecting to a server with the correct major version.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpgenie-io%2Fpgenie","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpgenie-io%2Fpgenie","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpgenie-io%2Fpgenie/lists"}