TypeScript 6,540 FILES 10 FINDINGS

HOW ASTRO
ACTUALLY WORKS

The web framework for content-driven websites. Conventions, patterns, and architecture extracted from the withastro/astro repository by sourcebook.

QUICK_REF:
Validation: Zod schemas Testing: Node.js built-in test runner Integrations: packages/integrations/

WHAT_MATTERS

  • astro.ts is a hub file (imported by 88 files) — changes here ripple everywhere

  • 17 third-party integrations under packages/integrations/ — each has its own directory

  • Circular import chains detected — avoid adding to these cycles

KEY_FINDINGS

This is a monorepo. Changes may affect multiple packages. Check workspace dependencies before modifying shared code.

HIGH

Tests are co-located with source files (*.test.ts next to *.ts). Keep this pattern.

HIGH

Project uses barrel exports (index.ts files that re-export). Import from the directory, not from deep paths.

HIGH
5 barrel export files found

Use Zod schemas for validation. This is the project's standard validation approach.

HIGH
5 files use Zod

Tests use Node.js built-in test runner.

HIGH
15 test files

UI components live in: packages/integrations/vue/test/fixtures/ directories.

HIGH
3 component directories

Third-party integrations live under packages/integrations/ (web-vitals, vue, vercel, tailwind, svelte, solid, ...). Each integration has its own directory.

HIGH
17 integrations found

Hub files: packages/astro/src/types/astro.ts (88 files); packages/astro/src/core/errors/index.ts (71 files); packages/astro/src/types/public/internal.ts (68 files); packages/astro/src/core/logger/core.ts (67 files); packages/astro/src/types/public/config.ts (55 files). Changes here have the widest blast radius.

HIGH

Circular import chains detected: shiki.ts → types.ts; generate-sitemap.ts → index.ts; index.ts → validate-options.ts. Avoid adding to these cycles.

HIGH

54 dead code candidates.

HIGH
GENERATED IN ~3 SECONDS WITH

npx sourcebook init

VIEW ON GITHUB star

FROM_THE_BLOG

RELATED_REPOS