Skip to content

[Dev tool] Validate settings at startup and add DATABASE_URL to the Hono.js API template #1228

Open
common-grants/cg-api-template-hono
#4

Description

@laurabelinfante

Award: $50

Summary

The template checks its own settings by hand, and only checks PORT. The porting guide tells you to read your database connection string from the environment and put it in .env, but never says what to call it, and .env.example only lists PORT. Add one settings file, src/env.ts, that validates PORT and DATABASE_URL when the server starts, then list DATABASE_URL in .env.example and name it in the porting guide. DATABASE_URL stays optional, because the template runs on its bundled sample data until you connect a database.

Acceptance criteria

  • src/env.ts checks settings once at startup with a Zod schema covering PORT and an optional DATABASE_URL, and replaces the PORT check in src/index.ts
  • An invalid PORT (for example PORT=abc) or an invalid DATABASE_URL (for example DATABASE_URL=not-a-url) stops the server before it starts (exit code 1) and prints each failing setting and why. An empty or unset PORT still starts on 3000.
  • DATABASE_URL, when set, must be a URL (any scheme)
  • .env.example lists DATABASE_URL alongside PORT
  • The porting guide names DATABASE_URL as the setting for the connection string
  • Tests in test/ cover a valid config, a bad PORT, an empty PORT, and a bad DATABASE_URL
  • Continuous integration passes
  • Changes follow the template's own CONTRIBUTING.md

Where to look

The template has its own repository, common-grants/cg-api-template-hono. Start with the PORT check in src/index.ts, which the new settings file replaces, then .env.example and section 1 of PORTING.md. Zod is already a dependency. Open your pull request in cg-api-template-hono and put Closes HHS/simpler-grants-protocol#1228 in its description.

In your claim's approach line, tell us how you'll keep an empty PORT from turning into 0. In your pull request, tell us one thing in PORTING.md that was unclear when you first read it, or say "nothing."

To claim this issue

Open a comment with /claim and include the following, pasting the confirmation exactly as written. See the paid contributor terms.

/claim

- [x] I confirm that I am a United States person aged eighteen or over, that I meet the eligibility requirements in section 1 of the paid contributor terms, that I have read and I agree to the paid contributor terms, and that any work I submit is mine to contribute.

GitHub username: @your-username
Does your organization benefit from this work? If yes, how:
How I plan to approach this: one line

The program administrator will assign the issue and post your deadline. Please do not start substantial work before the issue is assigned to you.

Once you're assigned, email commongrants-contributors@agile6.com with your GitHub username and a link to the issue, so we can reach you privately about payment.

Your pull request title should follow the title format in CONTRIBUTING.md. If it doesn't, a maintainer will fix it before merging.

Claims

Maintained by the program administrator. The first complete claim is assigned. The others are listed in the order they claimed and are offered the issue if it comes free.

Contributor Eligibility confirmed Status Deadline Pull request
@robbzzilla Yes Assigned December 2, 2026

Activity

  1. SnowboardTechie commented on Sep 23, 2026

    @SnowboardTechie
  2. changed the title [-][Dev tool] Add `DATABASE_URL` and a `.env.example` to the Hono.js API template[/-] [+][Dev tool] Validate settings at startup and add `DATABASE_URL` to the Hono.js API template[/+] on Oct 29, 2026
  3. added
    help wantedExtra attention is needed
    funded: contributionA funded issue for work in a CommonGrants repository
    and removed
    featureNew capability. Belongs on a hold branch.
    on Oct 29, 2026
  4. robbzzilla commented on Nov 17, 2026

    @robbzzilla

    /claim

    • I confirm that I am a United States person aged eighteen or over, that I meet the eligibility requirements in section 1 of the paid contributor terms, that I have read and I agree to the paid contributor terms, and that any work I submit is mine to contribute.

    GitHub username: @robbzzilla
    Does your organization benefit from this work? If yes, how: Robert Hampton is contributing independently. His engineering revenue project would benefit from the award and implementation experience.
    How I plan to approach this: Normalize an unset or empty PORT to 3000 before Zod coercion, validate PORT and optional DATABASE_URL once at startup, report every invalid field, then update .env.example, PORTING.md and the required regression tests.

    Submitted on Robert Hampton's behalf by his authorized AI assistant. Robert personally confirmed eligibility and that he has read and agrees to the paid contributor terms. Implementation and verification will use disclosed AI assistance under this account. We will wait for assignment and the recorded deadline before substantial implementation.

  5. laurabelinfante commented on Nov 18, 2026

    @laurabelinfante
    CollaboratorAuthor

    Hi @robbzzilla, this is assigned to you. Your deadline to open a pull request that's ready for review is December 2, and we'll check in here on November 25.

    Next step: please email commongrants-contributors@agile6.com with your GitHub username and a link to this issue, so we can reach you privately about payment.

    For the record, you've disclosed that your independent engineering business may benefit from the award and the experience of this work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

funded: contributionA funded issue for work in a CommonGrants repositoryhelp wantedExtra attention is needed

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions