What Gets Generated
When you runnpx strapi2front sync, the generator creates:
Collection Types
TypeScript interfaces with full type safety for all your collection types
Single Types
Interfaces for single types like homepage, settings, etc.
Components
Reusable component interfaces referenced by your content types
Utility Types
Helper types for media, pagination, responses, and more
Generated File Structure
Collection Type Example
For a Blog Article collection type in Strapi, the generator creates:Attribute Type Mappings
strapi2front maps Strapi field types to TypeScript types:- Basic Types
- Advanced Types
Utility Types
The generator also creates utility types inutils.ts:
StrapiBaseEntity
StrapiBaseEntity
Base interface that all content types extend. Contains system fields.
StrapiMedia
StrapiMedia
Type definition for media files (images, videos, etc.)
BlocksContent (Strapi v5)
BlocksContent (Strapi v5)
Rich text blocks for Strapi v5’s new blocks editor.
For full type support and rendering, install
@strapi/blocks-react-renderer then re-run npx strapi2front sync.StrapiResponse & StrapiListResponse
StrapiResponse & StrapiListResponse
Wrapper types for API responses with metadata.
Using Generated Types
Import Types in Your Components
pages/blog/[slug].astro
Type-Safe Data Fetching
utils/blog.ts
Working with Relations
components/ArticleCard.tsx
Field Validation Attributes
The generator includes validation constraints from your Strapi schema as JSDoc comments:Dynamic Zones
For dynamic zones (flexible content areas), the generator creates discriminated unions:Types are automatically regenerated when you run
npx strapi2front sync. Make sure to sync after changing your Strapi schema.Next Steps
Services
Learn how to use generated service functions for data fetching
Schemas
Validate form data with generated Zod schemas
Relations
Working with related content types
Media
Handle images and file uploads