Info Hawker Australia is a Deno-based backend that exposes fuzzy address search over the Australian G-NAF dataset while maintaining a separate application database.
- Deno 2 runtime (TypeScript)
- Prisma ORM (Deno runtime target) with
@prisma/adapter-pg - PostgreSQL with
pg_trgmand PostGIS extensions - Pino logger
pgconnection pools via Prisma adapter- Domain-driven design structure (application, domain, infrastructure, interfaces)
G-NAF/
ββ prisma/
β ββ schema.main.prisma # Prisma schema for `info_hawker` DB
β ββ schema.gnaf.prisma # Prisma schema for `gnaf` DB
ββ scripts/
β ββ init-main-db.sql # Enables pg_trgm in main DB
β ββ init-gnaf-db.sql # Enables postgis + pg_trgm in G-NAF DB
ββ src/
β ββ application/
β β ββ services/ # Use cases (e.g. address lookup)
β ββ config/ # Environment loading and typed config
β ββ domain/
β β ββ models/ # Entities & value objects
β β ββ repositories/ # Repository interfaces
β ββ infrastructure/
β β ββ db/ # Prisma clients, repositories, migrations
β β ββ di/ # Dependency injection container & bootstrap
β β ββ logging/ # Pino logger factory
β ββ interfaces/
β ββ http/ # HTTP server, middleware, handlers
ββ deno.json # Tasks, import map aliases, formatting rules
ββ README.md # Project documentation
Copy .env.example to .env and fill in values:
cp .env.example .env
Key variables:
APP_PORTβ HTTP server portMAIN_DATABASE_URL/MAIN_SHADOW_DATABASE_URLGNAF_DATABASE_URL/GNAF_SHADOW_DATABASE_URLLOG_LEVEL
- Create two PostgreSQL databases:
info_hawker(application) andgnaf(reference). - Run the initialization SQL scripts to enable required extensions:
psql -d info_hawker -f scripts/init-main-db.sql
psql -d gnaf -f scripts/init-gnaf-db.sql
- Unpack the official
G-NAF AUGUST 2025dataset intodata/raw/G-NAF AUGUST 2025/(the existingdata/Contents.txtlists every expected file). - Run
deno task db:seedto load the reference data and bootstrap the application database.
deno task db:seed performs two actions:
- Truncates every table in the
gnafschema and streams each.psvfile through PostgreSQL'sCOPY ... FROM STDINusingpg-copy-streams. This preserves the split-per-state layout and requires a role that can togglesession_replication_role(superuser in the default docker setup). - Refreshes the
gnaf."ADDRESS_AUTOCOMPLETE"materialized view, keeping the autocomplete indexes in sync with the raw data. - Inserts baseline tenants into the
info_hawkerdatabase.
Seeding expects the raw dataset to remain in data/raw/G-NAF AUGUST 2025/Standard/ and
data/raw/G-NAF AUGUST 2025/Authority Code/. The script logs per-table ingestion counts; enable
LOG_LEVEL=debug for per-file progress when troubleshooting.
A convenience docker-compose.yml is provided to bootstrap PostgreSQL 18 (Alpine) locally:
docker compose up -d
This starts postgres alongside pgAdmin and mounts the SQL initialization scripts. Update
credentials in .env or the compose file as needed.
Real Prisma clients are required to replace the placeholder stubs in
src/infrastructure/db/generated/*/deno/edge.ts.
deno task prisma:generate
This runs both schemas sequentially:
deno task prisma:generate:main
deno task prisma:generate:gnaf
Ensure the MAIN_DATABASE_URL, MAIN_SHADOW_DATABASE_URL, GNAF_DATABASE_URL, and
GNAF_SHADOW_DATABASE_URL variables are defined before running.
deno task dev
deno task start
GET /healthβ Health probeGET /addresses/search?q=<query>&limit=<n>&threshold=<float>β Fuzzy address suggestions usingpg_trgm(alias:/addresses/autocomplete). Queries must be at least 2 characters and returnid,displayLine(including level/flat/unit information),locality,state,postcode, andscorefor autocomplete drop-downs.GET /addresses/{addressDetailPid}β Returns the detailed G-NAF record (including coordinates and component parts) for a specific addressGET /addresses/nearby?lat=<latitude>&lng=<longitude>&radius=<meters>&limit=<n>β Reverse lookup for the closest addresses to a latitude/longitude pair (defaults:radius=500m,limit=10)
Logging is handled by Pino. Configure LOG_LEVEL (info, debug, etc.) in the environment file.
Tokens are defined in @infrastructure/di/bootstrap.ts. Call setupContainer() before resolving
dependencies (this is handled in src/main.ts).
- Use Prisma with Deno runtime (
runtime = "deno") and generated clients committed tosrc/infrastructure/db/generated/. - Maintain separation between
info_hawker(application) andgnaf(reference) databases. - Keep new modules aligned with the existing DDD directory layout (
application/,domain/,infrastructure/,interfaces/). - SQL migrations should live in
scripts/or Prisma migrations as appropriate; enablepg_trgmfor fuzzy search. - Avoid circular dependencies in DI registrations.
- Update documentation when adding new tasks or environment variables.
- Run
deno fmtanddeno lintper repo defaults. - When adding new HTTP handlers, register them through the DI container and
createHttpServer()routing. - Placeholder Prisma clients will throw if used before generationβalways run
deno task prisma:generateafter schema changes.
Internal project. Add licensing details here if the project becomes public.