Structure Overview
strapi.config.ts
Collections vs Singles
- Collections
- Singles
Content types that have multiple entries (articles, products, users, etc.)Location:
collections/{singular-name}/Files:types.ts- Type definitions + filtersschemas.ts- Create/update validationservice.ts- Full CRUD operationsactions.ts- Astro action wrappers
File Naming
All folder and file names use kebab-case derived from your Strapi content type names:The converter uses
singularName from Strapi (e.g., “article”, “blogPost”) and converts to kebab-case.Import Patterns
strapi2front does NOT generate barrel exports (index.ts). Always import from specific files:
Multiple Imports from Same Feature
Generated File Contents
Types File
collections/{name}/types.ts
collections/{name}/types.ts
- Interface extending
StrapiBaseEntity - Relations imported from other types
- Filter interface for querying (collections only)
collections/{name}/schemas.ts
collections/{name}/schemas.ts
- Create schema (required fields enforced)
- Update schema (all fields optional)
- TypeScript types inferred from schemas
collections/{name}/service.ts
collections/{name}/service.ts
See Features > Services for complete service API.Exports:
{name}Serviceobject with methods:findMany()- Paginated listfindAll()- All entries (auto-paginated)findOne()- By documentId/idfindBySlug()- By slug (if exists)create()- Create newupdate()- Update existingdelete()- Deletecount()- Count with filters
collections/{name}/actions.ts
collections/{name}/actions.ts
Components
Components generate a single file with type + schema:components/{name}.ts
components/{name}.ts
Shared Files
Path Alias Setup
For cleaner imports, configure a path alias in your project:- TypeScript
- Astro
- Next.js
- Vite
tsconfig.json
Why By-Feature?
Scalability
Scalability
Projects can grow to hundreds of content types without becoming unwieldy. Each content type is isolated in its own folder.
Encapsulation
Encapsulation
Everything related to a content type lives together. Want to see all article-related code? Look in
collections/article/.No hunting across types/, services/, schemas/ folders.Clear Dependencies
Clear Dependencies
Import paths clearly show relationships:
Easy Refactoring
Easy Refactoring
Renaming or removing a content type? Just delete/rename its folder. All related code is co-located.
Alternative Structures
strapi2front currently only supports by-feature structure. Future versions may add:- By-type structure - Group by file type (
types/,services/, etc.) - Flat structure - All files in one directory
- Custom templates - Define your own structure
Interested in other structures? Open an issue to discuss!
Output Example
With this Strapi schema:- Collections: Article, Author, Category
- Singles: Homepage
- Components: SEO, Hero
Next Steps
Using Services
Learn how to use generated services
Type Safety
Understand the type system