### Typical End-to-End Project Workflow Source: https://context7.com/adonisjs/create-adonisjs/llms.txt A step-by-step guide to scaffolding a full-stack React AdonisJS application, including initialization with pnpm and git. ```sh # 1. Scaffold a fullstack React app with pnpm, git initialized npm init adonisjs@next my-blog -- \ --kit="react" \ --pkg="pnpm" \ --git-init # 2. The tool will automatically: # ✔ Download starter kit from github:adonisjs/starter-kits/inertia-react # ✔ Remove conflicting lock files (package-lock.json, yarn.lock) # ✔ Run: pnpm install # ✔ Rename package.json "name" → "my-blog" # ✔ Remove starter kit README.md # ✔ Copy .env.example → .env # ✔ Run: node ace generate:key (writes APP_KEY to .env) # ✔ Run: node ace migration:run # ✔ Run: git init # 3. Follow the printed next steps: cd my-blog pnpm run dev ``` -------------------------------- ### Initialize AdonisJS App with npm Source: https://github.com/adonisjs/create-adonisjs/blob/3.x/README.md Use this command to scaffold a new AdonisJS application using npm. This is the standard way to start a new project. ```sh npm init adonisjs@next ``` -------------------------------- ### Initialize Git Repository with --git-init Source: https://context7.com/adonisjs/create-adonisjs/llms.txt Use the --git-init flag to automatically run `git init` in the destination directory after the starter kit has been cloned. This is convenient for immediately starting version control. ```sh npm init adonisjs@next my-app -- --kit="hypermedia" --git-init ``` -------------------------------- ### Custom Starter Kit Configuration Source: https://github.com/adonisjs/create-adonisjs/blob/3.x/README.md Define advanced features for custom starter kits using a `create-adonisjs.json` file at the root. This example shows configuration for monorepo support and backend source directory. ```json { "workspaces": true, "backendSource": "apps/backend" } ``` -------------------------------- ### Creating a Monorepo Project with pnpm Source: https://context7.com/adonisjs/create-adonisjs/llms.txt Example command to create a monorepo project using a specific kit and pnpm. The resulting package.json will not contain a 'workspaces' field if pnpm is used. ```sh # Creates a monorepo project; backend lives in apps/backend npm init adonisjs@next my-monorepo -- --kit="api-monorepo" --pkg="pnpm" # Resulting root package.json will have: # { "packageManager": "pnpm@10.x.x" } ← no "workspaces" field # pnpm-workspace.yaml is preserved ``` -------------------------------- ### Basic Interactive Scaffold with npm, yarn, and pnpm Source: https://context7.com/adonisjs/create-adonisjs/llms.txt Run create-adonisjs without arguments to initiate interactive prompts for destination and starter kit selection. This is the default way to start a new project. ```sh # npm npm init adonisjs@next ``` ```sh # yarn yarn create adonisjs@next ``` ```sh # pnpm pnpm create adonisjs@next ``` -------------------------------- ### Enable Verbose Mode for Debugging Source: https://github.com/adonisjs/create-adonisjs/blob/3.x/README.md To get detailed logs when encountering errors during project creation, re-run the command with the `--verbose` flag. ```sh npm init adonisjs@next -- --verbose ``` -------------------------------- ### Programmatic Project Creation with Kernel Source: https://context7.com/adonisjs/create-adonisjs/llms.txt Shows how to programmatically create a new AdonisJS application using the `kernel` instance and the `CreateNewApp` command. This is useful for testing or automated setups. ```ts import { kernel } from 'create-adonisjs' import { CreateNewApp } from 'create-adonisjs/commands/main.js' // Create a command instance with args and flags const command = await kernel.create(CreateNewApp, [ '/home/user/projects/my-app', // destination '--kit="github:adonisjs/starter-kits/hypermedia"', '--pkg="npm"', '--skip-migrations', ]) command.verbose = true // Execute – mirrors what the CLI does interactively await command.exec() // Check outcome if (command.exitCode === 0) { console.log('Project created successfully') } else { console.error('Project creation failed') } ``` -------------------------------- ### Enable Verbose Output with --verbose Source: https://context7.com/adonisjs/create-adonisjs/llms.txt Use the --verbose flag to display output from all internal subprocesses, including dependency installation, Ace commands, and Git operations. This flag is helpful for diagnosing issues during project creation. ```sh npm init adonisjs@next my-app -- --kit="react" --verbose ``` -------------------------------- ### Skip Database Migrations with --skip-migrations Source: https://context7.com/adonisjs/create-adonisjs/llms.txt Prevent the automatic execution of `node ace migration:run` after dependency installation by using the --skip-migrations flag. This is useful in CI environments or when the database is not yet configured. ```sh npm init adonisjs@next my-app -- --kit="api" --skip-migrations ``` -------------------------------- ### Use Custom Starter Kit from Bitbucket Source: https://github.com/adonisjs/create-adonisjs/blob/3.x/README.md Initialize a project using a custom starter kit hosted on Bitbucket by specifying the provider and repository path with the `--kit` flag. ```sh npm init adonisjs@next -- --kit="bitbucket:user/repo" ``` -------------------------------- ### Use Custom Starter Kit from GitHub Source: https://github.com/adonisjs/create-adonisjs/blob/3.x/README.md Initialize a project using a custom starter kit hosted on GitHub by providing the repository path with the `--kit` flag. GitHub is the default provider. ```sh npm init adonisjs@next -- --kit="github:github_user/repo" ``` ```sh npm init adonisjs@next -- --kit="github_user/repo" ``` -------------------------------- ### Use Custom Starter Kit from GitLab Source: https://github.com/adonisjs/create-adonisjs/blob/3.x/README.md Initialize a project using a custom starter kit hosted on GitLab by specifying the provider and repository path with the `--kit` flag. ```sh npm init adonisjs@next -- --kit="gitlab:user/repo" ``` -------------------------------- ### Select Starter Kit using --kit Flag Source: https://context7.com/adonisjs/create-adonisjs/llms.txt Use the --kit flag to specify an official starter kit alias or a custom Git repository URL. Supports GitHub, GitLab, and Bitbucket, including specific branches or tags. ```sh # Official alias – fullstack server-side template app npm init adonisjs@next my-app -- --kit="hypermedia" ``` ```sh # Official alias – fullstack React + Inertia npm init adonisjs@next my-app -- --kit="react" ``` ```sh # Official alias – fullstack Vue + Inertia npm init adonisjs@next my-app -- --kit="vue" ``` ```sh # Official alias – type-safe REST API with dual auth npm init adonisjs@next my-app -- --kit="api" ``` ```sh # Official alias – REST API with monorepo structure npm init adonisjs@next my-app -- --kit="api-monorepo" ``` ```sh # Custom GitHub repo (github is the default provider) npm init adonisjs@next my-app -- --kit="myorg/my-starter" ``` ```sh npm init adonisjs@next my-app -- --kit="github:myorg/my-starter" ``` ```sh # Specific branch or tag npm init adonisjs@next my-app -- --kit="github:myorg/my-starter#develop" ``` ```sh npm init adonisjs@next my-app -- --kit="github:myorg/my-starter#v2.0.0" ``` ```sh # GitLab npm init adonisjs@next my-app -- --kit="gitlab:myorg/my-starter" ``` ```sh # Bitbucket npm init adonisjs@next my-app -- --kit="bitbucket:myorg/my-starter" ``` -------------------------------- ### Use Official Starter Kit by Alias Source: https://github.com/adonisjs/create-adonisjs/blob/3.x/README.md To use a specific official starter kit (e.g., 'hypermedia'), provide its alias with the `--kit` flag. This bypasses the interactive selection prompt. ```sh npm init adonisjs@next -- --kit="hypermedia" ``` -------------------------------- ### Accessing and Listing Starter Kit Templates Source: https://context7.com/adonisjs/create-adonisjs/llms.txt Demonstrates how to import and use the `templates` array from `create-adonisjs/src/templates.ts` to find templates by alias or list all available ones. ```ts import { templates } from 'create-adonisjs/src/templates.js' // Find a template by alias const reactKit = templates.find((t) => t.alias === 'react') console.log(reactKit) // { // name: 'React app (using Inertia)', // alias: 'react', // hint: 'A full-stack React app with end-to-end type safety', // source: 'github:adonisjs/starter-kits/inertia-react' // } // List all available aliases templates.forEach((t) => console.log(`${t.alias}: ${t.hint}`)) ``` -------------------------------- ### Provide Authentication Token for Private Repos Source: https://github.com/adonisjs/create-adonisjs/blob/3.x/README.md When using a private starter kit repository, provide the authentication token using the `--token` flag to grant access. ```sh npm init adonisjs@next -- --kit="github:github_user/repo" --token="github_token" ``` -------------------------------- ### Specify Starter Kit Branch or Tag Source: https://github.com/adonisjs/create-adonisjs/blob/3.x/README.md You can specify a particular branch or tag name for your custom starter kit by appending it to the repository URL with a '#' symbol. ```sh npm init adonisjs@next -- --kit="github:github_user/repo#branch-name" ``` ```sh npm init adonisjs@next -- --kit="github:github_user/repo#v1.0.0" ``` -------------------------------- ### Initialize AdonisJS App with yarn Source: https://github.com/adonisjs/create-adonisjs/blob/3.x/README.md Use this command to scaffold a new AdonisJS application using yarn. This is an alternative to npm for project initialization. ```sh yarn create adonisjs@next ``` -------------------------------- ### Initialize AdonisJS App with pnpm Source: https://github.com/adonisjs/create-adonisjs/blob/3.x/README.md Use this command to scaffold a new AdonisJS application using pnpm. This is another alternative package manager for project initialization. ```sh pnpm create adonisjs@next ``` -------------------------------- ### Specify Destination Directory Source: https://github.com/adonisjs/create-adonisjs/blob/3.x/README.md You can provide the desired directory name as the first argument to the initialization command. If omitted, you will be prompted to enter it. ```sh npm init adonisjs@next my-app ``` -------------------------------- ### Specify Target Directory for Project Creation Source: https://context7.com/adonisjs/create-adonisjs/llms.txt Provide the output directory as the first positional argument. The specified directory must not already exist. ```sh # Creates the project in ./my-app npm init adonisjs@next my-app ``` ```sh # Absolute path also works npm init adonisjs@next /home/user/projects/my-app ``` -------------------------------- ### Non-interactive Environment Usage Source: https://context7.com/adonisjs/create-adonisjs/llms.txt Illustrates how to run `npm init adonisjs` in non-interactive environments like AI agents. Explicitly providing destination and kit is required, otherwise, it fails with an error. ```sh # This will FAIL in a non-interactive environment – no prompts available npm init adonisjs@latest # This will SUCCEED – all required values provided upfront npm init adonisjs@latest -- my-app --kit="react" --pkg="npm" # Expected error output (when flags are missing): # error: Interactive prompts are not supported in non-interactive environments. # # To create a new AdonisJS application, you must provide the destination # directory and the starter kit as command-line arguments. # # Available kits: # - "hypermedia": A full-stack app using server-side templates # - "react": A full-stack React app with end-to-end type safety # - "vue": A full-stack Vue app with end-to-end type safety # - "api": A type-safe REST API with session and access token auth # - "api-monorepo": A monorepo setup with a type-safe REST API ``` -------------------------------- ### Force Package Manager Source: https://github.com/adonisjs/create-adonisjs/blob/3.x/README.md If you need to enforce a specific package manager (e.g., 'yarn') for your project, use the `--pkg` flag. ```sh npm init adonisjs@next -- --pkg="yarn" ``` -------------------------------- ### Authenticate for Private Repositories with --token Source: https://context7.com/adonisjs/create-adonisjs/llms.txt Provide an authentication token using the --token flag when downloading from private Git repositories. This token is passed to the underlying `giget` tool. ```sh npm init adonisjs@next my-app -- --kit="github:myorg/private-starter" --token="ghp_xxxxxxxxxxxx" ``` -------------------------------- ### Force Package Manager with --pkg Flag Source: https://context7.com/adonisjs/create-adonisjs/llms.txt Use the --pkg flag to override automatic package manager detection. This is useful for ensuring consistency or when working in specific environments. It removes conflicting lock files and workspace configurations. ```sh # Force npm npm init adonisjs@next my-app -- --kit="api" --pkg="npm" ``` ```sh # Force pnpm (keeps pnpm-workspace.yaml, removes yarn.lock) npm init adonisjs@next my-app -- --kit="api" --pkg="pnpm" ``` ```sh # Force yarn (keeps .yarnrc.yml, removes pnpm-workspace.yaml) npm init adonisjs@next my-app -- --kit="api" --pkg="yarn" ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.