{"id":13706636,"url":"https://github.com/oatpp/example-postgresql","last_synced_at":"2025-04-25T20:30:31.581Z","repository":{"id":98397843,"uuid":"170488350","full_name":"oatpp/example-postgresql","owner":"oatpp","description":"A complete example of a \"CRUD\" service (UserService) built with Oat++ and using oatpp ORM with PostgreSQL.","archived":false,"fork":false,"pushed_at":"2024-04-22T21:29:47.000Z","size":45,"stargazers_count":38,"open_issues_count":7,"forks_count":19,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-30T00:44:14.701Z","etag":null,"topics":["cpp","microservices","oatpp","orm","postgresql","swagger-ui"],"latest_commit_sha":null,"homepage":"https://oatpp.io/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oatpp.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}},"created_at":"2019-02-13T10:28:08.000Z","updated_at":"2024-07-06T13:48:47.000Z","dependencies_parsed_at":"2023-03-13T16:01:26.375Z","dependency_job_id":null,"html_url":"https://github.com/oatpp/example-postgresql","commit_stats":{"total_commits":40,"total_committers":1,"mean_commits":40.0,"dds":0.0,"last_synced_commit":"16424c5175b78813bd31a810391bb60027a63f6c"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oatpp%2Fexample-postgresql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oatpp%2Fexample-postgresql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oatpp%2Fexample-postgresql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oatpp%2Fexample-postgresql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oatpp","download_url":"https://codeload.github.com/oatpp/example-postgresql/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223200779,"owners_count":17105014,"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":["cpp","microservices","oatpp","orm","postgresql","swagger-ui"],"created_at":"2024-08-02T22:01:03.211Z","updated_at":"2024-11-10T21:22:53.029Z","avatar_url":"https://github.com/oatpp.png","language":"C++","readme":"# example-postgresql [![Build Status](https://dev.azure.com/lganzzzo/lganzzzo/_apis/build/status/oatpp.example-postgresql?branchName=master)](https://dev.azure.com/lganzzzo/lganzzzo/_build/latest?definitionId=17\u0026branchName=master)\n\nA complete example of a \"CRUD\" service (UserService) built with Oat++ and using oatpp ORM with PostgreSQL.\n\n\nIn this example:\n\n- How to create CRUD endpoints.\n- How to use [oatpp ORM](https://oatpp.io/docs/components/orm/) - PostgreSQL example.\n- How to document API with Swagger-UI and OpenApi 3.0.0.\n\nMore about Oat++:\n\n- [Oat++ Website](https://oatpp.io/)\n- [Oat++ Github Repository](https://github.com/oatpp/oatpp)\n- [Get Started](https://oatpp.io/docs/start)\n\n## Overview\n\nThis project is using the following oatpp modules:\n\n- [oatpp](https://github.com/oatpp/oatpp) \n- [oatpp-swagger](https://github.com/oatpp/oatpp-swagger)\n- [oatpp-postgresql](https://github.com/oatpp/oatpp-postgresql)\n\n### Project layout\n\n```\n|- CMakeLists.txt                        // projects CMakeLists.txt\n|- src/\n|    |\n|    |- controller/                      // Folder containing Controller where all endpoints are declared\n|    |- db/                              // Folder containing the database client\n|    |- dto/                             // DTOs are declared here\n|    |- service/                         // Service business logic classes (UserService)\n|    |- ServiceComponent.hpp             // Service configuration (port, ObjectMapper, Database)\n|    |- SwaggerComponent.hpp             // Configuration for swagger-ui\n|    |- AppComponent.hpp                 // Service configuration is loaded here\n|    |- DatabaseComponent.hpp            // Database config\n|    |- App.cpp                          // main() is here\n|    \n|- test/                                 // test folder\n|- utility/install-oatpp-modules.sh      // utility script to install required oatpp-modules.\n|- resources/config.json                 // configuration file with configuration profiles\n|- Dockerfile                            // Dockerfile\n|- docker-compose.yaml                   // Docker-compose with this service and postgresql\n```\n\n---\n\n## Build and Run\n\n### Using CMake\n\n**Requires** \n\n- This example also requires the PostgreSQL package installed.\n   - On Alpine `$ apk add postgresql-dev`\n   - On Ubuntu `$ apt-get install postgresql-server-dev-all`\n   \n   For more info see [oatpp-postgresql/README.md](https://github.com/oatpp/oatpp-postgresql/blob/master/README.md)\n- `oatpp`, `oatpp-swagger` and `oatpp-postgresql` modules installed. You may run `utility/install-oatpp-modules.sh` \nscript to install required oatpp modules.   \n\n```\n$ mkdir build \u0026\u0026 cd build\n$ cmake ..\n$ make \n$ ./example-postgresql-exe  # - run application.\n```\n\n*PostgreSQL is expected running as for `dev` config profile*\n\n### In Docker\n\n#### Dockerfile\n\n```\n$ docker build -t example-postgresql .\n$ docker run -p 8000:8000 -e CONFIG_PROFILE='dev' -t example-postgresql\n```\n\n#### docker-compose\n\n```\n$ docker-compose up\n```\n\n*docker-compose will run service with `local-docker` config profile*\n\n### After run\n\nGo to [http://localhost:8000/swagger/ui](http://localhost:8000/swagger/ui) to try endpoints.\n\n","funding_links":[],"categories":["C++"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foatpp%2Fexample-postgresql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foatpp%2Fexample-postgresql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foatpp%2Fexample-postgresql/lists"}