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-2/

Coffee Shop Order API

Problem/Feature Description

A local coffee shop needs a backend API for their ordering system. Build it with Node.js, TypeScript, and Express. Use SQLite as the database (the shop runs everything on a single server).

The system needs to support:

  • Managing menu items (name, description, category like "espresso"/"tea"/"pastry", price, and whether it's currently available)
  • Creating an order: accepts a customer name and a list of items (each with menu_item_id, size, quantity, and any customizations like milk type or extra shots as a JSON blob). The order and all its items must be saved together — if any item references a non-existent menu item, the whole order should fail.
  • Updating order status through its lifecycle: received -> preparing -> ready -> picked_up (also allow cancellation from any state)
  • Getting an order by ID with all its items and their menu item names
  • Listing today's orders filtered by status
  • Getting a daily sales summary: total orders, total revenue, breakdown by category

Output Specification

Produce:

  • src/db.ts — Database connection and schema setup
  • src/routes/menu.ts — Menu item CRUD routes
  • src/routes/orders.ts — Order routes
  • src/index.ts — Express app setup
  • package.json — With required dependencies

The code should be complete TypeScript with no placeholders or TODO comments.

evals

tile.json