DEV Community

Amaan Zaidi
Amaan Zaidi

Posted on

I Built a Customizable CLI for Node.js Backends

I Built a Customizable CLI for Node.js Backends 🚀

Every time I started a new Node.js backend, I found myself doing the same things again.

Setting up the framework.

Creating the folder structure.

Configuring the database.

Adding an ORM.

Setting up authentication.

Creating environment files.

Installing dependencies.

And then finally... starting the actual project.

There are already plenty of backend boilerplates and scaffolders out there, but I wanted something different.

I didn't want a single predefined backend.

I wanted to choose the pieces I needed and generate the backend around those choices.

So I built Backkit.


What is Backkit?

Backkit is an interactive CLI for scaffolding customizable Node.js backends.

Instead of giving you one fixed boilerplate, Backkit lets you choose the stack you want.

Choose your stack

Category Options
Language TypeScript, JavaScript
Framework Express, Fastify
Database PostgreSQL, MongoDB
ORM / ODM Drizzle, Prisma, Mongoose
Authentication Better Auth, JWT, None

You simply run:

npx @ghost1411/backkit
Enter fullscreen mode Exit fullscreen mode

And Backkit guides you through the setup.


What Backkit generates

Depending on your selections, Backkit can generate:

  • Project structure
  • Framework configuration
  • Database setup
  • ORM / ODM configuration
  • Authentication setup
  • Environment configuration
  • Dependency installation
  • Ready-to-run development setup

The goal is simple:

Choose your stack → generate your backend → start building.


How it works

The process is essentially:

Your choices
     ↓
Configuration
     ↓
Template selection
     ↓
File generation
     ↓
Dependency installation
     ↓
Ready-to-run backend
Enter fullscreen mode Exit fullscreen mode

Backkit takes the choices you make through the CLI and uses them to determine what should be generated.

This means the resulting project isn't a huge boilerplate where you have to delete half the code before starting.

You get the components you selected.


Installation

You don't need to install Backkit globally.

Run it directly using npx:

npx @ghost1411/backkit
Enter fullscreen mode Exit fullscreen mode

That's it.

The interactive CLI will start and guide you through the configuration.


Quick Start

Run:

npx @ghost1411/backkit
Enter fullscreen mode Exit fullscreen mode

You'll be able to select the technologies you want.

For example:

? Choose your language
❯ TypeScript
  JavaScript

? Choose your framework
❯ Express
  Fastify

? Choose your database
❯ PostgreSQL
  MongoDB

? Choose your ORM / ODM
❯ Drizzle
  Prisma
  Mongoose

? Choose authentication
❯ Better Auth
  JWT
  None
Enter fullscreen mode Exit fullscreen mode

Once the configuration is complete, Backkit generates your project.

Then:

cd your-project
npm install
npm run dev
Enter fullscreen mode Exit fullscreen mode

And you're ready to start building.


Example Generated Structure

A generated TypeScript + Express backend could look something like:

your-backend/
├── src/
│   ├── config/
│   ├── controllers/
│   ├── db/
│   ├── middleware/
│   ├── routes/
│   ├── services/
│   └── index.ts
│
├── .env
├── .env.example
├── package.json
├── tsconfig.json
└── README.md
Enter fullscreen mode Exit fullscreen mode

The exact structure depends on the options selected during setup.


Why did I build this?

I've worked on multiple Node.js backend projects, and I kept noticing the same pattern.

The first part of the project was often:

Setup
Setup
Setup
Setup
Setup
...
Finally start building
Enter fullscreen mode Exit fullscreen mode

The actual backend logic came later.

I wanted to automate that repetitive part.

But I also didn't want to create another tool that says:

"Here is my preferred backend architecture. Use it."

Different projects need different stacks.

A small API might need Express and PostgreSQL.

Another project might use Fastify and MongoDB.

Someone else might prefer Prisma.

Someone else might prefer Drizzle.

And sometimes you don't need authentication at all.

That's where the idea for Backkit came from.


Why customization matters

Imagine two projects.

Project A

TypeScript
+
Express
+
PostgreSQL
+
Drizzle
+
Better Auth
Enter fullscreen mode Exit fullscreen mode

Project B

TypeScript
+
Fastify
+
MongoDB
+
Mongoose
+
No Authentication
Enter fullscreen mode Exit fullscreen mode

With a traditional boilerplate, you might start with one and manually modify it.

With Backkit, the idea is to make those choices before generation.

Don't adapt your project to a boilerplate. Generate a boilerplate that fits your project.


The Architecture

At a high level, Backkit follows a simple pipeline:

                  ┌─────────────────┐
                  │   User Choices  │
                  └────────┬────────┘
                           │
                           ▼
                  ┌─────────────────┐
                  │  Configuration  │
                  └────────┬────────┘
                           │
                           ▼
                  ┌─────────────────┐
                  │ Template Select │
                  └────────┬────────┘
                           │
                           ▼
                  ┌─────────────────┐
                  │ File Generation │
                  └────────┬────────┘
                           │
                           ▼
                  ┌─────────────────┐
                  │  Dependencies   │
                  └────────┬────────┘
                           │
                           ▼
                  ┌─────────────────┐
                  │ Ready Backend   │
                  └─────────────────┘
Enter fullscreen mode Exit fullscreen mode

The important part is keeping the different components modular.

Adding another framework, database, ORM, or authentication provider should extend the system rather than require rewriting the entire CLI.


Built With

Backkit is currently built around the Node.js ecosystem.

Core

  • Node.js
  • TypeScript
  • npm / npx

Project generation

  • Node.js filesystem APIs
  • Template-based generation
  • Interactive CLI prompts

The project is intentionally designed to be extensible so more backend technologies can be added over time.


Why npx?

One of the things I wanted was to make trying Backkit as frictionless as possible.

Instead of asking users to:

npm install -g @ghost1411/backkit
Enter fullscreen mode Exit fullscreen mode

they can simply run:

npx @ghost1411/backkit
Enter fullscreen mode Exit fullscreen mode

No global installation.

No setup before trying it.

Just run the command and start creating a backend.


What's Next?

Backkit is still in its early stage, so there is a lot of room to expand.

Current

  • [x] Interactive CLI
  • [x] Custom stack selection
  • [x] Project generation
  • [x] Template-based architecture
  • [x] npm package
  • [x] npx support

Planned

  • [ ] More backend frameworks
  • [ ] More databases
  • [ ] More ORMs / ODMs
  • [ ] More authentication providers
  • [ ] More architecture patterns
  • [ ] Custom user templates
  • [ ] Community-contributed templates
  • [ ] More configuration options

The long-term idea is to make Backkit feel less like a single boilerplate and more like a component library for backend development.


Open Source

Backkit is open source, and I'd love to see other developers experiment with it.

If you build Node.js backends, I'd especially like feedback on:

  • What frameworks should be supported?
  • What databases should be added?
  • What authentication options would be useful?
  • What should the generated structure look like?
  • What would make the CLI easier to use?

Found a bug?

Open an issue.

Have an idea?

Open an issue.

Want to contribute?

Pull requests are welcome.


Try Backkit

Give it a try:

npx @ghost1411/backkit
Enter fullscreen mode Exit fullscreen mode

Links

GitHub: https://github.com/amaan1114/backkit

npm: https://www.npmjs.com/package/@ghost1411/backkit

If you find the project useful, consider giving it a ⭐ on GitHub.

It helps more developers discover the project.


I'd Love Your Feedback

Backkit is still very early, and I'm curious about how other developers would use it.

If you could generate your ideal Node.js backend with one command, what would you want to choose?

Framework?

Database?

ORM?

Authentication?

Architecture?

Let me know in the comments.


Backkit

Build the backend you actually want.

Top comments (0)