{"id":22056965,"url":"https://github.com/danteay/hapi-api","last_synced_at":"2025-06-12T17:07:47.120Z","repository":{"id":100303372,"uuid":"391816291","full_name":"danteay/hapi-api","owner":"danteay","description":"simple API","archived":false,"fork":false,"pushed_at":"2021-08-02T18:12:19.000Z","size":154,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-23T16:24:30.842Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danteay.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2021-08-02T04:35:36.000Z","updated_at":"2021-08-02T18:12:23.000Z","dependencies_parsed_at":"2023-05-13T12:15:30.799Z","dependency_job_id":null,"html_url":"https://github.com/danteay/hapi-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/danteay/hapi-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danteay%2Fhapi-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danteay%2Fhapi-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danteay%2Fhapi-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danteay%2Fhapi-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danteay","download_url":"https://codeload.github.com/danteay/hapi-api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danteay%2Fhapi-api/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259509429,"owners_count":22868834,"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":[],"created_at":"2024-11-30T16:15:33.468Z","updated_at":"2025-06-12T17:07:47.099Z","avatar_url":"https://github.com/danteay.png","language":"Python","readme":"# Habi Api\n\nThis is a simple API with Serverless framework.\n\n**For requirement number 1 there's no state field on property table so this field was omitted on filters**\n\n## Example request\n\n```shell\n# All filters are optional\ncurl --location --request GET 'http://localhost:3000/properties?status=5,3\u0026city=medellin\u0026year=2000'\n```\n\n## Contents\n\nThis template includes the following extra configurations:\n\n- [serverless framework][1]\n- [serverless-offline plugin][2]\n- [serverless-prune-plugin][8]\n- [serverless-python-requirements][9]\n- [yapf][3] code formatter\n- [Pylint][4] for code linting\n- [Poetry][5] For virtual environment\n\nIt will, by default set the stage to `dev` and the region to `us-east-1`.\n\n## Installation\n\n1. Create new virtual environment\n\n  ```shell\n  make venv\n  ```\n\n2. Install Python dependencies\n\n  ```shell\n  make install\n  ```\n  \n3. Install Serverless and Node dependencies\n\n  ```shell\n  make npmi\n  ```\n  \n4. Execute local server\n\n  ```shell\n  make run\n  ```\n\n\n## Formatting, linting and complexity check\n\n```shell\nmake fmt\n```\n\n```shell\nmake lint\n```\n\n```shell\nmake complexity\n```\n\n## Explanation of the project.\n\n### General explanation\n\nThis simple API has been implemented with the hexagonal architecture for the general project structure, \nrepository pattern for the data access manipulation and the python decorator patter for all the project\nmiddlewares.\n\nHexagonal architecture brings the better abstraction over the business logic and all the data manipulation,\ngiving the ability to replace components or extend it easily.\n\nRepository pattern creates the lightest abstraction over the data access comparing with a traditional ORM \nimplementation. This brings the ability of create complex queries with better performance. A cons of this\npatter are the runtime errors by malformed SQL queries sins there is no check until query is running.\n\nDecorator pattern is a great choice to generate Middlewares and isolate request logic and transformation\nfrom all the business and data access logic, also makes easy to maintain all code in general.\n\n### Requirement number 2 explanation\n\n![DB-ER-diagram](https://raw.githubusercontent.com/danteay/hapi-api/master/Habi-Liked.png)\n\nIf we continue to use same DB structure, in order to keep tracking of all property likes of the any user\nwe should implement the DB structure of the past image and create the `liked` and `liked_history` tables,\nwhere the `table` will keep the current liked properties of a user and can be deleted it at any time. To keep\nhistory track for all liked properties the `liked_history` table will keep any type of liked movement (liked\nor unliked) and keep the relation between property, user and the time of the movement execution\n\nIf we could choose any other DB to store Liked properties I would suggest AWS QLDB (AWS Quantum Ledger Data Base).\nThis database keep tracking of all the historic changes of a record even when the record was deleted. This DB has\nimmutable records so, any modification of a record at the end is a new record with new values and the DB keeps\nthe latest value for that entry.\n\n[1]: https://serverless.com/\n[2]: https://github.com/dherault/serverless-offline\n[3]: https://github.com/google/yapf\n[4]: http://pylint.pycqa.org/en/latest/\n[5]: https://python-poetry.org/\n[8]: https://github.com/claygregory/serverless-prune-plugin\n[9]: https://github.com/UnitedIncome/serverless-python-requirements\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanteay%2Fhapi-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanteay%2Fhapi-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanteay%2Fhapi-api/lists"}