Feature Configuration
strapi.config.ts
All features work together. For example, services use types, and actions use both services and schemas.
Types
Generates TypeScript interfaces for all content types, components, and system types.Generated Files
collections/{name}/types.ts- Collection type interfacessingles/{name}/types.ts- Single type interfacescomponents/{name}.ts- Component interfacesshared/utils.ts- System types (media, pagination, base entities)
What’s Included
Collection Types
Collection Types
collections/article/types.ts
Single Types
Single Types
singles/homepage/types.ts
Components
Components
components/hero.ts
System Types
System Types
shared/utils.ts
Version Differences
- Strapi v5
- Strapi v4
documentId: string for all operations.Services
Generates fully-typed API service functions for fetching and mutating data.Generated Files
collections/{name}/service.ts- Collection CRUD operationssingles/{name}/service.ts- Single type operationsshared/client.ts- Strapi client wrapper
Collection Services
Every collection gets a full CRUD service:collections/article/service.ts
Single Type Services
singles/homepage/service.ts
Usage Examples
Client Options (Beta)
Pass custom authentication or base URL per request:Actions
Generates Astro Actions for type-safe server-side API operations.Generated Files
collections/{name}/actions.ts- Astro action definitions
Usage with Astro
Schemas
Generates Zod validation schemas for form handling and data validation.truewhenoutputFormat: "typescript"falsewhenoutputFormat: "jsdoc"
Generated Files
collections/{name}/schemas.ts- Create/update schemassingles/{name}/schemas.ts- Update schemascomponents/{name}.ts- Component schemas (appended to types file)
Schema Types
Each content type gets two schemas:collections/article/schemas.ts
Advanced Relations
Enable the full Strapi v5 relation API:strapi.config.ts
- Simple Relations (default)
- Advanced Relations
Form Integration
Upload
Generates file upload helpers for uploading media to Strapi.Generated Files
shared/upload-client.ts- Browser-side upload (public token)shared/upload-action.ts- Server-side Astro Action (requiresactions: true)
Two Upload Strategies
- Astro Action (Recommended)
- Public Upload Client
Server-side upload via Astro Actions. Token stays private on server.Environment:Requires:
src/components/UploadForm.tsx
features.actions: true and TypeScriptSecurity Setup
Usage with Relations
After uploading, use the returnedid to link to content:
CLI Overrides
Generate only specific features using CLI flags:CLI flags override config settings. Use for one-off regeneration without editing config.
Recommended Configurations
- Astro Project
- Next.js / React
- JavaScript Project
- Minimal (Types Only)
strapi.config.ts
Next Steps
Output Structure
See where files are generated
Using Services
Learn how to use generated services