RepositoryTypeScript
chiban-org

chiban-org/chiban-oss

Open-source land-use software for small US towns: permits, inspections, Planning Board and ZBA cases, and code enforcement, organized around the parcel.

128sao
0fork
0issue
1lượt xem

Chiban

Open-source land-use software for small US towns.
Building and trade permits, inspections, Planning Board and ZBA applications, and code enforcement, all kept on the parcel.

Live demo · Documentation · Self-hosting · chiban.us

License: AGPL-3.0 State pack: New Hampshire

A building permit in Chiban, showing its status, the next step for staff and the decision deadline

Why Chiban

A small town's land-use office is often one clerk, a part-time building inspector and two volunteer boards. Their work lives in paper files, a permit spreadsheet and deadlines that someone keeps in their head. Chiban puts the whole record of each parcel in one place: every application, notice, hearing, decision, permit, inspection and complaint, from the first form to the final certificate.

  • Organized around the parcel. Open a lot and see everything that has happened to it. Residents can read the public part of that history without an account.
  • State rules built in. Deadlines, notice wording, appeal routes and records-request rules come from a state pack. Each deadline shows the statute it runs on, the day it started and how it counts, so staff can defend it at the counter or in a hearing.
  • Staff configure it themselves. Application forms, fees, permit conditions, document templates and notice wording are edited in the app, with no code and no support ticket.
  • The records stay the town's. One export holds every record as plain text and every document as its original file, plus spreadsheet tables, an Excel workbook and a PDF/A copy of every PDF. A written format guide lets a clerk or consultant read it without Chiban.
  • Free to run. A town can host Chiban on its own server with Docker Compose, or pay someone to host it.

What's in it

AreaWhat staff and residents get
Applications and permitsOnline and counter applications, departmental reviews, conditions, issuance, certificates and placards
InspectionsBooking slots, an inspector's day that works on a phone, checklists with photos, failed results and reinspections, calendar invites for each booking
BoardsPlanning Board and ZBA cases, abutter notices, hearings, agendas, member packets, decisions and appeals
Code enforcementComplaints (including anonymous ones that record nothing about the sender), cases, violations, orders and appeals
Resident portalParcel search, applying and paying online, following inspections, a contractor dashboard, records requests
PaymentsCard payments online and at the counter through Stripe or Clover, plus cash and check
RecordsRight-to-Know requests with exemptions and redaction, holds, the retention schedule, and an audit trail on every change
ReportsPermit volume, processing time, revenue, census reporting, scheduled reports and Excel downloads
Moving inImports from a CAMA export, GIS parcel layers, old permit spreadsheets and scanned property files (with OCR)
The public parcel page a resident seesThe inspector's day on a phone
The public parcel pageAn inspector's day on a phone

Try it

The live demo runs the fictional Town of Alder Pond, NH. Sign in as the clerk, the building inspector, a board member, an applicant, a contractor or the administrator, among others. The data resets every night and no mail goes out.

Run it in your town

The self-hosting guide sets Chiban up on a single Linux host with Docker Compose: Caddy, the app, a background worker, PostgreSQL with PostGIS, and Garage for object storage, with every image pinned by digest. Backups, restore checks, upgrades, outbound mail and card payments each have their own page in the same section.

The rest of the documentation is written for the people who use Chiban every day: land use staff, inspectors, board members, the finance office, the records custodian and the administrator.

State support

Chiban ships one state pack, New Hampshire (packs/nh). It holds the state's deadlines and holidays, notice and decision wording, appeal routes, building code editions, license types, parcel ID formats, Right-to-Know exemptions and records retention series. Adding a second state takes real work today. The state pack guide explains how the New Hampshire pack is built and what another state would need.

Built with

Next.js 16 and React 19, tRPC, Drizzle ORM on PostgreSQL 16 with PostGIS, MapLibre with vector tiles served from PostGIS, S3-compatible object storage, and pg-boss for background jobs. Tests run on Vitest, with an integration lane against a real PostGIS container, and Playwright.

Development

Prerequisites

  • Node.js 24 or newer
  • pnpm 9
  • Docker with Compose (Postgres with PostGIS, Garage for S3-compatible object storage, and Mailpit run in containers)
  • Ghostscript 10 on the PATH for PDF/A preservation (brew install ghostscript or apt-get install ghostscript)
  • OCRmyPDF with the English Tesseract data on the PATH, only to migrate scanned legacy files (brew install ocrmypdf or apt-get install ocrmypdf tesseract-ocr-eng)

Getting started

pnpm install
cp .env.example .env

Generate a secret key and put it in .env as the value for key k1 in CHIBAN_SECRET_KEYS:

node -e "console.log(require('crypto').randomBytes(32).toString('base64'))"

Start the backing services, apply migrations, seed the fictional Town of Alder Pond, and run the app:

docker compose -f docker-compose.dev.yml up -d --wait
pnpm db:migrate
pnpm storage:init
pnpm db:seed:demo
pnpm dev

In a second terminal, start the background worker. pnpm dev runs only the web app. Without the worker, emails stay queued, exports never start and scheduled jobs never run:

pnpm worker

pnpm db:seed:demo can be run again on a seeded database. It adds only what is missing, and on a day with no demo counter payments or inspector stops it adds them for that day, so the Today views are never empty. Some demo data is only created on an empty database. To start over, pnpm db:reset:demo drops every table in the database that DATABASE_URL names, then migrates and seeds again. It refuses to run unless ENABLE_DEV_SIGN_IN=true.

The app serves on http://localhost:3000. Mailpit shows outgoing mail on http://localhost:8025. If another process holds host port 1025 or 8025, set MAILPIT_SMTP_PORT or MAILPIT_UI_PORT before docker compose up and match SMTP_URL in .env. Browsers upload files straight to object storage, and pnpm storage:init sets each bucket to accept uploads only from the origins in S3_CORS_ORIGINS (comma-separated), or from the origin of BASE_URL when that is unset. .env.example lists port 3000. The e2e run derives its own origin from E2E_PORT (default 4730), so it needs no entry. To serve the app from another origin, add it to S3_CORS_ORIGINS and run pnpm storage:init again.

Dev sign-in

With ENABLE_DEV_SIGN_IN=true in .env and NODE_ENV other than production, http://localhost:3000/dev/sign-in lists the demo users (one per role, all at alderpond.example) and signs in as the one you pick.

To create a real staff account with a password and optional authenticator app:

pnpm staff:create --email you@example.test --name "Your Name" --role admin --password "a-long-password"

Then sign in at /staff/sign-in and enroll the authenticator at /staff/account/totp. Applicants and contractors sign in with an emailed link at /sign-in.

Payment processors in development

No live processor key is configured anywhere in the repository. Stripe runs against stripe-mock, which the Compose file starts on port 12111. Set STRIPE_API_BASE=http://localhost:12111 in .env (it is rejected when NODE_ENV is production) and save a Stripe account with the key sk_test_123 at /staff/settings/payments. stripe-mock is stateless and sends no webhooks, so it checks request shapes and response parsing only.

Set ENABLE_SIMULATED_PAYMENTS=true to use the simulated processor, which backs the in-app checkout page and the counter card reader panel. Both say on screen that no live processor is connected. The Clover adapter runs against a local fake server (pnpm clover:fake) and has not been verified against a live merchant account.

Address checks

Mailing address fields check what was typed against the USPS Addresses API v3 and show the standardized address under the field, with a "Use this" button that fills it in. The check runs on the server, and the browser never sees the credentials.

SettingMeaning
USPS_CLIENT_IDConsumer Key of an app registered at developers.usps.com. Set it together with USPS_CLIENT_SECRET.
USPS_CLIENT_SECRETConsumer Secret of the same app.
USPS_API_BASEDefaults to https://apis.usps.com. Use https://apis-tem.usps.com for the USPS testing environment.
USPS_STUBtrue answers from a local stand-in that capitalizes, shortens street words and adds a ZIP+4, so the suggestion can be tried without credentials. A street named Nowhere finds no match and a street named Slow runs past the timeout. Rejected when NODE_ENV is production.

With neither credential set, the fields work as plain text fields and nothing is sent anywhere. When USPS is slow (over 2 seconds), fails, or finds no match, no suggestion is shown. Each signed-in person can make 30 lookups a minute, and repeated addresses are answered from a cache for a day.

Checks

pnpm gate

Runs lint, typecheck, the unit lane (also under a west-of-UTC time zone), the integration lane against a real PostGIS container, and the term gate. Set CHIBAN_TERMS_FILE to the path of a banned-terms file to enable the term gate. It reports file and line only.

Contributing

Issues and pull requests are welcome. Run pnpm gate before opening a pull request. Fixtures, seeds and examples use the fictional Town of Alder Pond, NH, so never commit a real town's names, parcel IDs, owners or addresses.

To report a security problem, email hello@chiban.us rather than opening a public issue.

License

Chiban is licensed under the GNU Affero General Public License v3.0.

Dự án tương tự

Khám phá các dự án và mô hình AI khác có sự tương đồng.

RepositoryTypeScript
CitizenLabDotCo/citizenlab

Go Vocal is a digital democracy platform that facilitates community participation and co-creation. Participants can post ideas, contribute to discussions, or choose to vote and prioritize community projects.

241
Nov 20, 2026
RepositoryTypeScript
schemalabz/opencouncil

Making local government more transparent and accessible

76
Nov 20, 2026
RepositoryPython
okfn-brasil/querido-diario

📰 Diários oficiais brasileiros acessíveis a todos | 📰 Brazilian government gazettes, accessible to everyone.

1.4k
Oct 12, 2026
RepositoryPython
sneg55/awesome-govtech-opensource

A curated list of open source software that public bodies run to deliver services.

112
Nov 12, 2026
RepositoryTypeScript
morluto/rea

Reverse engineer anything with agents, from app behavior down to native binaries.

475.2k
Nov 23, 2026
RepositoryTypeScript
freeCodeCamp/freeCodeCamp

freeCodeCamp.org's open-source codebase and curriculum. Learn math, programming, and computer science for free.

459.4k
Nov 20, 2026
RepositoryTypeScript
nilbuild/developer-roadmap

Interactive roadmaps, guides and other educational content to help developers grow in their careers.

372.6k
Nov 23, 2026
RepositoryTypeScript
vuejs/vue

This is the repo for Vue 2. For Vue 3, go to https://github.com/vuejs/core

212.5k
Oct 10, 2024
RepositoryTypeScript
firecrawl/firecrawl

Knowledge infrastructure to make your agents smarter. Search, scrape and access 550+ data providers through one API.

207.6k
Nov 23, 2026