{"id":20913798,"url":"https://github.com/danielivanovz/postez","last_synced_at":"2025-10-14T23:05:22.053Z","repository":{"id":42451924,"uuid":"466468786","full_name":"danielivanovz/postez","owner":"danielivanovz","description":"Utility package for dynamically generate interfaces from PostgreSQL","archived":false,"fork":false,"pushed_at":"2023-01-10T15:33:23.000Z","size":211,"stargazers_count":2,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-18T09:27:59.798Z","etag":null,"topics":["automation","interfaces","postgresql","types","typescript"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/danielivanovz.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}},"created_at":"2022-03-05T13:59:03.000Z","updated_at":"2025-03-08T22:08:15.000Z","dependencies_parsed_at":"2023-02-08T19:16:06.202Z","dependency_job_id":null,"html_url":"https://github.com/danielivanovz/postez","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielivanovz%2Fpostez","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielivanovz%2Fpostez/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielivanovz%2Fpostez/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielivanovz%2Fpostez/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danielivanovz","download_url":"https://codeload.github.com/danielivanovz/postez/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253913060,"owners_count":21983249,"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":["automation","interfaces","postgresql","types","typescript"],"created_at":"2024-11-18T15:07:56.749Z","updated_at":"2025-10-14T23:05:17.034Z","avatar_url":"https://github.com/danielivanovz.png","language":"JavaScript","readme":"\u003ch1 align=\"center\"\u003epostez\u003c/h1\u003e\n\u003ch6 align=\"center\"\u003eUtility tool for dynamically generate interfaces and types from PostgreSQL using custom schema.\u003c/h5\u003e\n\u003cbr\u003e\n\n## Usage\nDefine a types schema as \n```ts\ntypesSchema = {\n 'string': [ 'bpchar', 'char', 'varchar', 'text', 'citext', 'uuid' ],\n 'number': ['int2', 'int4', 'int8', 'float4', 'float8', 'numeric' ],\n 'boolean': ['bool', 'boolean'],\n 'Date': ['date', 'timestamp', 'timestamptz'],\n 'Array\u003cnumber\u003e': ['_int2', '_int4', '_int8', '_float4', '_float8', '_numeric', '_money'],\n 'Array\u003cboolean\u003e': ['_bool', '_boolean'],\n 'Array\u003cstring\u003e': ['_varchar', '_text', '_citext', '_uuid', '_bytea'],\n 'Object': ['json', 'jsonb'],\n 'Array\u003cObject\u003e': ['_json', '_jsonb'],\n 'Array\u003cDate\u003e': ['_timestamptz'],\n 'CustomTypes': [\n  {\n   name: 'point',\n   type: 'Coordinates',\n   definition: 'export interface Coordinates { x: number; y: number; }',\n  },\n ],\n}\n```\n\nthen just pass it as an argument with a database connection and output path. \n\n``` ts\npostez(db, path, typesSchema)\n  .then(() =\u003e console.log(\"Done.\"))\n  .catch((e) =\u003e console.error(e));\n```\n\nYou can also specify the name of table schema you want to generate types.ts.\n\n``` ts\npostez(db, path, typesSchema, 'schema_name')\n  .then(() =\u003e console.log(\"Done.\"))\n  .catch((e) =\u003e console.error(e));\n```\n\nOtherwise you can use a default types schema (table schema name is 'public' by default if not specified) and `pg-promise` as simple as:\n\n``` ts\nimport pg from 'postez/lib/db'\nimport { postez } from \"postez\";\n\nconst configuration = {\n\tuser: 'username',\n\tpassword: 'password',\n\thost: 'host',\n\tport: 'port',\n\tdatabase: 'database'\n}\n\nconst db = pg.db(configuration)\nconst path = process.cwd().replace('./dist', './output');\n\npostez(db, path)\n  .then(() =\u003e console.log(\"Done.\"))\n  .catch((e) =\u003e console.error(e));\n```\n\non successfull run it will prompt out the following:\n\n```\nSuccesfully generated files in: \u003cpath\u003e/output/types.ts\n```\n\n## Todo\n\n- add CLI usage\n\n## License\n\nDistributed under the MIT License. See `LICENSE` for more information.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielivanovz%2Fpostez","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielivanovz%2Fpostez","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielivanovz%2Fpostez/lists"}