{"id":18314361,"url":"https://github.com/pc9795/calorie-counter","last_synced_at":"2026-04-26T12:31:14.857Z","repository":{"id":44816103,"uuid":"221576466","full_name":"pc9795/calorie-counter","owner":"pc9795","description":"Track :clipboard: meals :pizza: and calories :muscle:. Reference for REST web services using Spring boot.","archived":false,"fork":false,"pushed_at":"2023-07-07T21:56:01.000Z","size":81,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-09T12:43:05.154Z","etag":null,"topics":["java","reference","spring-boot"],"latest_commit_sha":null,"homepage":"","language":"Java","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/pc9795.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":"2019-11-14T00:19:10.000Z","updated_at":"2022-01-22T17:37:47.000Z","dependencies_parsed_at":"2024-12-23T06:29:42.020Z","dependency_job_id":"0d38670a-11f3-44d7-b019-3e3477810a55","html_url":"https://github.com/pc9795/calorie-counter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pc9795/calorie-counter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pc9795%2Fcalorie-counter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pc9795%2Fcalorie-counter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pc9795%2Fcalorie-counter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pc9795%2Fcalorie-counter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pc9795","download_url":"https://codeload.github.com/pc9795/calorie-counter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pc9795%2Fcalorie-counter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32297893,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T09:34:17.070Z","status":"ssl_error","status_checked_at":"2026-04-26T09:34:00.993Z","response_time":129,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["java","reference","spring-boot"],"created_at":"2024-11-05T16:32:21.366Z","updated_at":"2026-04-26T12:31:14.838Z","avatar_url":"https://github.com/pc9795.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# calorie-counter\nA project to learn about REST\n\n**Abstract**\n\nAn API where users can register and signin. They can add meals with the calorie information and if that info is not present nutritionix API  is used to auto-populate calorie details. This API supports different roles, pagination and advanced searching capabilites.\n\n**Techical Learnings**\n* Implemented authentication and authorization using Spring security.\n* Created REST resources using Spring boot.\n* Used Spring-Data and Hibernate for database related things.\n* Used Spring REST client to consume an external API.\n* Created Hibernate criteria queries using Specifications. \n* Implemetned pagination using `Pageable`.\n* API testing using Spring MockMvc.\n* Repository testing using `DataJpaTest`.\n* Unit and Integration testing with Spring.\n* Used Swagger for API documentation.\n\n**Could be better**\n* Login/Register is implemented using traditional POST request could be done with JSON.\n* User can apply calorie limit but it is for all entries(BLUNDER). This should be a daily limit. Simple change is query.\n* PUT is creating resource if not present. I found on some places that it is okay but it is a doubt.\n* In user roles there is a loop hole where one role which manages users can downgrade admin.\n\n**How to run**\n* Pull the repo.\n* Create a postgres database and update the details in `src/main/resources/application.properties`. \n* Uncomment `spring.jpa.hibernate.ddl-auto=create` so that it will create all the tables for you.\n* Create an API key at https://developer.nutritionix.com/ and update the details in `src/main/resources/nutritionix.properties`.\n* Run the spring boot application from `src/main/Application.java`.\n* Check the available API endpoints at http://localhost:8080/swagger-ui.html.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpc9795%2Fcalorie-counter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpc9795%2Fcalorie-counter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpc9795%2Fcalorie-counter/lists"}