Add support for defining collections in TypeScript configuration files,
providing a developer-friendly, version-controlled approach to schema
management alongside the existing UI-based collection creation.
## Features
- **Type System**: Comprehensive TypeScript types for collection schemas
with 20+ field types (string, richtext, media, reference, etc.)
- **Auto-Sync**: Collections automatically sync to database on app startup
via bootstrap middleware
- **Hybrid Approach**: Config-managed and UI-created collections work
seamlessly together
- **UI Indicators**: Purple "Config" badge in admin UI shows which
collections are managed by code (read-only)
- **Example Collections**: Blog posts, pages, and products examples
included in src/collections/
- **CLI Tooling**: `npm run sync-collections` command for manual sync info
- **Database Migration**: Added `managed` field to collections table
with indexes for performance
## Files Added
- src/types/collection-config.ts - TypeScript type definitions
- src/services/collection-loader.ts - Config file loader
- src/services/collection-sync.ts - Database sync service
- src/collections/*.collection.ts - Example collections
- src/collections/README.md - Quick reference guide
- scripts/sync-collections.ts - CLI sync command
- migrations/011_config_managed_collections.sql - Database migration
- docs/collections-config.md - Comprehensive documentation
## Files Modified
- src/db/schema.ts - Added managed field to collections table
- src/middleware/bootstrap.ts - Integrated collection sync
- src/routes/admin.ts - Added managed field to queries
- src/templates/pages/admin-collections-list.template.ts - UI badges
- package.json - Added sync-collections script
## Benefits
- Version control: Track schema changes in Git
- Type safety: Full TypeScript support with IDE autocomplete
- Deployment: Collections travel with code across environments
- Code review: Schema changes go through PR process
- Repeatability: Easy to replicate environments
- Documentation: Config files serve as living documentation
馃 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>