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
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.Configure Your Connection
Update the generated config file with your Strapi URL and token:
strapi.config.ts
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