Automatic setup
Scaffold a new Useprint project with init-doc.
For the fastest path to a working preview, use init-doc. It creates a folder with a starter document, pinned @useprint/components and @useprint/cli versions, and npm scripts ready to go.
Using a monorepo? See Monorepo setup (or Manual install for a flat repo).
1. Install
We recommend using init-doc, which sets up everything automatically.
npx init-doc@latestThis creates a new folder called useprint-starter with a sample document and project files.
To use a different folder name, pass it as the first argument:
npx init-doc@latest my-documentsTo pin Useprint packages to a specific npm dist-tag (for example a prerelease), use --tag:
npx init-doc@latest --tag next2. Run locally
Change into the project directory and install dependencies:
cd useprint-starter
npm installThen start the development server:
npm run dev3. See changes live
Open http://localhost:3000 and edit files under documents/ to see updates in the preview.
- Add new
.tsxfiles indocuments/with a default-exported React component. - Put static assets in
documents/static/when you need images, fonts, or other files the preview can load.