DEV Community

Cover image for I Got Tired of Wasting 1 Hour on Project Setup, So I Built a CLI
axelRubioMDC
axelRubioMDC

Posted on

I Got Tired of Wasting 1 Hour on Project Setup, So I Built a CLI

Every time I started a new project, I had to do the same thing manually:

  • Create the repo on GitHub
  • Set up branches (main, develop, staging)
  • Protect main with PR rules
  • Clone it locally
  • Configure the CI/CD pipeline
  • Install dependencies
  • Open VS Code

That's 30 to 60 minutes of pure repetition before writing a single line of actual code.
So I automated all of it.


Introducing create-my-stack-cli

A CLI that does everything above with one command:

npx create-my-stack-cli my-project
Enter fullscreen mode Exit fullscreen mode

It asks you a few questions interactively:

? What's the project name? my-project
? Which stack do you prefer? Node.js + Express
? Which database? PostgreSQL
? Set up CI/CD? GitHub Actions
? Your GitHub Personal Access Token? [hidden]
? Private repository? No
Enter fullscreen mode Exit fullscreen mode

And then it runs everything automatically:

✔ Repository created.
✔ develop and staging branches created.
✔ main branch protected.
✔ Repository cloned locally.
✔ Base files generated (.env.example, README.md).
✔ Dependencies installed.
✔ Project opened in VS Code.
Enter fullscreen mode Exit fullscreen mode

From zero to fully configured project in under 60 seconds.


What it does under the hood

1. GitHub Integration

Uses the GitHub API via @octokit/rest to create the repo, set up branches from the main SHA, and configure branch protection rules (requires PR reviews before merging).

2. Base file generation

Generates an .env.example with the right variables depending on the database you chose:

  • PostgreSQLDATABASE_URL=postgresql://user:password@localhost:5432/dbname
  • MongoDBMONGODB_URI=mongodb://localhost:27017/dbname
  • MySQLMYSQL_HOST, MYSQL_PORT, MYSQL_USER, etc.

Also generates a README.md with the project name, stack, and quick start instructions.

3. CI/CD out of the box

Copies the right GitHub Actions workflow depending on your stack:


name: CI/CD - Node.js + Express
on:
 push:
   branches: [main, develop]
 pull_request:
   branches: [main]
jobs:
 build-and-test:
   runs-on: ubuntu-latest
   steps:
     - uses: actions/checkout@v4
     - uses: actions/setup-node@v4
       with:
         node-version: '18'
         cache: 'npm'
     - run: npm ci
     - run: npm run lint --if-present
     - run: npm test --if-present
     - run: npm run build --if-present
Enter fullscreen mode Exit fullscreen mode

4. Local setup

Clones the repo, installs dependencies with npm install, and opens VS Code automatically — all using execa to run shell commands from Node.js.


Supported stacks

Stack Database CI/CD
Node.js + Express PostgreSQL, MongoDB, MySQL GitHub Actions
Node.js + Fastify PostgreSQL, MongoDB, MySQL GitHub Actions
Next.js PostgreSQL, MongoDB, MySQL GitHub Actions

Tech stack

Built with:

  • TypeScript — for type safety
  • commander — CLI argument parsing
  • inquirer — interactive prompts
  • @octokit/rest — GitHub API
  • ora — terminal spinners
  • chalk — terminal colors
  • execa — shell command execution

Try it

npx create-my-stack-cli my-project
Enter fullscreen mode Exit fullscreen mode

You'll need a GitHub Personal Access Token with repo and workflow scopes.
How to create one
📦 npm: https://www.npmjs.com/package/create-my-stack-cli
🐙 GitHub: https://github.com/aRubioMDC/create-my-stack


What's next (Pro version)

  • Auth pre-configured (JWT + bcrypt)
  • Docker + docker-compose
  • Prisma pre-configured
  • Stripe integration

If this saved you time, drop a ⭐ on GitHub or leave a comment. Feedback and PRs are welcome!

Top comments (0)