or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

configuration.mddatabase.mdgeneration.mdindex.mdtemplates.md
tile.json

tessl/npm-strapi--generate-new

Generate a new Strapi application with TypeScript/JavaScript support, database configuration, and template system.

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/@strapi/generate-new@4.25.x

To install, run

npx @tessl/cli install tessl/npm-strapi--generate-new@4.25.0

index.mddocs/

Strapi Generate New

@strapi/generate-new is a powerful generator tool for creating new Strapi applications with comprehensive template support, database configuration, and development tooling setup. It provides both interactive and command-line interfaces for scaffolding Strapi CMS projects with TypeScript or JavaScript, various database backends, and custom templates.

Package Information

  • Package Name: @strapi/generate-new
  • Package Type: npm
  • Language: TypeScript
  • Installation: npm install @strapi/generate-new

Core Imports

import { generateNewApp, checkInstallPath } from "@strapi/generate-new";
import type { NewOptions } from "@strapi/generate-new";

For CommonJS:

const { generateNewApp, checkInstallPath } = require("@strapi/generate-new");

Basic Usage

import { generateNewApp } from "@strapi/generate-new";

// Create a new Strapi application with default options
await generateNewApp("./my-strapi-app", {
  quickstart: true,
  typescript: true,
  useNpm: false
});

// Create with custom database configuration
await generateNewApp("./my-strapi-app", {
  dbclient: "postgres",
  dbhost: "localhost",
  dbport: "5432",
  dbname: "myapp",
  dbusername: "postgres",
  dbpassword: "password",
  typescript: true
});

Architecture

@strapi/generate-new is built around several key components:

  • Generation Engine: Core generateNewApp function that orchestrates the entire project creation process
  • Project Creation Strategies: Multiple creation modes (quickstart, customized, CLI database) based on user preferences
  • Template System: Support for custom templates and starter configurations from npm or URLs
  • Database Integration: Configuration and setup for SQLite, PostgreSQL, and MySQL databases
  • Package Manager Detection: Automatic detection and support for both npm and Yarn workflows
  • File Generation: Template-based file and configuration generation for both TypeScript and JavaScript projects
  • Error Tracking: Integrated Sentry error reporting and usage analytics

Capabilities

Main Generator Function

Core application generation functionality that creates new Strapi projects with comprehensive configuration options.

function generateNewApp(
  projectDirectory: string,
  options: Partial<NewOptions>
): Promise<void>;

Application Generation

Installation Path Validation

Utility for validating that the target directory is suitable for creating a new Strapi application.

function checkInstallPath(rootPath: string): Promise<void>;

Project Creation Types

Different project creation strategies based on configuration and user preferences.

interface NewOptions {
  useNpm: boolean;
  run: boolean;
  debug: boolean;
  quickstart: boolean;
  template: string;
  starter: string;
  typescript: boolean;
  dbforce: boolean;
  dbssl: string;
  dbclient: string;
  dbhost: string;
  dbport: string;
  dbname: string;
  dbusername: string;
  dbpassword: string;
  dbfile: string;
}

Options and Configuration

Database Configuration

Database setup and configuration utilities for multiple database backends.

interface DatabaseInfo {
  client?: string;
  connection: {
    host?: string;
    port?: string;
    database?: string;
    username?: string;
    password?: string;
    filename?: string;
    ssl?: boolean;
  };
  useNullAsDefault?: boolean;
}

type ClientName = 'mysql' | 'mysql2' | 'postgres' | 'sqlite' | 'sqlite-legacy';

Database Setup

Template and Resource Management

Template processing and resource file management for project scaffolding.

interface TemplateConfig {
  package: Record<string, unknown>;
}

interface PackageInfo {
  name: string;
  version: string;
}

Templates and Resources

Core Types

interface Scope {
  name?: string;
  rootPath: string;
  template?: string;
  strapiVersion: string;
  strapiDependencies: Array<string>;
  installDependencies?: boolean;
  additionalsDependencies: Record<string, string>;
  docker: boolean;
  useYarn: boolean;
  useTypescript: boolean;
  runQuickstartApp: boolean;
  quick?: boolean;
  uuid?: string;
  deviceId?: string;
  dbforce?: boolean;
  database?: DatabaseInfo;
  debug?: boolean;
  tmpPath: string;
  packageJsonStrapi: Record<string, unknown>;
}

interface Configuration {
  client: string;
  connection: DatabaseInfo;
  dependencies: Record<string, string>;
}

interface StderrError extends Error {
  stderr: string;
}

function isStderrError(error: unknown): error is StderrError;