{"id":14986595,"url":"https://github.com/teelinsan/minimal-rest-microservice","last_synced_at":"2025-07-11T10:40:40.234Z","repository":{"id":81116419,"uuid":"260726713","full_name":"teelinsan/minimal-rest-microservice","owner":"teelinsan","description":"A minimal REST API microservice in Python built with Flask and OpenAPI/Swagger.","archived":false,"fork":false,"pushed_at":"2023-07-19T10:35:04.000Z","size":212,"stargazers_count":12,"open_issues_count":0,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-25T18:45:16.593Z","etag":null,"topics":["boilerplate","boilerplate-template","connexion","docker","flask","flask-application","microservice","mongo","mongodb","open-api","python","python-microservice","rest","rest-api","restful-api","swagger","template"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/teelinsan.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":"2020-05-02T16:19:51.000Z","updated_at":"2024-08-07T19:39:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"a4ad4359-0032-4ff5-a87a-f6e8caab1dcd","html_url":"https://github.com/teelinsan/minimal-rest-microservice","commit_stats":{"total_commits":14,"total_committers":2,"mean_commits":7.0,"dds":0.0714285714285714,"last_synced_commit":"9d42f7aa8dddc425b9895ecb5961a0cdf98f82d6"},"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teelinsan%2Fminimal-rest-microservice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teelinsan%2Fminimal-rest-microservice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teelinsan%2Fminimal-rest-microservice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teelinsan%2Fminimal-rest-microservice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/teelinsan","download_url":"https://codeload.github.com/teelinsan/minimal-rest-microservice/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248482921,"owners_count":21111400,"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":["boilerplate","boilerplate-template","connexion","docker","flask","flask-application","microservice","mongo","mongodb","open-api","python","python-microservice","rest","rest-api","restful-api","swagger","template"],"created_at":"2024-09-24T14:13:11.957Z","updated_at":"2025-04-11T21:31:09.456Z","avatar_url":"https://github.com/teelinsan.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Minimal REST API Microservice\n\nThis repository contains a simple minimal REST microservice boilerplate written in python using Flask. \nIt is meant to be a boilerplate/template to clone and quickly start a scalable microservice application.\n\nThe service implements an API that maps RESTful calls to a mongoDB database. It implements read, create, delete, update of accounts records \nin mongoDB, but you can pass in input any JSON file you want to insert\ninto the database (only the field `id` is mandatory). The REST API is created using [Flask](https://github.com/pallets/flask), \n[Flask-Injector](https://pypi.python.org/pypi/Flask-Injector) and [Connexion](https://github.com/zalando/connexion).\nConnexion is a python library to use [OpenAPI](https://swagger.io/specification/), formerly Swagger, to describe and document RESTful APIs\nusing a design-first approach.\n\n\n![](img/swagger1.png)\n\nProject Organization\n------------\n\n    |\n    ├── /account-microservice\n    │   ├── /api       \n    |   |   ├── __init__.py                         \u003c- Python init file\n    |   |   └── accounts.py                         \u003c- Python file where methods are injected in the API\n    │   ├── /providers       \n    |   |   └── MongoProvider.py                    \u003c- Python file where methods are implemented\n    │   ├── /swagger       \n    |   |   └── accounts-service-docs.yaml          \u003c- API Swagger file\n    │   ├── app.py                                  \u003c- Main python file to run the app\n    │   ├── Dockerfile                              \u003c- Dockerfile used to build the image of the microservice\n    │   └── requirements.txt                        \u003c- Requirements file with the list of the libraries needed\n    │\n    ├── /img                                        \u003c- Folder containing the images for this README file\n    ├── LICENSE                                     \u003c- License file\n    ├── README.md                                   \u003c- This Readme file\n    └── docker-compose.yml                          \u003c- Docker compose file, used to run the microservice\n     \n--------\n\n# Quickstart\n## Run the microservice\nRun the following command in the root folder of the project (need docker and docker-composed installed).\n```\ndocker-compose up\n```\n\n## Consult the API documentation\nTo consult the API documentation just type the following address in a browser.\n```\nhttp://localhost:2020/v1.0/ui/\n```\n\n**Endpoints available at `http://localhost:2020/v1.0/{URI}`**:\n\n|Method|URI|Description|\n|------|---|-----------|\n| GET | /accounts/{user_id} | Retrieve data from the DB given an id |\n| POST | /accounts/createUser | Insert data into the DB (Any JSON file, id mandatory)|\n| PUT | /accounts/updateUser | Update data in the DB |\n| DELETE | /accounts/{user_id} | Delete data from the DB | \n\n# Customize the microservice\n\nTo customize the microservice for your own purpose, you have just to modify:\n- `MongoProvider.py` This file contains the implementation of the API methods. In this case it contains the methods to\ncreate, delete, update and read a record from mongoDB. Customize it with your desired implementation.\n- `accounts.py`: This file describes the API methods and what implementation should they run.\n- `accounts-service-docs.yaml`: This file contains the OpenAPI specification that describe the RESTful API.\nModify this file according to your needs changing paths of the API methods and keeping in mind to modify `parameters`\nand `operationId` depending on what you edited in the `accounts.py` file. Consult the official documentation to learn more \nabout [OpenAPI](https://swagger.io/specification/v2/).\n\nRun your modified microservice with the command:\n```\ndocker-compose build \u0026\u0026 docker-compose up\n```\n\n# Create new microservices from the boilerplate\nTo create a new microservice:\n- Duplicate the `account-microservice` folder and rename the it `XXXX-microservice`\nwith the name of your new microservice. Customize your new microservice following the instruction in the previous section.\n- Modify the `docker-compose.yml` file duplicating the `account-microservice` specifications and renaming them `XXXX-microservice`.\nKeep in mind to modify also the parameters `- PORT=YYYY` and `ports` with your desired exposed port.\n\nOnce again, run the microservices with the command:\n```\ndocker-compose build \u0026\u0026 docker-compose up\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteelinsan%2Fminimal-rest-microservice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fteelinsan%2Fminimal-rest-microservice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteelinsan%2Fminimal-rest-microservice/lists"}