CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl-labs/sqlite-node-best-practices

SQLite best practices for Node.js with better-sqlite3 — WAL mode, pragmas, foreign keys, STRICT tables, transactions, migrations, graceful shutdown, and query patterns

97

1.65x
Quality

98%

Does it follow best practices?

Impact

96%

1.65x

Average score across 5 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

task.mdevals/scenario-3/

Event Booking System

Problem/Feature Description

A community center needs an event booking backend built with Node.js, TypeScript, and Express. Use SQLite for the database (runs on a single on-premise server).

The system needs:

  • Events: title, description, venue name, event date, start time, end time, max capacity, ticket price, status (upcoming/ongoing/completed/cancelled).
  • Bookings: a person books one or more seats for an event. Each booking has the attendee name, email, number of seats, total cost, and booking status (confirmed/cancelled/refunded). A booking should store a reference to the event.
  • Book seats: given an event ID, attendee info, and number of seats, create a booking. Must verify the event exists, has enough remaining capacity, and the event isn't cancelled. If capacity is insufficient, reject the booking. Calculate total cost as seats * ticket price.
  • Cancel booking: mark booking as cancelled and free up the capacity. If the event has already completed, reject the cancellation.
  • Event dashboard: for a given event, show total bookings, seats sold, seats remaining, and total revenue.
  • Attendee list: for a given event, list all confirmed bookings with attendee name, email, and seats.
  • Upcoming events: list all events with status "upcoming" that have available capacity, ordered by date.

Output Specification

Produce:

  • src/db.ts — Database connection and schema
  • src/bookings.ts — Booking logic (book seats, cancel, queries)
  • src/events.ts — Event CRUD and dashboard
  • src/index.ts — Express app with routes
  • package.json — With dependencies

Complete TypeScript, no placeholders.

evals

tile.json