All templates
GovTech

Keystone

Verify once, apply for every benefit

keystone.cloud.nexlayer.ai
Keystone app screen

A consent-based verification layer for public benefits. Applicants verify income, residency and household once, straight from the source, then apply to many programs with the same verified record. Caseworkers see what was verified, when, and under which consent.

Who uses it: Applicants, caseworkers at agencies and nonprofits, and enrollment agents acting for applicants.

Screens

Applicant consent

Plain-language consent per data source, with scope and expiry, and one-click revoke.

Verified profile

Income, residency, household and identity cards, each with its source and verification date.

Program matches

Eligibility per program with the reason, and Apply with verified data.

Caseworker inbox

Applications by program and status, with what is still missing.

Consent log

Every access to an applicant's data: who, what, when, under which consent.

How it runs

Live on Nexlayer · keystone.cloud.nexlayer.ai
Browser
your users
/↓
web
React · Vite
/api↓
api
Go · OpenAPI
postgres.pod↓
postgres
Postgres 16 · volume

Data model

  • applicants
    id, name, email, phone, created_at
  • consents
    id, applicant_id, source (irs | state_dmv | ssa | payroll), scope[], granted_at, expires_at, revoked_at
  • verifications
    id, applicant_id, kind (income | residency | household | identity), value jsonb, source, verified_at, consent_id
  • programs
    id, code (SNAP | MEDICAID | LIHEAP | WIC), name, rules jsonb
  • eligibility_results
    id, applicant_id, program_id, result (eligible | likely | not_eligible), reasons[], computed_at
  • applications
    id, applicant_id, program_id, status, submitted_at, caseworker_id
  • access_log
    id, applicant_id, actor_id, actor_kind (caseworker | agent), purpose, fields[], at

API

  • POST/api/consents
    Grant consent for a source and scope
  • DELETE/api/consents/{id}
    Revoke consent
  • POST/api/verifications/run
    Pull from a source (mock connectors) and store the result
  • GET/api/applicants/{id}/profile
    Verified profile (logs the access)
  • GET/api/applicants/{id}/eligibility
    Eligibility per program with reasons
  • POST/api/applications
    Apply with the verified record (idempotent)
  • GET/api/caseworker/applications
    Caseworker inbox
  • GET/api/applicants/{id}/access-log
    Who accessed what

Build it with your agent

Copy the prompt into Claude Code, Codex, Cursor or any coding agent connected to Nexlayer. It works from a spec: contracts first, then each phase with checks that must pass, then it ships to Nexlayer and verifies the live app.

Build graph · one agent, phase by phase
  1. 1Spec + contract
  2. 2API
  3. 3Web
  4. 4End-to-end test
  5. 5Ship + verify
Build Keystone: verify once, apply for every benefit. A production full-stack web application, deployed live on Nexlayer.

Work spec-first. Before writing app code, write SPEC.md (from the spec below, plus your decisions), api/openapi.yaml and the first migration, and show me a short plan. Then build in phases and don't move on until each phase's checks pass.

## Product
A consent-based verification layer for public benefits. Applicants verify income, residency and household once, straight from the source, then apply to many programs with the same verified record. Caseworkers see what was verified, when, and under which consent.
Users: Applicants, caseworkers at agencies and nonprofits, and enrollment agents acting for applicants.

## Screens
- Applicant consent: Plain-language consent per data source, with scope and expiry, and one-click revoke.
- Verified profile: Income, residency, household and identity cards, each with its source and verification date.
- Program matches: Eligibility per program with the reason, and Apply with verified data.
- Caseworker inbox: Applications by program and status, with what is still missing.
- Consent log: Every access to an applicant's data: who, what, when, under which consent.

## Data model (Postgres)
- applicants(id, name, email, phone, created_at)
- consents(id, applicant_id, source (irs | state_dmv | ssa | payroll), scope[], granted_at, expires_at, revoked_at)
- verifications(id, applicant_id, kind (income | residency | household | identity), value jsonb, source, verified_at, consent_id)
- programs(id, code (SNAP | MEDICAID | LIHEAP | WIC), name, rules jsonb)
- eligibility_results(id, applicant_id, program_id, result (eligible | likely | not_eligible), reasons[], computed_at)
- applications(id, applicant_id, program_id, status, submitted_at, caseworker_id)
- access_log(id, applicant_id, actor_id, actor_kind (caseworker | agent), purpose, fields[], at)

## API
- POST /api/consents — Grant consent for a source and scope
- DELETE /api/consents/{id} — Revoke consent
- POST /api/verifications/run — Pull from a source (mock connectors) and store the result
- GET /api/applicants/{id}/profile — Verified profile (logs the access)
- GET /api/applicants/{id}/eligibility — Eligibility per program with reasons
- POST /api/applications — Apply with the verified record (idempotent)
- GET /api/caseworker/applications — Caseworker inbox
- GET /api/applicants/{id}/access-log — Who accessed what

## Seed data
4 programs with eligibility rules, mock connectors for IRS, state DMV and payroll, 30 applicants in different states of verification, 2 caseworkers.

## Core flow (must work end to end)
An applicant grants consent, verification runs, the profile shows verified income, they apply to two programs, and a caseworker sees both applications and the access log entry.

## Stack (fixed)
- web/: React 19 + TypeScript (strict) + Vite, React Router, TanStack Query, Tailwind CSS. A typed API client generated from the OpenAPI spec. Served as static files by a small web server in its own container.
- api/: Go (latest stable), net/http with Go 1.22+ routing patterns or chi, pgx v5, sqlc for queries, golang-migrate for migrations, log/slog JSON logs, OpenAPI 3.1 spec in api/openapi.yaml as the contract.
- Postgres 16, on a persistent volume.

## Engineering bar
- Contract first: api/openapi.yaml is the source of truth; the Go handlers and the web client are generated from or checked against it.
- Errors as RFC 9457 problem+json. Validate every input at the edge. Cursor pagination on every list.
- Auth: email magic link or password with argon2id; HTTP-only, SameSite session cookies; role checks in the API, never only in the UI.
- Idempotency keys on every POST that creates or submits something. Request timeouts via context. Graceful shutdown.
- GET /api/healthz (process up) and GET /api/readyz (database reachable, migrations applied).
- Migrations run on start, forward only. Seed data behind a SEED=true flag.
- Web: loading, empty and error states on every screen; keyboard accessible; no layout shift.
- Tests: Go table-driven tests, integration tests against a real Postgres (testcontainers), and one Playwright test for the core flow. Lint and typecheck clean.

## Phases
1. Contract: SPEC.md, openapi.yaml, schema and migrations, seed data. Check: migrations apply cleanly to an empty database.
2. API: every endpoint in the spec, with auth and role checks. Check: Go tests and integration tests pass.
3. Web: every screen, wired to the API through the generated client. Check: typecheck and lint pass; every screen has loading, empty and error states.
4. End to end: the Playwright test for the core flow passes locally.
5. Ship on Nexlayer (below).

## Ship it on Nexlayer
- Load the Nexlayer skill first: call nexlayer_get_skill_content with skillName "ship-it-nexlayer" and follow it.
- Dockerfiles: multi-stage, small runtime images, built for linux/amd64.
- nexlayer.yaml: three parts. web with path "/", api with path "/api", postgres with no path (private) and a volume. Set PGDATA to a subdirectory of the volume mount. The api reaches the database at postgres.pod; the browser reaches the api at <% URL %>/api. Secrets are ${NAME} references, never values.
- Deploy with `nexlayer ship --check /api/readyz` if the Nexlayer CLI is installed, otherwise through the Nexlayer MCP (validate, deploy, check status).
- Don't stop at "deployed": open the live URL, run the core flow against it, and send me the URL with what you verified.

New to Nexlayer? Connect your agent first