Config Options
Complete reference for all configuration options in strapi.config.ts.
Configuration File
Section titled “Configuration File”import { defineConfig } from "strapi2front";
export default defineConfig({ // options here});Options Reference
Section titled “Options Reference”Type: string
Required: Yes
The base URL of your Strapi server.
url: "http://localhost:1337"// or with environment variableurl: process.env.STRAPI_URL || "http://localhost:1337"Type: string | undefined
Required: No (but needed for protected schemas)
Your Strapi API token for authentication.
token: process.env.STRAPI_TOKENapiPrefix
Section titled “apiPrefix”Type: string
Default: "/api"
The API prefix configured in your Strapi instance.
apiPrefix: "/api" // default// or custom prefixapiPrefix: "/v1"strapiVersion
Section titled “strapiVersion”Type: "v4" | "v5"
Default: Auto-detected
Explicitly set the Strapi version. Usually auto-detected.
strapiVersion: "v5"outputFormat
Section titled “outputFormat”Type: "typescript" | "jsdoc"
Default: "typescript"
Choose output format:
typescript: Generates.tsfiles with type annotationsjsdoc: Generates.jsfiles with JSDoc comments
outputFormat: "typescript" // default// or for JavaScript projectsoutputFormat: "jsdoc"moduleType
Section titled “moduleType”Type: "esm" | "commonjs"
Default: Auto-detected
Module system for JSDoc output. Auto-detected from package.json.
moduleType: "esm"output
Section titled “output”Type: object
Configure where files are generated.
output: { path: "src/strapi",}output.path
Section titled “output.path”Type: string
Default: "src/strapi"
Base output directory for generated files.
features
Section titled “features”Type: object
Enable or disable specific generators.
features: { types: true, services: true, actions: true, schemas: true, upload: false,}features.types
Section titled “features.types”Type: boolean
Default: true
Generate TypeScript interfaces for content types.
features.services
Section titled “features.services”Type: boolean
Default: true
Generate API service functions with CRUD operations.
features.actions
Section titled “features.actions”Type: boolean
Default: false
Generate Astro actions. Only works with outputFormat: "typescript".
features.schemas
Section titled “features.schemas”Type: boolean
Default: false
Generate Zod validation schemas.
features.upload
Section titled “features.upload”Type: boolean
Default: false
Generate upload helpers for file uploads to Strapi:
shared/upload-client.ts- Browser upload client (public token)shared/upload-action.ts- Astro Action for secure server-side uploads
Requires additional environment variables:
PUBLIC_STRAPI_URL=http://localhost:1337PUBLIC_STRAPI_UPLOAD_TOKEN=your-restricted-tokenschemaOptions
Section titled “schemaOptions”Type: object
Configure Zod schema generation.
schemaOptions: { advancedRelations: true,}schemaOptions.advancedRelations
Section titled “schemaOptions.advancedRelations”Type: boolean
Default: false
Enable advanced Strapi v5 relation format with connect, disconnect, and set operations.
When false:
// Relations as simple IDsauthor: z.string().optional()categories: z.array(z.string()).optional()When true:
// Relations with connect/disconnect/setcategories: z.union([ z.array(z.string()), z.object({ connect: z.array(...).optional(), disconnect: z.array(...).optional(), set: z.array(...).optional(), }),]).optional()Full Example
Section titled “Full Example”import { defineConfig } from "strapi2front";
export default defineConfig({ // Connection url: process.env.STRAPI_URL || "http://localhost:1337", token: process.env.STRAPI_TOKEN, apiPrefix: "/api", strapiVersion: "v5",
// Output format outputFormat: "typescript",
// File organization output: { path: "src/strapi", },
// Features features: { types: true, services: true, actions: true, schemas: true, },
// Schema options schemaOptions: { advancedRelations: true, },});TypeScript Support
Section titled “TypeScript Support”The defineConfig function provides full TypeScript support with autocompletion and validation:
import { defineConfig } from "strapi2front";import type { Config } from "strapi2front";
// Full type checking and autocompletionexport default defineConfig({ url: "http://localhost:1337", // ... other options});Environment-Specific Config
Section titled “Environment-Specific Config”Use environment variables for different environments:
import { defineConfig } from "strapi2front";
const isDev = process.env.NODE_ENV === "development";
export default defineConfig({ url: isDev ? "http://localhost:1337" : process.env.STRAPI_URL, token: process.env.STRAPI_TOKEN, // ... other options});