CLI & npm Scripts
All runnable commands are defined in each app's package.json "scripts" block and invoked with npm run <name>.
Backend (be-create-lab-studio)​
Development​
| Command | What it does |
|---|---|
npm run dev | Starts the Express server with ts-node in development mode |
npm run build | Compiles TypeScript → dist/, then copies .sql migration and seed files |
npm run serve | Runs the compiled dist/server.js (production-style local run) |
Database​
| Command | What it does |
|---|---|
npm run db:migrate | Applies all pending migration files |
npm run db:seed | Runs all seed files (development data) |
npm run db:seed-prod | Runs production-safe seed subset only |
npm run db:seed-file -- <filename> | Runs a single seed file by name |
npm run db:delete | Drops all tables in the schema |
npm run db:reset | db:delete → db:migrate → db:seed (full local rebuild) |
Each database command has a CLI entry point in src/cli/:
| Script | Entry point |
|---|---|
db:migrate | src/cli/db-migrate.ts |
db:seed | src/cli/db-seed.ts |
db:seed-prod | src/cli/db-seed-prod.ts |
db:seed-file | src/cli/db-seed-file.ts |
db:delete | src/cli/db-delete.ts |
Frontend (fe-create-lab-studio)​
| Command | What it does |
|---|---|
npm run dev | Starts the Vite dev server at http://localhost:5173 |
npm run build | Type-checks with tsc then bundles with Vite into dist/ |
npm run preview | Serves the last dist/ build locally |
npm run lint | Runs ESLint across the project |
Adding a new script​
1. Add it to package.json​
"scripts": {
"my-script": "ts-node src/cli/my-script.ts"
}
Create the corresponding CLI entry point in src/cli/my-script.ts:
import { MyService } from '../application/services/MyService';
async function main() {
const service = new MyService();
await service.run();
}
main().catch(console.error);
2. Run it locally​
npm run my-script
3. Wire it into CI/CD (optional)​
If the script should run on every deploy, add it to the workflow YAML inside the SSH run block. See CI/CD for details.