Skip to content

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

123 Commits

Folders and files

Repository files navigation

Housing Insights

Housing Insights is a Next.js dashboard project for a portfolio-quality national U.S. housing-affordability product. The working public title is The Cost of Home.

The public product anchor is:

Can one full-time job still pay for a place of your own?

Buying a home is out of reach. For millions, even renting is increasingly difficult.

Stack

  • Next.js, React, TypeScript, and Tailwind CSS
  • shadcn/ui source components
  • Apache ECharts, driven directly (not through echarts-for-react)
  • Python standard-library data builders
  • SQLite/Turso via @libsql/client
  • Vitest, Playwright, Biome, and pnpm

Data

The repository uses official public data, including U.S. Census Bureau ACS 5-Year Estimates, U.S. Department of Labor minimum-wage reference data, and Freddie Mac PMMS mortgage-rate data via FRED.

Generated JSON under data/json/ is auditable application data. The local database at data/db/housing-insights.sqlite is built from validated generated JSON and served locally through Turso/libSQL.

Architecture

official source files
        ↓
Python normalization
        ↓
validated JSON artifacts
        ↓
deterministic SQLite database
        ↓
Turso/libSQL read-only repository
       ↙                         ↘
Server Components          /api/v1 Route Handlers
                              ↓
                       / (root) client resource

Runtime application code reads through the server-only repository layer. It does not parse raw Census files or generated JSON at request time.

The dashboard

The public dashboard lives at /, which renders a stable shell and loads display-ready dashboard data from /api/v1/dashboard. The place selector supports the United States plus the 50 states, the District of Columbia, and Puerto Rico; selecting a state updates the URL client-side to /?geo=state:<fips>, shows an immediate skeleton loading state, and uses browser Back and Forward to restore prior selections. A direct link to an older county or metro-area URL (for example county:06075 or cbsa:41860) resolves to an explicit recovery view pointing to that place's state, rather than a full county/CBSA dashboard. /dashboard was never a public route and is not a redirect or alias — a direct request returns an ordinary not-found page.

The page renders, in order: a dashboard header with place search, a compact location/period strip, a one-bedroom rent-share map (typical rent as a share of gross full-time minimum-wage pay) with a linked ranking that drills from national states down to one state's counties, four analytical sections (what one full-time job rents; who can buy the typical home; who is under the greatest rent-and-utilities pressure now; who is spending half their income just to stay housed), a curated "explore other places" strip, and a compact methods-and-sources summary. Every chart has an adjacent accessible table.

Map geometry remains immutable static public data under /data/dashboard-map-geometry/2024-v1/, is requested by the dashboard through /api/v1/dashboard/map-geometry/2024-v1/, and is served by a Next rewrite that preserves raw GeoJSON and static caching. It is not stored in Turso. OSM raster tiles remain external.

The /tableau route embeds a Tableau Public companion implementation of the same analysis for portfolio context. It is not the primary or canonical dashboard, is marked noindex, and does not synchronize the root dashboard's ?geo= state.

Local Commands

pnpm install
pnpm dev:turso
pnpm dev

The app defaults to port 3007. The repository ships a ready-to-use data/db/housing-insights.sqlite; pnpm data:db:build instead builds a disposable validation candidate under tmp/ and never replaces it.

For local Turso/libSQL smoke testing, configure the repository's expected Turso environment variables:

  • TURSO_DATABASE_URL
  • TURSO_AUTH_TOKEN

Then run:

pnpm test:turso-local

Validation

Primary checks:

pnpm data:test
pnpm data:db:test
pnpm test:api
pnpm typecheck
pnpm lint
pnpm build
pnpm traces:check
pnpm e2e:phase3-dashboard

pnpm test runs the data and API test suites together. The e2e:* commands drive a Playwright browser against a running app (default http://127.0.0.1:3007, overridable with APP_URL) and write screenshots to e2e/screenshots/.

Data Integrity And Accessibility

The project preserves source periods, geography identifiers, estimates, 90% margins of error, ACS missingness/suppression semantics, derived formulas, and provenance. Missing values are not treated as zero, and raw ACS sentinel values must not appear as measurements.

The finished dashboard is expected to provide accessible alternatives for major visualizations, avoid color-only meaning, and keep methodology, limitations, and uncertainty visible.

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages