{"id":28346324,"url":"https://github.com/thenriquedb/url-shortener","last_synced_at":"2026-05-06T01:38:28.583Z","repository":{"id":293682991,"uuid":"984808844","full_name":"thenriquedb/url-shortener","owner":"thenriquedb","description":"A simple URL shortener built with Spring Boot and MongoDB as a proof of concept for learning purposes.","archived":false,"fork":false,"pushed_at":"2025-07-24T23:52:32.000Z","size":58,"stargazers_count":22,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-25T04:41:16.760Z","etag":null,"topics":["docker","docker-compose","java","mongodb","redis","redis-cache","spring-boot","terraform","url-shortener"],"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/thenriquedb.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,"zenodo":null}},"created_at":"2025-05-16T14:41:10.000Z","updated_at":"2025-07-24T23:52:37.000Z","dependencies_parsed_at":"2025-05-16T16:20:08.476Z","dependency_job_id":"164517d6-878b-4020-b6c9-16d01ab44cea","html_url":"https://github.com/thenriquedb/url-shortener","commit_stats":null,"previous_names":["thenriquedb/url-shortener"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/thenriquedb/url-shortener","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thenriquedb%2Furl-shortener","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thenriquedb%2Furl-shortener/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thenriquedb%2Furl-shortener/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thenriquedb%2Furl-shortener/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thenriquedb","download_url":"https://codeload.github.com/thenriquedb/url-shortener/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thenriquedb%2Furl-shortener/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001448,"owners_count":26083078,"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","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"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":["docker","docker-compose","java","mongodb","redis","redis-cache","spring-boot","terraform","url-shortener"],"created_at":"2025-05-27T13:40:17.050Z","updated_at":"2025-10-09T12:14:34.644Z","avatar_url":"https://github.com/thenriquedb.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# URL Shortener (Spring Boot + MongoDB)\n\nA simple proof-of-concept (POC) URL shortener built with Spring Boot and MongoDB for learning purposes.\n\n## Stack\n- Java 21;\n- Spring Boot;\n- MongoDB;\n- Docker compose;\n\n## Endpoints\n\n### Shorten URL\n- **URL**: `/shorten`\n- **Method**: `POST`\n- **Request Body**:\n```json\n{\n  \"url\": \"https://example.com\",\n  \"expiresAt\": \"2025-05-21T11:28:00\" // Optional\n}\n```\n\n- **Response**:\n```json\n{\n  \"shortUrl\": \"http://localhost:8080/abc123\",\n  \"expiresAt\": \"2025-05-21T11:28:00\" // Or null if not set\n}\n```\n\n### Redirect Shortened URL\n- **URL**: `/{id}`\n- **Method**: `GET`\n- **Response**: Redirects to the original URL.\n\n## Running with Docker Compose\n\n```bash\ndocker compose --profile production up --build -d\n```\n\n## Runing with Docker Swarm\n\n**1. Create Docker secrets**\n\n```bash\necho 8081 | docker secret create APP_PORT -\necho mongo | docker secret create MONGO_HOST -\necho 27017 | docker secret create MONGO_PORT -\necho root | docker secret create MONGO_USER -\necho password | docker secret create MONGO_PASSWORD -\necho url_shortener | docker secret create MONG0_DB -\necho cache | docker secret create REDIS_HOST -\necho 6379 | docker secret create REDIS_PORT -\n```\n\n**2. Run with Docker Swarm**\n\n```bash\ndocker swarm init\n```\n**3. Deploy the stack**\n\n```bash\ndocker stack deploy -c docker-swarm.yml url_shortener\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthenriquedb%2Furl-shortener","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthenriquedb%2Furl-shortener","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthenriquedb%2Furl-shortener/lists"}