DEV Community

Cover image for I Built a CLI That Scaffolds 30+ Fullstack Projects From Natural Language
Md Mohosin Ali Shah
Md Mohosin Ali Shah

Posted on

I Built a CLI That Scaffolds 30+ Fullstack Projects From Natural Language

Ever typed something like this and wished it just worked?

npx starter-structure-cli my-app react vite ts tailwind express prisma mysql
Enter fullscreen mode Exit fullscreen mode

Well, now it does. I built starter-structure-cli an open source Node.js CLI that generates production-ready starter projects from stack tokens you type in plain English.

The Problem

Every time I started a new project, I'd spend hours:

  • Setting up folder structure
  • Wiring up the frontend to the backend
  • Configuring ORMs, auth, styling
  • Copy-pasting boilerplate from old projects

I wanted one command that just gives me a working project with my exact stack.

What It Does

npx starter-structure-cli my-app
Enter fullscreen mode Exit fullscreen mode

That's it. You get an interactive prompt that walks you through picking your stack. Or skip the prompts entirely:

npx starter-structure-cli my-app react vite ts tailwind express prisma mysql
Enter fullscreen mode Exit fullscreen mode

It ships with 30+ templates across 6 categories:

Category Example
Single App react-vite-ts-tailwind
Frontend-only react-admin-dashboard
Backend-only express-prisma-mysql-jwt
Fullstack react-vite-ts-tailwind-express-prisma-mysql
Monorepo (Client/Server) nextjs-express-prisma
Monorepo (Turbo + pnpm) nextjs-api-nestjs-prisma

Stacks covered: React, Next.js, Vue, Vite, Tailwind CSS, shadcn/ui, Express, NestJS, Prisma, Mongoose, Sequelize, MongoDB, MySQL, PostgreSQL, JWT, NextAuth — and growing.

The Cool Parts

1. Natural Language Matching

You don't need to memorize template names. Just throw stack words at it:

npx starter-structure-cli my-app reactjs tailwind css nodejs prisma mysql
Enter fullscreen mode Exit fullscreen mode

The CLI normalizes aliases automatically:

  • reactjsreact
  • tailwindcsstailwind
  • typescriptts
  • nextnextjs

It even ignores filler words like with, project, app, and css.

2. Composable Template System

Templates aren't just static folders. They're built from composable layers:

template-sources/
  bases/       → shared project skeletons
  layers/      → stack-specific overlays
  presets/     → final template definitions (JSON)
  components/  → reusable snippets (package.json, README, styles)
Enter fullscreen mode Exit fullscreen mode

A preset JSON file defines how layers compose:

{
  "output": "templates/fullstack/react-vite-ts-tailwind-express-prisma-mysql",
  "base": ["bases/fullstack/react-vite-ts-tailwind-express"],
  "layers": ["layers/backend-only/prisma-mysql"],
  "variables": { "DB": "mysql" }
}
Enter fullscreen mode Exit fullscreen mode

This means adding a new database variant is just a new 5-line JSON preset — not a whole new template folder.

The system also supports {{ include: }} directives with cycle detection, so templates can reference shared snippets without infinite loops.

3. Interactive + Non-Interactive

Fully interactive with @clack/prompts:

npx starter-structure-cli my-app
# → Pick category → Pick stack options → Generate
Enter fullscreen mode Exit fullscreen mode

Or fully automated for CI/scripts:

npx starter-structure-cli my-app \
  --category fullstack \
  --frontend react \
  --backend express \
  --orm prisma \
  --database mysql \
  -y
Enter fullscreen mode Exit fullscreen mode

4. Smart Defaults

  • If both JS and TS variants exist, TypeScript is preferred unless you pass --language js
  • __APP_NAME__ placeholders are replaced in file names, folder names, and file contents
  • Auto-installs dependencies with --install (supports npm, pnpm, yarn)

Generated Project Structures

Fullstack:

my-app/
  client/    → React/Vue/Next.js frontend
  server/    → Express/NestJS backend
Enter fullscreen mode Exit fullscreen mode

Monorepo (Turbo):

my-app/
  apps/
    web/     → frontend
    api/     → backend
Enter fullscreen mode Exit fullscreen mode

Templates include starter structure for components, routes, hooks, services, controllers, and data modules — not just empty folders.

How I Built It

The entire CLI is built with:

  • Pure Node.js (ES Modules, zero build step)
  • @clack/prompts — beautiful terminal UI
  • picocolors — lightweight terminal colors
  • A custom template build pipeline that composes presets at publish time

The architecture is intentionally simple. No frameworks, no bundlers, no compilation. Just Node.js doing what it does best — file system operations and CLI parsing.

Try It

npx starter-structure-cli my-app
Enter fullscreen mode Exit fullscreen mode

Or browse the templates:

npx starter-structure-cli --list
Enter fullscreen mode Exit fullscreen mode

GitHub: github.com/mohosin2126/starter-structure-cli
npm: npmjs.com/package/starter-structure-cli

Star it if you find it useful ⭐ and feel free to open issues or contribute new templates!

Top comments (0)