{"id":24093757,"url":"https://github.com/jblayter/postal_code_service","last_synced_at":"2025-06-24T22:35:40.106Z","repository":{"id":269106837,"uuid":"906447722","full_name":"jblayter/postal_code_service","owner":"jblayter","description":"A restful web service that translates a postal code into a city state using the postal code XLS from USPS. ","archived":false,"fork":false,"pushed_at":"2024-12-20T23:56:48.000Z","size":712,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-10T10:35:06.736Z","etag":null,"topics":["postal-code","rust","usps"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jblayter.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}},"created_at":"2024-12-20T23:53:30.000Z","updated_at":"2024-12-20T23:56:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"9a5b683a-ff62-4c3c-ad1c-f4b4302759b7","html_url":"https://github.com/jblayter/postal_code_service","commit_stats":null,"previous_names":["jblayter/postal_code_service"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jblayter%2Fpostal_code_service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jblayter%2Fpostal_code_service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jblayter%2Fpostal_code_service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jblayter%2Fpostal_code_service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jblayter","download_url":"https://codeload.github.com/jblayter/postal_code_service/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241008972,"owners_count":19893259,"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":["postal-code","rust","usps"],"created_at":"2025-01-10T10:34:26.054Z","updated_at":"2025-02-27T11:59:01.435Z","avatar_url":"https://github.com/jblayter.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Postal Code Service\n\nA high-performance REST API service written in Rust that provides city and state information for US postal codes (ZIP codes). The service loads postal code data from a CSV file into memory and serves requests using a thread pool for optimal performance.\n\n## Features\n\n- Fast in-memory ZIP code lookups\n- RESTful GET endpoint\n- Thread pool for concurrent request handling\n- Response caching headers\n- Optimized for high throughput\n- Worker count based on CPU cores\n\n## Prerequisites\n\n- Rust (latest stable version)\n- CSV file with postal code data (`ZIP_Locale_Detail.csv`)\n\n## Installation\n\n1. Clone the repository: \n\n```bash\ngit clone \u003crepository-url\u003e\ncd postal-service\n```\n\n2. Build the project:\n\n```bash\ncargo build\n```\n\n3. Run the project:\n\n```bash\ncargo run --release\n```\n\n4. Test the project:\n\n```bash\ncargo test\n```\n\n5. Run the project:\n\n```bash\ncargo run --release\n```\n\nThe service will:\n1. Load the ZIP code database into memory\n2. Print the number of loaded ZIP codes\n3. Start the HTTP server on `http://127.0.0.1:8080`\n\n## API Usage\n\n### Get Location by ZIP Code\n\n```\nGET /location/{postal_code}\n```\n\nResponse\n\n```\n{\n\"city\": \"ADJUNTAS\",\n\"state\": \"PR\"\n}\n```\n\n## Performance\n\nThe service is optimized for performance with:\n- Pre-allocated HashMap for ZIP code data\n- Thread pool for request handling\n- Response caching (24-hour cache headers)\n- Keep-alive connections\n- Worker optimization based on CPU cores\n\n## CSV File Format\n\nThe service expects a CSV file (`ZIP_Locale_Detail.csv`) with the following columns:\n- Column 4: DELIVERY ZIPCODE\n- Column 7: PHYSICAL CITY\n- Column 8: PHYSICAL STATE\n\nYou can download the XLS of this file from the USPS website: https://postalpro.usps.com/ZIP_Locale_Detail and then convert it to CSV using Excel.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjblayter%2Fpostal_code_service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjblayter%2Fpostal_code_service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjblayter%2Fpostal_code_service/lists"}