LEARN. PRACTICE. EXPLAIN.
Learning paths & interview practiceP
← Build a support-ticket app
BUILD → VERIFY → EXPLAIN · STEP 1 OF 6

Define the database and request contract

Use real constraints and clear validation errors.

UNDERSTAND

Bring these concepts with you

BUILD

Your implementation

  1. Download all seven starter files into one folder. Use Node.js 22.13 or newer, which supplies node:sqlite. No packages are required.
  2. Implement initializeSchema with users, sessions and tickets tables. Enable foreign keys and constrain ticket text, status and version. The supplied auth adapter seeds four fixed demo users.
  3. Implement validateTicket. Trim title and body, enforce their lengths, reject unknown identity fields, and return field errors with HTTP 422.
export function initializeSchema(db) { /* create tables and constraints */ }
export function validateTicket(input) { /* validate title and body */ }
Need a hint?
  • Start from the documented column names used by auth.mjs and the provided HTTP adapter.
  • A browser validation message improves usability; server validation and database constraints protect the stored data.

Saved on this device · 0 / 6000 · Do not include passwords or private data.

VERIFY

Acceptance checks

From the folder containing your downloaded files, run:

node checks.mjs ./starter.mjs 1

This runs checks up to this step. Earlier steps must work first. Mark each result only after checking your implementation; the website does not run or grade it.

Record your attempt to enable the checklist and reference comparison.

Compare with the reference

Attempt the step first, then compare decisions and behavior. There can be more than one correct implementation.

EXPLAIN

Your interviewer asks

Why do you need database constraints when your API already validates requests?

Say your answer aloud, then record the trade-offs and evidence in your notes above.

LOCAL VOICE REHEARSAL

Rehearse your step walkthrough aloud

Target pacing: 02:00 · Stays in this browser only; never uploaded.

00:00/ 02:00
AlifBay Prep