{"id":18658475,"url":"https://github.com/j0a0m4/otp","last_synced_at":"2026-05-03T05:37:44.202Z","repository":{"id":254373307,"uuid":"846320028","full_name":"j0a0m4/otp","owner":"j0a0m4","description":"A small example of ports and adapters architecture in Java. Only meant as a modelling exercise.","archived":false,"fork":false,"pushed_at":"2024-08-23T02:17:13.000Z","size":64,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-17T19:22:01.854Z","etag":null,"topics":["api","java","rest-api","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/j0a0m4.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":"2024-08-23T00:51:19.000Z","updated_at":"2024-08-23T02:18:41.000Z","dependencies_parsed_at":"2024-08-23T03:28:01.079Z","dependency_job_id":"cd419178-3e05-4847-b4f5-b2edd03ad87d","html_url":"https://github.com/j0a0m4/otp","commit_stats":null,"previous_names":["j0a0m4/otp"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j0a0m4%2Fotp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j0a0m4%2Fotp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j0a0m4%2Fotp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j0a0m4%2Fotp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/j0a0m4","download_url":"https://codeload.github.com/j0a0m4/otp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239475962,"owners_count":19645041,"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","java","rest-api","spring-boot"],"created_at":"2024-11-07T07:33:06.152Z","updated_at":"2025-11-05T23:30:34.212Z","avatar_url":"https://github.com/j0a0m4.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Otp Service\n\n## Routes\n\n### POST `/v1/users`\n\nCreates a new user by providing a valid `email`.  \nReturns a new `userId` in the body and `Location` header.\n\n#### Request\n\n```json\n{\n  \"email\": \"example@test.com\"\n}\n```\n\n#### Response\n\n```json\n{\n  \"userId\": \"3419e0d7-ff9b-4a99-a3f4-b567fdff3a2b\"\n}\n```\n\n#### Try it\n\n```shell\ncurl -d '{\"email\": \"example@test.com\"}' \\\n -H \"Content-Type: application/json\" \\\n -X POST http://localhost:8080/v1/users\n```\n\n### POST `/v1/otp`\n\nCreates a new otp for a given `userId`.  \nReturns a new 6 digit `otp` and expiration metadata.\n\n#### Request\n\n```json\n{\n  \"userId\": \"3419e0d7-ff9b-4a99-a3f4-b567fdff3a2b\"\n}\n```\n\n#### Response\n\n```json\n{\n  \"userId\": \"3419e0d7-ff9b-4a99-a3f4-b567fdff3a2b\",\n  \"otp\": \"988569\",\n  \"expiration\": {\n    \"expiresIn\": 30,\n    \"measurementUnit\": \"Seconds\"\n  },\n  \"creationTime\": \"2024-08-22T19:42:09.522528Z\"\n}\n```\n\n#### Try it out\n\n```shell\ncurl -d '{\"userId\": \"3419e0d7-ff9b-4a99-a3f4-b567fdff3a2b\"}' \\\n -H \"Content-Type: application/json\" \\\n -X POST http://localhost:8080/v1/otp\n```\n\n### POST `/v1/verifications`\n\nVerify status of `otp` for a given `userId`.  \nReturns the otp `status`.\n\n### Request\n\n```json\n{\n  \"userId\": \"3419e0d7-ff9b-4a99-a3f4-b567fdff3a2b\",\n  \"otp\": \"988569\"\n}\n```\n\n### Response\n\n```json\n{\n  \"userId\": \"3419e0d7-ff9b-4a99-a3f4-b567fdff3a2b\",\n  \"otp\": \"988569\",\n  \"otpStatus\": \"ACCEPTED\",\n  \"timestamp\": \"2024-08-22T19:42:37.077639Z\"\n}\n```\n\n#### Try it out\n\n```shell\ncurl -d '{\"userId\": \"3419e0d7-ff9b-4a99-a3f4-b567fdff3a2b\", \"otp\": \"988569\"}' \\\n -H \"Content-Type: application/json\" \\\n -X POST http://localhost:8080/v1/verifications\n```\n\n## Setup\n\n### Containers\n\nOn Mac, with `colima` you need to create a symlink for testcontainers to work\n\n```shell\nsudo ln -s $HOME/.colima/docker.sock /var/run/docker.sock\n```\n\n### Environment Variables\n\nYou need to bind a valid mongoDB connection string to variable `$DB_URI`","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fj0a0m4%2Fotp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fj0a0m4%2Fotp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fj0a0m4%2Fotp/lists"}