{"id":51495622,"url":"https://github.com/anuj-er/bfhl-assignment","last_synced_at":"2026-07-07T15:01:04.799Z","repository":{"id":367149767,"uuid":"1279474935","full_name":"Anuj-er/bfhl-Assignment","owner":"Anuj-er","description":"Spring Boot REST API for Bajaj Finserv Health BFHL assignment with Docker deployment on Render.","archived":false,"fork":false,"pushed_at":"2026-06-24T18:36:42.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-24T20:11:56.939Z","etag":null,"topics":["api-assignment","bajaj-finserv","bfhl","docker","java","java-17","maven","render","rest-api","spring-boot"],"latest_commit_sha":null,"homepage":"https://bfhl-assignment-odtq.onrender.com/bfhl","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Anuj-er.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-24T18:11:45.000Z","updated_at":"2026-06-24T18:40:02.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/Anuj-er/bfhl-Assignment","commit_stats":null,"previous_names":["anuj-er/bfhl-assignment"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/Anuj-er/bfhl-Assignment","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anuj-er%2Fbfhl-Assignment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anuj-er%2Fbfhl-Assignment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anuj-er%2Fbfhl-Assignment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anuj-er%2Fbfhl-Assignment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Anuj-er","download_url":"https://codeload.github.com/Anuj-er/bfhl-Assignment/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anuj-er%2Fbfhl-Assignment/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35232326,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-07T02:00:07.222Z","response_time":90,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["api-assignment","bajaj-finserv","bfhl","docker","java","java-17","maven","render","rest-api","spring-boot"],"created_at":"2026-07-07T15:01:03.773Z","updated_at":"2026-07-07T15:01:04.783Z","avatar_url":"https://github.com/Anuj-er.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BFHL API Assignment\n\n\u003e A production-ready Spring Boot REST API for the Bajaj Finserv Health API round.\n\n[![Java](https://img.shields.io/badge/Java-17-orange.svg)](https://www.oracle.com/java/)\n[![Spring Boot](https://img.shields.io/badge/Spring%20Boot-3.4.6-brightgreen.svg)](https://spring.io/projects/spring-boot)\n[![Maven](https://img.shields.io/badge/Build-Maven-blue.svg)](https://maven.apache.org/)\n[![Docker](https://img.shields.io/badge/Deploy-Docker-2496ED.svg)](https://www.docker.com/)\n\n## Overview\n\nThis project exposes a single REST endpoint:\n\n```http\nPOST /bfhl\n```\n\nLive deployment:\n\n```text\nhttps://bfhl-assignment-odtq.onrender.com/bfhl\n```\n\nIt accepts an array of values and returns categorized numbers, alphabets, special characters, the numeric sum, and the required alternating-case reversed alphabet string.\n\nThe implementation is intentionally clean and assignment-friendly:\n\n- Spring Boot 3 + Java 17\n- Request and response DTOs\n- Service interface and implementation\n- Validation and centralized error handling\n- Unit tests and controller tests\n- Dockerfile for Render/Railway deployment\n- Numbers returned as strings, as required\n- Arbitrary-size integer support using `BigInteger`\n\n## Submission Identity\n\nThe API is configured with the required user details:\n\n| Field | Value |\n| --- | --- |\n| Full name | `Anuj Kumar` |\n| Date of birth | `01042005` |\n| Email | `anuj1699.be23@chitkara.edu.in` |\n| Roll number | `2310991699` |\n| Generated `user_id` | `anuj_kumar_01042005` |\n\nThese values are also configurable through environment variables:\n\n| Environment variable | Value |\n| --- | --- |\n| `FULL_NAME` | `Anuj Kumar` |\n| `DOB_DDMMYYYY` | `01042005` |\n| `EMAIL` | `anuj1699.be23@chitkara.edu.in` |\n| `ROLL_NUMBER` | `2310991699` |\n\n## API Contract\n\n### Request\n\n```json\n{\n  \"data\": [\"a\", \"1\", \"334\", \"4\", \"R\", \"$\"]\n}\n```\n\n### Success Response\n\n```json\n{\n  \"is_success\": true,\n  \"user_id\": \"anuj_kumar_01042005\",\n  \"email\": \"anuj1699.be23@chitkara.edu.in\",\n  \"roll_number\": \"2310991699\",\n  \"odd_numbers\": [\"1\"],\n  \"even_numbers\": [\"334\", \"4\"],\n  \"alphabets\": [\"A\", \"R\"],\n  \"special_characters\": [\"$\"],\n  \"sum\": \"339\",\n  \"concat_string\": \"Ra\"\n}\n```\n\n### Rules Implemented\n\n| Output field | Logic |\n| --- | --- |\n| `is_success` | `true` for successful processing |\n| `user_id` | Lowercase full name with underscores + DOB in `ddMMyyyy` format |\n| `odd_numbers` | Numeric strings representing odd numbers |\n| `even_numbers` | Numeric strings representing even numbers |\n| `alphabets` | Alphabet-only values converted to uppercase |\n| `special_characters` | Values that are neither pure numbers nor pure alphabets |\n| `sum` | Sum of all numeric values, returned as a string |\n| `concat_string` | All alphabetic characters reversed, alternating caps from uppercase |\n\n## More Examples\n\n### Example 1\n\n```bash\ncurl --request POST http://localhost:8080/bfhl \\\n  --header \"Content-Type: application/json\" \\\n  --data '{\"data\":[\"2\",\"a\",\"y\",\"4\",\"\u0026\",\"-\",\"*\",\"5\",\"92\",\"b\"]}'\n```\n\nExpected key fields:\n\n```json\n{\n  \"odd_numbers\": [\"5\"],\n  \"even_numbers\": [\"2\", \"4\", \"92\"],\n  \"alphabets\": [\"A\", \"Y\", \"B\"],\n  \"special_characters\": [\"\u0026\", \"-\", \"*\"],\n  \"sum\": \"103\",\n  \"concat_string\": \"ByA\"\n}\n```\n\n### Example 2\n\n```bash\ncurl --request POST http://localhost:8080/bfhl \\\n  --header \"Content-Type: application/json\" \\\n  --data '{\"data\":[\"A\",\"ABCD\",\"DOE\"]}'\n```\n\nExpected key fields:\n\n```json\n{\n  \"alphabets\": [\"A\", \"ABCD\", \"DOE\"],\n  \"sum\": \"0\",\n  \"concat_string\": \"EoDdCbAa\"\n}\n```\n\n## Run Locally\n\n### Prerequisites\n\n- Java 17\n- Maven 3.9+\n\n### Start the API\n\n```bash\nmvn spring-boot:run\n```\n\nThe app starts on:\n\n```text\nhttp://localhost:8080\n```\n\n### Test the endpoint\n\n```bash\ncurl --request POST http://localhost:8080/bfhl \\\n  --header \"Content-Type: application/json\" \\\n  --data '{\"data\":[\"a\",\"1\",\"334\",\"4\",\"R\",\"$\"]}'\n```\n\n### Run tests\n\n```bash\nmvn test\n```\n\n### Build the JAR\n\n```bash\nmvn package\n```\n\nThe generated JAR will be available at:\n\n```text\ntarget/bfhl-api-1.0.0.jar\n```\n\n## Deploy on Render\n\nThis repository includes a root-level `Dockerfile`, so the simplest Render setup is a Docker Web Service.\n\n### Step-by-step Render deployment\n\n1. Push this repository to GitHub.\n\n2. Open the Render Dashboard:\n\n   ```text\n   https://dashboard.render.com\n   ```\n\n3. Click **New +** -\u003e **Web Service**.\n\n4. Connect your GitHub account and select this repository:\n\n   ```text\n   Anuj-er/bfhl-Assignment\n   ```\n\n5. Configure the service:\n\n   | Render field | Value |\n   | --- | --- |\n   | Name | `bfhl-assignment` |\n   | Language | `Docker` |\n   | Branch | `main` |\n   | Root Directory | Leave empty |\n   | Dockerfile Path | `Dockerfile` |\n   | Instance Type | Free/Starter is enough |\n\n6. Add environment variables from the **Environment** section:\n\n   | Key | Value |\n   | --- | --- |\n   | `FULL_NAME` | `Anuj Kumar` |\n   | `DOB_DDMMYYYY` | `01042005` |\n   | `EMAIL` | `anuj1699.be23@chitkara.edu.in` |\n   | `ROLL_NUMBER` | `2310991699` |\n\n7. Click **Deploy Web Service**.\n\n8. After deployment succeeds, Render gives you a public URL:\n\n   ```text\n   https://bfhl-assignment-odtq.onrender.com\n   ```\n\n9. Your final API endpoint will be:\n\n   ```text\n   https://bfhl-assignment-odtq.onrender.com/bfhl\n   ```\n\n10. Test the deployed endpoint:\n\n    ```bash\n    curl --request POST https://bfhl-assignment-odtq.onrender.com/bfhl \\\n      --header \"Content-Type: application/json\" \\\n      --data '{\"data\":[\"a\",\"1\",\"334\",\"4\",\"R\",\"$\"]}'\n    ```\n\nSubmit the complete deployed endpoint ending in `/bfhl`, not just the base Render URL.\n\n## Docker\n\nBuild and run locally with Docker:\n\n```bash\ndocker build -t bfhl-api .\ndocker run --rm -p 8080:8080 bfhl-api\n```\n\nThen test:\n\n```bash\ncurl --request POST http://localhost:8080/bfhl \\\n  --header \"Content-Type: application/json\" \\\n  --data '{\"data\":[\"a\",\"1\",\"334\",\"4\",\"R\",\"$\"]}'\n```\n\n## Project Structure\n\n```text\n.\n├── Dockerfile\n├── pom.xml\n├── README.md\n└── src\n    ├── main\n    │   ├── java/com/bajajfinserv/bfhl\n    │   │   ├── config\n    │   │   ├── controller\n    │   │   ├── dto\n    │   │   ├── exception\n    │   │   └── service\n    │   └── resources/application.yml\n    └── test/java/com/bajajfinserv/bfhl\n```\n\n## Validation and Errors\n\nIf the request body is invalid, the API returns a graceful error response:\n\n```json\n{\n  \"is_success\": false,\n  \"user_id\": \"anuj_kumar_01042005\",\n  \"email\": \"anuj1699.be23@chitkara.edu.in\",\n  \"roll_number\": \"2310991699\",\n  \"odd_numbers\": [],\n  \"even_numbers\": [],\n  \"alphabets\": [],\n  \"special_characters\": [],\n  \"sum\": \"0\",\n  \"concat_string\": \"\",\n  \"error\": \"data: data is required\"\n}\n```\n\n## Troubleshooting Render\n\n| Problem | Fix |\n| --- | --- |\n| Service deploys but endpoint fails | Make sure you are sending a `POST` request to `/bfhl` |\n| `GET /bfhl` does not work | Expected behavior: the assignment requires `POST /bfhl` |\n| Wrong identity in response | Check the four environment variables in Render |\n| Build fails | Confirm Render is using `Language = Docker` and the root `Dockerfile` |\n| First request is slow | Free Render services can take time to wake up after inactivity |\n\n## Final Submission URL Format\n\nUse this format:\n\n```text\nhttps://\u003cyour-render-service-name\u003e.onrender.com/bfhl\n```\n\nExample:\n\n```text\nhttps://bfhl-assignment-odtq.onrender.com/bfhl\n```\n\n---\n\nBuilt for the Bajaj Finserv Health API round.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanuj-er%2Fbfhl-assignment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanuj-er%2Fbfhl-assignment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanuj-er%2Fbfhl-assignment/lists"}