<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/usa-gqhis04nd" -->

---
title: USA | daily.dev
description: A Rails engine gem called 'usa' provides five database tables (states, counties, cities, ZIP codes) for every US location, joined together for use in Rails...
canonical: https://daily.dev/posts/usa-gqhis04nd
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: USA | daily.dev
og:description: A Rails engine gem called 'usa' provides five database tables (states, counties, cities, ZIP codes) for every US location, joined together for use in Rails...
og:url: https://daily.dev/posts/usa-gqhis04nd
og:image: https://api.daily.dev/og/posts/gQhIs04ND.png
og:image:alt: USA
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# USA

**[Ruby Flow](https://daily.dev/sources/rubyflow)** · 1 min read · 0 upvotes · 0 comments

## Summary

A Rails engine gem called 'usa' provides five database tables (states, counties, cities, ZIP codes) for every US location, joined together for use in Rails apps. Installation involves adding the gem, running a generator, migrating the database schema, and then seeding it with data via a rerunnable rake task.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://claudiob.github.io/usa>

## Questions this post answers

### Is there a Rails gem that provides US states, counties, cities, and ZIP codes as database tables?

Yes, the 'usa' gem is a Rails engine that ships five joined database tables covering every US state, county, city, and ZIP code. Install it with 'gem "usa", "~> 0.5.0"', run 'bin/rails g usa:install' and 'bin/rails db:migrate' to create the schema, then run 'bin/rails db:usa:seed' to populate the rows; the seed task is safe to rerun.

_Developers wiring US location data into a Rails app can find gems and setup notes like this on daily.dev._

## Similar posts on daily.dev

- [usa/db/seeds/states.csv at main · claudiob/usa](https://daily.dev/posts/usa-db-seeds-states-csv-at-main-claudiob-usa-jyul48323) · Ruby Flow · 0 upvotes · 0 comments
- [Rails Generate Model: Beginner’s Guide to Database Models](https://daily.dev/posts/rails-generate-model-beginner-s-guide-to-database-models-wta8yzvcf) · RUBYLAND · 0 upvotes · 0 comments
- [48 companies you didn't know were using Rails in 2026](https://daily.dev/posts/48-companies-you-didn-t-know-were-using-rails-in-2026-32r6qjgry) · thoughbot · 1 upvotes · 1 comments
- [Generating thousands of maps per minute in Ruby](https://daily.dev/posts/generating-thousands-of-maps-per-minute-in-ruby-ate3ec5am) · RUBYLAND · 0 upvotes · 0 comments

---

Tags: [#ruby](https://daily.dev/tags/ruby), [#rails](https://daily.dev/tags/rails), [#gem](https://daily.dev/tags/gem)

[View this post on daily.dev](https://daily.dev/posts/usa-gqhis04nd)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"USA","url":"https://daily.dev/posts/usa-gqhis04nd","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/usa-gqhis04nd"},"datePublished":"2026-09-27T00:16:55.101Z","dateModified":"2026-09-27T00:17:11.925Z","description":"A Rails engine gem called 'usa' provides five database tables (states, counties, cities, ZIP codes) for every US location, joined together for use in Rails...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/268b414c6587900a3ba5fa6b1f4e242a?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/268b414c6587900a3ba5fa6b1f4e242a?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Ruby Flow","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Ruby Flow","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/a21aaa8bcbbf448193a016895c90a0e1","url":"https://daily.dev/sources/rubyflow"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/usa-gqhis04nd","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"ruby,rails,gem","timeRequired":"PT1M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Ruby Flow","item":"https://daily.dev/sources/rubyflow"},{"@type":"ListItem","position":3,"name":"USA"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/usa-gqhis04nd#faq","mainEntity":[{"@type":"Question","name":"Is there a Rails gem that provides US states, counties, cities, and ZIP codes as database tables?","acceptedAnswer":{"@type":"Answer","text":"Yes, the 'usa' gem is a Rails engine that ships five joined database tables covering every US state, county, city, and ZIP code. Install it with 'gem \"usa\", \"~\u003e 0.5.0\"', run 'bin/rails g usa:install' and 'bin/rails db:migrate' to create the schema, then run 'bin/rails db:usa:seed' to populate the rows; the seed task is safe to rerun. Developers wiring US location data into a Rails app can find gems and setup notes like this on daily.dev."}}]}
```

