- Go 81.2%
- HTML 18.2%
- JavaScript 0.6%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .opencode/agents | ||
| cmd | ||
| docs | ||
| internal | ||
| migrations | ||
| queries | ||
| src | ||
| static | ||
| templates | ||
| tests | ||
| .env.example | ||
| .gitignore | ||
| AGENTS.md | ||
| CHANGELOG.md | ||
| docker-compose.yml | ||
| go.mod | ||
| go.sum | ||
| opencode.json | ||
| README.md | ||
| sqlc.yaml | ||
PMVIC Uploader
Internal web application for PMVIC vehicle lookup, emission-result validation, synchronous LTMS upload, and transaction tracking.
Getting started
- Start PostgreSQL:
docker compose up -d postgres
- Apply migrations with Goose:
go run github.com/pressly/goose/v3/cmd/goose@latest -dir migrations postgres "$DATABASE_URL" up
For a local PostgreSQL install using peer/socket authentication, this project was verified with:
createdb eney
goose -dir migrations postgres "postgres:///eney?host=/var/run/postgresql" up
DATABASE_URL="postgres:///eney?host=/var/run/postgresql" go run ./cmd/web
- Run the web app:
go run ./cmd/web
- Open
http://localhost:8080.
Development users:
[email protected]/password123[email protected]/password123
Mock lookup values:
GAS123or any normal value returns a gasoline SUV.DIESELreturns a diesel utility vehicle.MOTO,MOTORCYCLE,TRICYCLE, orMOPreturns a motorcycle.NOTFOUNDreturns no vehicle.TEMPFAILreturns a temporary lookup failure.REJECTreturns a vehicle but the mock upload is rejected.UNKNOWNreturns a vehicle but the mock upload outcome is unknown.
LTMS modes
The app defaults to deterministic mock mode for development:
LTMS_MODE=mock go run ./cmd/web
Direct LTO mode is intended only when the web server runs from an LTO-authorized IP and production upload settings are configured:
LTMS_MODE=direct \
PMVIC_CENTER="Configured Center" \
ITP_CODE="configured-itp-code" \
INSPECTOR_USERNAME="configured-inspector" \
go run ./cmd/web
Optional direct-mode settings:
LTMS_SEARCH_URL, defaulting to the documentedget_vehicleinfoendpoint.LTMS_UPLOAD_URL, defaulting to the documentedstore_testresultsendpoint.LTMS_SEARCH_TIMEOUT, default60s.LTMS_UPLOAD_TIMEOUT, default600s.
TLS certificate verification remains enabled. Failed or uncertain uploads are not retried automatically.
Uploader Agent
Remote uploader agents wrap the LTMS lookup and upload API from an LTO-authorized site. The web app calls agents synchronously over the private Netbird/WireGuard network and requires a per-agent bearer token.
Run an agent on an authorized site:
UPLOADER_AGENT_TOKEN="change-this-token" \
HTTP_ADDR=":8090" \
go run ./cmd/uploader
Register the agent as an admin or manager in /admin/uploaders with its Netbird HTTP URL, token,
priority, and daily allocation. Lower priority numbers are used first. Successful
uploads count against allocation; unresolved UNKNOWN uploads hold allocation
until reconciled. Vehicle lookup remains direct from the main app by default,
but agents expose /agent/v1/lookup and have a lookup-enabled switch for future
fallback use.
Development Commands
sqlc generate
gofmt -w cmd internal
go test ./...
go build ./...
Project documentation
AGENTS.md: Instructions for AI coding agentsdocs/PROJECT.md: Goals, users, scope, and constraintsdocs/ARCHITECTURE.md: Components and data flowdocs/DECISIONS.md: Architectural decision recordsdocs/CURRENT_STATE.md: Continuation notes for future sessionsdocs/TESTING.md: Test commands and strategydocs/BACKLOG.md: Deferred and upcoming work
OpenCode subagents
@review: Read-only review of current changes@project-docs: Updates project documentation after implementation