Skip to main content

๐Ÿง™โ€โ™‚๏ธ Models in Cascade

Models are the magical heart of your data in Cascade! They turn raw database documents into powerful, type-safe, and feature-rich objects you'll love to work with. โœจ

๐Ÿš€ Why Use Models?โ€‹

  • Type safety: Your data is always the right shape and type.
  • Smart defaults: Set default values, casting, and more.
  • Relationships: Connect your data with ease (users, posts, categories, you name it!).
  • Events: Hook into every actionโ€”create, update, delete, and more.
  • DX magic: Enjoy a modern, delightful developer experience with Warlock.js!

๐Ÿ—๏ธ What Can Models Do?โ€‹

  • Define your schema with casts and defaults.
  • Save, update, delete, and restore documents.
  • Embed other models (even deeply nested!).
  • Listen to events and react to changes.
  • Query with expressive, powerful filters.
  • Control what gets embedded, saved, or shown.

๐Ÿง™โ€โ™‚๏ธ Pro Tipโ€‹

Models are the foundation of everything in Cascade. Master them, and you'll unlock the full power of Warlock.js!


๐ŸŒŸ What's Next?โ€‹