Introducing a new way to review your PRs.

Read the announcement

solana-foundation / create-solana-dapp

The fastest way to create Solana apps 🚀 Templates 👉 https://github.com/solana-foundation/templates

View on GitHub

18 documents · Updated Nov 6, 2026

docs / project-scaffolding-pipeline

Project scaffolding pipeline

The project scaffolding pipeline turns resolved command input and a chosen template into a project directory that can be opened and run. It acquires the source, applies template setup, installs project tools when requested, and returns clear next steps to the user.

Pipeline stages

Resolved project inputs

The pipeline starts after command-line parsing and prompts have produced one resolved project input. That input names the target directory and template and carries the package manager plus skip choices for installation, initialization, and Git. Template selection is outside this page; this pipeline consumes the selected template rather than choosing it.

The destination path and generated project metadata have their own rules. See Target path and project metadata for workspace preparation and package metadata behavior.

References: src/…/get-args.ts• L124-157 src/…/get-args-result.ts• L5-20 src/…/create-app.ts• L19-22

Target preparation

The pipeline treats the target directory as a boundary for all later work. It refuses to scaffold into a directory that already exists, and it records whether the directory existed before the run so it can remove a newly created target after a failed run. This keeps a failed attempt from leaving an incomplete workspace while preserving a directory that the user owned before the command started.

The source acquisition step also checks that the resulting directory contains files. The target therefore becomes the shared working directory for metadata checks, scripts, dependency commands, and Git setup.

References: src/…/create-app.ts• L22-25 src/…/create-app.ts• L74-79 src/…/create-app-task-clone-template.ts• L43-50 src/…/create-app-task-clone-template.ts• L86-93

Template source acquisition

The pipeline obtains the chosen starter from either a local source or a remote template source. A local source is copied into the target without common generated or dependency directories. A remote source is downloaded and unpacked into the target.

Remote acquisition has a narrow recovery path for a corrupt cached archive. The pipeline retries once with a clean extraction area. If the retry fails for the same archive problem, it reports an actionable cache-related error; unrelated download errors fail without a retry. See Template acquisition and recovery for the source and recovery contract.

References: src/…/create-app-task-clone-template.ts• L20-41 src/…/create-app-task-clone-template.ts• L60-83 src/…/create-app-task-clone-template.ts• L94-99

Package manager alignment

After source acquisition, the pipeline lets the template's initialization metadata choose a package manager when the user did not explicitly choose one. It checks that the required manager is available and rejects a conflict with an explicit user choice.

The pipeline then removes a conflicting package-manager pin from the generated package.json. A matching pin remains in place. This alignment happens before option scripts and dependency installation so later commands use one consistent manager. See Dependency installation and package managers for manager detection, compatibility, and install commands.

References: src/…/create-app.ts• L32-46 src/…/init-script-package-manager.ts• L8-32 src/…/remove-incompatible-package-manager.ts• L18-35

Setup task sequence

The setup phase runs tasks in a fixed order. Each task reports a short result to the progress display, and only tasks enabled by the user's skip choices run. The order matters because option scripts can change the package manifest before dependencies are installed, and initialization must use the metadata captured before those scripts run.

The normal sequence is:

  1. Run scripts selected by template options.
  2. Install dependencies and remove lock files for other package managers.
  3. Run the optional setup script.
  4. Install configured coding-agent skills.
  5. Run the optional initialization script.
  6. Initialize a Git repository unless Git setup is skipped.

The option and initialization stages can also produce instructions for the final message. Their detailed contract belongs to Initialization scripts and customization when that page is available.

This diagram shows how the acquired project moves through the ordered setup stages and produces instructions for completion.

flowchart TD
    A[Resolved input] --> B[Acquire template]
    B --> C[Align package manager]
    C --> D[Snapshot init metadata]
    D --> E[Template option scripts]
    E --> F[Install dependencies]
    F --> G[Run setup script]
    G --> H[Install skills]
    H --> I[Run init script]
    I --> J[Initialize Git]
    J --> K[Return instructions]

References: src/…/create-app.ts• L50-72 src/…/clack-tasks.ts• L34-51 src/…/create-app-task-run-option-script.ts• L15-20 src/…/create-app-task-run-setup.ts• L7-10 src/…/create-app-task-install-skills.ts• L10-14 src/…/create-app-task-run-init-script.ts• L18-25 src/…/create-app-task-initialize-git.ts• L6-9

Completion messaging

On success, the command combines instructions returned by the setup tasks with the generated project's start script. It tells the user how to enter the new directory and, when dependency installation was skipped, how to install dependencies manually. Explicit template instructions take priority over the default dev or start command.

The command presents this note as the installation-success result. A failure is caught at the command boundary and shown as a cancelled operation instead of a success message.

References: src/index.ts• L83-95 src/…/final-note.ts• L11-27 src/…/get-start-script.ts• L1-10

Pipeline controls

The skip flags change the final state without changing the source acquisition step. They are intended for users who want to finish part of the setup themselves.

ControlEffect on the pipeline
--skip-installSkips dependency installation and skill installation. The completion note prints the selected package manager's install command.
--skip-initSkips template option scripts and the initialization script.
--skip-gitSkips Git repository initialization.
--dry-runStops before source acquisition and reports the resolved arguments.

References: src/…/get-args.ts• L31-42 src/index.ts• L61-75 src/…/create-app-task-run-option-script.ts• L18-20 src/…/create-app-task-install-dependencies.ts• L10-15 src/…/create-app-task-install-skills.ts• L10-14 src/…/create-app-task-run-init-script.ts• L23-25 src/…/create-app-task-initialize-git.ts• L6-9

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep the task order aligned with the dependency and metadata contracts. Option scripts must run before installation, while the init metadata snapshot must survive any manifest rewrite.
  • Keep package-manager selection, package-manager pins, lock-file cleanup, and command generation consistent. A change in one can make the generated project use mixed manager state.
  • Keep skip flags synchronized with both task enablement and the completion note. A skipped action must produce a usable manual instruction when one is needed.
  • Keep task result instructions compatible with finalNote. The final message uses returned instructions in place of its default start command.
  • Preserve cleanup boundaries. Only a target created by the current run may be removed after failure.

Important failure modes

TriggerConsequenceGuard
The target directory already existsThe scaffold stops before changing that directory.The acquisition task checks the target before copying or downloading.
A template archive is corruptThe first extraction fails. A second failure stops the run with a cache-focused message.The remote download path retries once with clean extraction.
The template requires an unavailable package managerThe scaffold stops before scripts or installation use the wrong tool.The template manager is checked after acquisition and before later tasks.
The user selects a package manager that conflicts with the template requirementThe scaffold rejects the explicit choice.Explicit manager choices are compared with the template requirement.
A selected option names a missing package scriptThe option stage fails before dependency installation.The required script is checked in package.json before execution.
A setup or initialization command failsThe run stops and the newly created target is removed.Task errors propagate to the app boundary, which cleans up only a new target.
One coding-agent skill failsOther skills can still install, and the result reports the count.Skill installation handles each skill separately and reports partial success.

Key files

FileWhy to read it
src/…/create-app.tsDefines the end-to-end task order, metadata snapshot, error cleanup, and returned instructions.
src/…/create-app-task-clone-template.tsShows the local and remote source boundary plus corrupt-archive recovery.
src/…/create-app-task-install-dependencies.tsShows how the selected manager reaches the generated project and how stale lock files are handled.
src/…/init-script-package-manager.tsDefines how template manager requirements affect the resolved manager.
src/…/create-app-task-run-option-script.tsShows why selected option scripts run before installation.
src/…/create-app-task-run-init-script.tsShows how the captured initialization contract produces final instructions.
src/…/final-note.tsDefines the user-facing next steps after a successful scaffold.
src/index.tsConnects resolved arguments, app creation, completion output, and top-level failure handling.