Skip to content

CLI scripts

rocambille edited this page Jun 4, 2026 · 4 revisions

Summary: This page documents the productivity scripts provided with StartER via npm run commands.

Automation and utilities

StartER comes with several scripts centralizing repetitive tasks (module creation, cleaning, database synchronization, code quality checking). These commands facilitate development and ensure project consistency.

All the commands listed below can be run directly in your terminal with npm run.

Command Description
npm run make:clone Duplicates an existing module with automatic renaming
npm run make:purge Removes example modules (item, auth, user)
npm run database:schema:load Loads the SQL schema into the SQLite database
npm run database:seeder:load Loads the test data into the SQLite database
npm run database:sync Loads the SQL schema and the test data into the SQLite database
npm run install:check Verifies the installation and the database file accessibility
npm run biome:check Checks code style and quality with Biome
npm run biome:fix Automatically fixes formatting issues (Biome)
npm run types:check Checks TypeScript typing (tsc --noEmit)

make:clone

Duplicates a file or folder, automatically replacing all occurrences of a name with another:

npm run make:clone -- <source> <destination> <OldName> <NewName>

For example, to create a post module from the item module:

npm run make:clone -- src/express/modules/item src/express/modules/post Item Post

Tip

Remember to register the new cloned module's routes in src/express/routes.ts.

Warning

The clone trade-off (WET code) While make:clone is fantastic for rapid, isolated prototyping, it favors a WET (Write Everything Twice) approach. If you find yourself repeatedly adding the same logic (like identical validation rules, formatting, or auth checks) across multiple cloned modules, it might be a good time to extract that shared logic into the src/express/helpers/ or src/react/helpers/ directories.

make:purge

Removes the example modules for a fresh start:

npm run make:purge

To keep authentication:

npm run make:purge -- --keep-auth

Warning

This operation is reversible thanks to version control with Git.

database:schema:load

Loads the SQL schema (src/database/schema.sql) into the SQLite database.

npm run database:schema:load

To bypass the confirmation prompt (useful in CI/CD):

npm run database:schema:load -- -n

database:seeder:load

Loads the test data (src/database/seeder.sql) into the SQLite database.

npm run database:seeder:load

To bypass the confirmation prompt (useful in CI/CD):

npm run database:seeder:load -- -n

database:sync

Resets your local SQLite database (data/sqlite/database.sqlite) from the SQL schema and the test data.

npm run database:sync

This is equivalent to:

npm run database:schema:load && npm run database:seeder:load

To bypass the confirmation prompt (useful in CI/CD):

npm run database:sync -- -n

install:check

Verifies that your .env file is correct and that the application can access the SQLite database file:

npm run install:check

Code quality

npm run biome:check    # Checks formatting
npm run biome:fix      # Fixes formatting
npm run types:check    # Checks typing

Best practices and use cases

  • Clean reset: use npm run database:sync regularly during development to restart from a known and clean database state.
  • Pre-commit check: the pre-commit hook runs npm run types:check, npm run biome:check and npx vitest run --exclude tests/install. You can run them manually before committing your changes to ensure the code meets project standards.
  • Zero-Config: thanks to SQLite, none of these scripts require launching Docker beforehand, making the development cycle much faster.

See also

Clone this wiki locally