{"id":14973929,"url":"https://github.com/NpgsqlRest/NpgsqlRest","last_synced_at":"2025-12-30T00:16:25.513Z","repository":{"id":215629061,"uuid":"731971286","full_name":"vb-consulting/NpgsqlRest","owner":"vb-consulting","description":"Automatic REST API for PostgreSQL Database as .NET Middleware","archived":false,"fork":false,"pushed_at":"2025-03-24T17:11:10.000Z","size":2773,"stargazers_count":39,"open_issues_count":0,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-31T06:05:28.739Z","etag":null,"topics":["api","api-rest","automatic","database","dotnet","http","pg","pgsql","postgres","postgresql","rest","restful-api","server"],"latest_commit_sha":null,"homepage":"https://vb-consulting.github.io/npgsqlrest/","language":"C#","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/vb-consulting.png","metadata":{"files":{"readme":"README.md","changelog":"changelog-1.md","contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"patreon":"vbconsulting","buy_me_a_coffee":"vbilopavu"}},"created_at":"2023-12-15T10:14:38.000Z","updated_at":"2025-03-28T08:26:49.000Z","dependencies_parsed_at":"2024-01-15T14:39:16.676Z","dependency_job_id":"78ae3c26-4f54-46d6-8702-2f2ead1bff3c","html_url":"https://github.com/vb-consulting/NpgsqlRest","commit_stats":{"total_commits":262,"total_committers":1,"mean_commits":262.0,"dds":0.0,"last_synced_commit":"91b7271d8217e1ad612a33eb9e5b218bb924e8c8"},"previous_names":["vb-consulting/npgsqlrest"],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vb-consulting%2FNpgsqlRest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vb-consulting%2FNpgsqlRest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vb-consulting%2FNpgsqlRest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vb-consulting%2FNpgsqlRest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vb-consulting","download_url":"https://codeload.github.com/vb-consulting/NpgsqlRest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246423731,"owners_count":20774820,"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":["api","api-rest","automatic","database","dotnet","http","pg","pgsql","postgres","postgresql","rest","restful-api","server"],"created_at":"2024-09-24T13:49:41.743Z","updated_at":"2025-12-30T00:16:25.468Z","avatar_url":"https://github.com/vb-consulting.png","language":"C#","readme":"# NpgsqlRest\n\n[![Build, Test, Publish and Release](https://github.com/vb-consulting/NpgsqlRest/actions/workflows/build-test-publish.yml/badge.svg)](https://github.com/vb-consulting/NpgsqlRest/actions/workflows/build-test-publish.yml)\n![License](https://img.shields.io/badge/license-MIT-green)\n![GitHub Stars](https://img.shields.io/github/stars/vb-consulting/NpgsqlRest?style=social)\n![GitHub Forks](https://img.shields.io/github/forks/vb-consulting/NpgsqlRest?style=social)\n\n**Automatic REST API** for PostgreSQL Databases implemented as **AOT-Ready .NET8/.NET9 Middleware**\n\n\u003e\n\u003e If you have a PostgreSQL database - NpgsqlRest can create **blazing fast REST API automatically** and **write client code** for your project.\n\u003e\n\nFeatures:\n\n- Nuget package for .NET that creates discoverable REST API automatically from PostgreSQL database.\n- **High Performance**. See [Performances Benchmarks](https://github.com/vb-consulting/pg_function_load_tests).\n- **Modular Design** with a Plug-in System. Create API for functions and procedure, create CRUD endpoints for your tables, create HTTP files, and Typescript client code.\n- **AOT-Ready**. Ahead-of-time compiled to the native code. No dependencies, native executable, it just runs and it's very fast.\n- **Customizable**. Configure endpoints with comment annotations. You can easily configure any endpoint by adding comment annotation labels to [PostgreSQL Comments](https://www.postgresql.org/docs/current/sql-comment.html).\n- **Standalone Executable Web Client.** Download the executable and run it. No installation required. See [Releases](https://github.com/vb-consulting/NpgsqlRest/releases). \n\n## Quick Example\n\n#### 1) Your PostgreSQL Function\n\n```sql\ncreate function hello_world()                                    \nreturns text \nlanguage sql\nas $$\nselect 'Hello World'\n$$;\n```\n\n#### 2) .NET8 AOT-Ready Web App\n\n```csharp\nvar builder = WebApplication.CreateSlimBuilder(args);\nvar app = builder.Build();\nvar connectionStr = \"Host=localhost;Port=5432;Database=my_db;Username=postgres;Password=postgres\";\napp.UseNpgsqlRest(new(connectionStr));\napp.Run();\n```\n\n#### 3) Auto-Generated HTTP File\n\n```console\n@host=http://localhost:5000                                      \n\n// function public.hello_world()\n// returns text\nPOST {{host}}/api/hello-world/\n```\n\n#### 4) Auto-Generated Typescript Client Module\n\n```ts\nconst _baseUrl = \"http://localhost:5000\";                        \n\n\n/**\n* function public.get_latest_customer()\n* returns customers\n* \n* @remarks\n* GET /api/get-latest-customer\n* \n* @see FUNCTION public.get_latest_customer\n*/\nexport async function getHelloWorld() : Promise\u003cstring\u003e {\n    const response = await fetch(_baseUrl + \"/api/hello-world\", {\n        method: \"GET\",\n        headers: { \"Content-Type\": \"application/json\" },\n    });\n    return await response.text() as string;\n}\n```\n\n#### 5) Endpoint Response\n\n```console\nHTTP/1.1 200 OK                                                  \nConnection: close\nContent-Type: text/plain\nDate: Tue, 09 Jan 2024 14:25:26 GMT\nServer: Kestrel\nTransfer-Encoding: chunked\n\nHello World\n```\n\n### Comment Annotations\n\nConfigure individual endpoints with powerful and simple routine comment annotations. You can use any PostgreSQL administration tool or a simple script:\n\nFunction:\n\n```sql\ncreate function hello_world_html()                               \nlanguage sql \nas \n$$\nselect '\u003cdiv\u003eHello World\u003c/div\u003e';\n$$\n\ncomment on function hello_world_html() is '\nHTTP GET /hello\nContent-Type: text/html';\n```\n\nWill have content type `text/html` as visible in comment annotation:\n\n```console\nConnection: close                                                \nContent-Type: text/html\nDate: Thu, 18 Jan 2024 11:00:39 GMT\nServer: Kestrel\nTransfer-Encoding: chunked\n\n\u003cdiv\u003eHello World\u003c/div\u003e\n```\n\n## Getting Started\n\n### Using Library\n\n#### Library Installation\n\nInstall the package from NuGet by using any of the available methods:\n\n```console\ndotnet add package NpgsqlRest --version 2.13.1\n```\n```console\nNuGet\\Install-Package NpgsqlRest -version 2.13.1\n```\n```xml\n\u003cPackageReference Include=\"NpgsqlRest\" Version=\"2.13.1\" /\u003e\n```\n\n#### Library First Use\n\nYour application builder code:\n\n```csharp\nvar app = builder.Build();\napp.UseNpgsqlRest(new(\"Host=localhost;Port=5432;Database=my_db;Username=postgres;Password=postgres\"));\napp.Run();\n```\n\nFor all available build options, see the **[options documentation](https://vb-consulting.github.io/npgsqlrest/options/).**\n\n#### Library Dependencies\n\n- net9.0\n- Microsoft.NET.Sdk.Web 9.0\n- Npgsql 8.0.5\n- PostgreSQL \u003e= 13\n\nNote: PostgreSQL 13 minimal version is required to run the initial query to get the list of functions. The source code of this query can be found [here](https://github.com/vb-consulting/NpgsqlRest/blob/master/NpgsqlRest/RoutineQuery.cs). For versions prior to version 13, this query can be replaced with a custom query that can run on older versions.\n\n## Contributing\n\nContributions from the community are welcomed.\nPlease make a pull request with a description if you wish to contribute.\n\n## License\n\nThis project is licensed under the terms of the MIT license.\n","funding_links":["https://patreon.com/vbconsulting","https://buymeacoffee.com/vbilopavu"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNpgsqlRest%2FNpgsqlRest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FNpgsqlRest%2FNpgsqlRest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNpgsqlRest%2FNpgsqlRest/lists"}