Prerequisites
Before you begin, make sure you have:- Node.js 18+ installed on your machine
- A Strapi v4 or v5 instance running (local or remote)
- An API token from your Strapi admin panel
Installation
1
Install Strapi2Front
Install the CLI as a dev dependency in your project:
2
Initialize Configuration
Run the init command to create a configuration file:This creates a
strapi.config.ts file in your project root with sensible defaults.3
Configure Your Connection
Update the generated config file with your Strapi URL and token:
strapi.config.ts
4
Generate Code
Run the sync command to fetch your Strapi schema and generate code:You should see output like:
Using Generated Code
Once generation completes, you can import and use the generated types and services:- Fetch Data
- With Relations
- Form Validation
Add to Your Workflow
Add a script to yourpackage.json to regenerate code when your Strapi schema changes:
package.json
Next Steps
Configuration
Explore all configuration options
Services Guide
Learn about generated service methods
Framework Setup
Set up your framework integration
API Reference
View the complete CLI reference