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

Evaluation results

97%

33%

Blog Platform Backend

Criteria
Without context
With context

WAL mode enabled

100%

100%

Foreign keys ON

100%

100%

Busy timeout set

0%

100%

Graceful shutdown

0%

100%

Transaction for post+tags creation

100%

100%

Indexes on junction table FKs

33%

100%

Index on posts.author_id FK

100%

100%

JSON for metadata

71%

71%

CHECK constraint on post status

100%

100%

Prepared statements throughout

100%

90%

Migration pattern

16%

100%

Dates as TEXT ISO 8601

100%

100%

STRICT tables

0%

100%

Cached prepared statements

0%

100%

100%

50%

Coffee Shop Order API

Criteria
Without context
With context

WAL mode enabled

100%

100%

Foreign keys ON

100%

100%

Busy timeout set

0%

100%

synchronous = NORMAL

0%

100%

Graceful shutdown with db.close()

0%

100%

Transaction for order creation

100%

100%

Prepared statements throughout

100%

100%

Indexes on foreign key columns

0%

100%

Migration pattern used

0%

100%

Money stored as INTEGER cents

0%

100%

CHECK constraint on order status

100%

100%

STRICT tables

0%

100%

JSON for customizations

75%

100%

90%

31%

Event Booking System

Criteria
Without context
With context

WAL mode enabled

100%

100%

Foreign keys ON

100%

100%

Busy timeout set

0%

100%

Graceful shutdown

0%

100%

Atomic booking with capacity check

100%

100%

Cancel booking in transaction

100%

0%

Indexes on bookings.event_id FK

0%

100%

Prepared statements throughout

100%

100%

Money as INTEGER cents

0%

100%

CHECK constraints on statuses

100%

100%

Dates as TEXT ISO 8601

60%

60%

Migration pattern

0%

100%

STRICT tables

0%

100%

synchronous = NORMAL

0%

100%

98%

46%

Inventory Tracker Service

Criteria
Without context
With context

WAL mode enabled

100%

100%

Foreign keys ON

100%

100%

Busy timeout set

0%

100%

Graceful shutdown

0%

100%

Receive shipment uses transaction

64%

100%

Record sale uses transaction with validation

71%

100%

Indexes on FK columns

0%

100%

Prepared statements throughout

100%

100%

Money as INTEGER cents

0%

100%

Dates as TEXT for movement timestamps

50%

66%

CHECK constraint on movement type

100%

100%

Migration pattern

0%

100%

STRICT tables

0%

100%

99%

31%

Task Management App Backend

Criteria
Without context
With context

WAL mode enabled

100%

100%

Foreign keys ON

100%

100%

Busy timeout set

0%

100%

Graceful shutdown

0%

100%

Bulk import uses transaction

100%

100%

Prepared statement reuse in bulk

100%

100%

Indexes on all foreign keys

0%

100%

CHECK constraints on priority and status

100%

100%

Dates as TEXT ISO 8601

100%

100%

Migration pattern

16%

100%

Prepared statements throughout

100%

90%

STRICT tables

0%

100%

Money as INTEGER

100%

100%

Evaluated
Agent
Claude Code
Model
Claude Sonnet 4.6

Table of Contents