What is Astro's DB and how does it enable full-stack development?

Answer

Astro DB is Astro's built-in database solution, using LibSQL (SQLite) locally and Turso (distributed SQLite) in production. Define schema in db/config.ts: import { defineDb, defineTable, column } from "astro:db"; const Post = defineTable({ columns: { id: column.number({ primaryKey: true }), title: column.text(), content: column.text(), createdAt: column.date({ default: NOW }) } }); export default defineDb({ tables: { Post } });. Query in Astro pages: import { db, Post } from "astro:db"; const posts = await db.select().from(Post).where(gt(Post.createdAt, lastWeek));. The query API uses Drizzle ORM. Seed data: db/seed.ts. Push to prod: astro db push (syncs schema to Turso). Astro DB enables building full-stack apps without a separate backend — forms can write to the database via Astro Actions + Astro DB. For larger scale, swap Turso for PlanetScale, Neon, or Supabase via the standard Drizzle adapter. This makes Astro a viable choice for full-stack content applications.