CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl-labs/drizzle-best-practices

Drizzle ORM patterns -- schema definition, indexes, relations, migrations, transactions, upserts, prepared statements, and connection setup

96

1.60x
Quality

96%

Does it follow best practices?

Impact

98%

1.60x

Average score across 5 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

task.mdevals/scenario-1/

Blog CMS Query Layer

Problem/Feature Description

A content team is building a blog CMS with TypeScript, Drizzle ORM, and SQLite. The database has three entities: authors, posts, and comments. Each post belongs to one author and can have many comments. Posts have a status (draft, published, archived) and a published date. Comments are associated with both a post and an author (the commenter).

The frontend needs these data access functions:

  1. Published feed -- List all published posts showing only the title, author name, published date, and comment count. Sorted by most recent first.
  2. Post detail -- Get a single post with its full content, author details, and all comments (including each commenter's name), sorted by oldest comment first.
  3. Author profile -- Get an author and all their published posts with comment counts.
  4. Recent activity -- List the 20 most recent comments across all published posts, with the post title and commenter name.

The team also needs the drizzle-kit setup so they can manage schema changes going forward.

Output Specification

Produce:

  • src/db/schema.ts -- Full Drizzle schema for authors, posts, and comments
  • src/db/queries.ts -- The four query functions exported as named functions
  • src/db/db.ts -- Database connection setup
  • drizzle.config.ts -- drizzle-kit configuration
  • migration-guide.md -- Brief instructions for generating and applying migrations

evals

scenario-1

criteria.json

task.md

tile.json