Skip to main content

Custom and local templates

ness new can create an application from an official starter, an npm package, or a directory on the local filesystem.

Local directory​

Pass a relative, absolute, home-relative, or file: path:

ness new my-app --template ./templates/company-app
ness new my-app --template /Users/me/templates/company-app
ness new my-app --template ~/templates/company-app
ness new my-app --template file:../company-app

A direct template directory must contain app/:

company-app/
β”œβ”€β”€ app/
β”‚ β”œβ”€β”€ root.tsx
β”‚ └── routes/
β”œβ”€β”€ public/
β”œβ”€β”€ ness.config.mjs
β”œβ”€β”€ tsconfig.json
└── Dockerfile

TypeScript is detected automatically from tsconfig.json. Ness generates the destination package.json, installs the framework dependencies, and copies the remaining files.

Package-style template​

For a template that can also be published to npm, place application files inside template/:

company-template/
β”œβ”€β”€ package.json
β”œβ”€β”€ template.json
└── template/
β”œβ”€β”€ app/
β”œβ”€β”€ public/
└── ness.config.mjs
package.json
{
"name": "@company/ness-template",
"type": "module",
"files": ["template", "template.json"],
"ness": {
"template": "template"
}
}

The ness.template field is optional when the directory is named template.

Package customizations​

Use template.json to add dependencies, scripts, and supported package metadata:

template.json
{
"package": {
"description": "Company web application",
"scripts": {
"storybook": "storybook dev -p 6006"
},
"dependencies": {
"@company/ui": "^2.0.0"
},
"devDependencies": {
"storybook": "^10.0.0"
}
}
}

Ness preserves the generated application name, version, ESM mode, private flag, and Node requirement. It merges dependencies, development dependencies, optional and peer dependencies, and scripts; Browserslist, ESLint configuration, and npm overrides are copied whole.

The prettier field is also copied into the generated package.json, so formatting rules do not require a separate .prettierrc file.

Copy safety​

The following development artifacts are never copied from a local template:

  • node_modules, .git, .npmignore, build, dist, deploy, .react-router, and .ness
  • npm, pnpm, Yarn, and Bun lock files
  • source package.json and template.json

The application directory cannot be placed inside the source template directory, preventing recursive copies.

npm registry template​

Published scoped packages can be used directly:

ness new my-app --template @company/ness-template

Unscoped aliases continue to resolve through the ness-template-* convention:

ness new my-app --template commerce
# Installs ness-template-commerce