Code. Engineering. Insight.

You get up in the morning, sit down to work, check your email. You start up your services. You start one, then another, then a third. You start up Docker, but some services on Docker have quite specific configurations, so they need to be started with the right preferences.

Everything looks fine, but you wonder if you really need to spend so much time launching everything over and over again? Each one separately?

Let's say your IDE is WebStorm, it consumes quite a lot of resources indexing code, but let's say you only change the code in the service responsible for the product. So why not run the service that handles the order in the background? Do you really need to do an update per project?

One day, I also decided that it would be nice if I could quickly, preferably with a single command, run a given case. There will be no examples in this post, or there won't be much code, but here I would focus on the architecture because AI is able to create a given tool based on it. which is what I did, because I don't have time to implement a solution that would speed up my work, as the cost of creating such a tool would pay for itself, but only after some time. In my opinion, this is a very good example of how AI can speed up the work of a software developer.

bytes start:ordering

Does the command sound accessible? Thanks to this, we will launch a service such as:

  • product catalog
  • service responsible for ordering
  • api for authorization
  • ui
  • and much more...

And, of course, databases. In addition, we have various configurations, e.g., for dev, uat, and testing production configurations.

We also have two options

Launch everything on Docker.

The second is to run it locally using Node.

# CLI Architecture — Action Flow

## A. Docker Flow

```
  Developer                     Bytes CLI                       Docker
  ─────────                     ──────────                      ──────

  types "bytes"
      │
      ├──── (no args) ────────► shows interactive menu
      │                         with searchable list
      │                         of all available tasks
      │                              │
      │                         developer picks one
      │                         or more tasks
      │                              │
      │                         developer presses 's' ──► saves selection
      │                         to save as shortcut        as reusable combo
      │                              │
      ├──── (with args) ──────► looks up alias/shortcut
      │                         and skips menu
      │                              │
      └──────────────────────────────┘
                                     │
                                     v
                          ┌─────────────────────┐
                          │ What type of build? │
                          └────┬───────────┬────┘
                               │           │
                    ┌──────────┘           └──────────┐
                    v                                 v
           REMOTE BUILD                       LOCAL BUILD
           (from git repo)                    (from local code)
                    │                                 │
                    │                          validates that local
                    │                          source path exists
                    │                          and Dockerfile_local
                    │                          is present
                    │                                 │
                    └──────────┬──────────────────────┘
                               │
                               v
                     builds Docker image
                               │
                               v
                     starts container(s)
                               │
                               v
                     container joins shared
                     network, can talk to
                     all other services
                               │
                               v
                     developer can:
                       • view logs
                       • run migrations
                       • stop / restart
                       • backup / restore DB
```

## B. Local Flow (no containers)

```
  Developer                     Bytes CLI                      Host OS
  ─────────                     ──────────                     ───────

  registers a local
  project path via menu
      │
      v
  selects a task from
  that project (e.g. start,
  test, build)
      │
      v
  CLI spawns the npm
  process directly on
  the host machine
      │
      ├── background task ──► runs detached, PID tracked
      │                       logs saved to disk
      │                       can be stopped later
      │
      └── foreground task ──► runs blocking in terminal
                              output shown live
```

## C. Shortcut / Combo System

```
  Developer                     Bytes CLI
  ─────────                     ──────────

  picks multiple tasks
  from menu
      │
      v
  presses 's' to save
      │
      v
  gives it a name
  and optional alias
      │
      v
  combo is persisted ──────► next time appears at
                              top of the menu
                                    │
                                    v
                              can also be called
                              directly:
                              "bytes my-combo"
                                    │
                                    v
                              expands into all
                              saved tasks and
                              runs them in sequence
```

## D. Scaffolding New Service

```
  Developer                     Bytes CLI                      Filesystem
  ─────────                     ──────────                     ──────────

  runs scaffold wizard
      │
      v
  answers prompts:
    • service name
    • type (API, UI, connector)
    • port
    • needs database?
      │
      v
  CLI generates all
  boilerplate files ──────────────────────────► new service directory
                                                with Dockerfile,
      │                                         compose config,
      v                                         env template
  CLI registers the
  service in the menu ────────────────────────► service appears in
                                                interactive menu and
      │                                         npm scripts are usable
      v
  developer can immediately
  build & start the new service
```

With a single command, we run everything sequentially or asynchronously to speed up the process even more.

The process of creating a shortcut consists of adding projects and then creating a shortcut from them, which, after running, may additionally contain encoded data from env.

Thanks to this, we can, for example, create a jwt token that we send to someone with a password. The developer enters the CLI and simply pastes it. After a moment, they will have the shortcut.

The CLI for new developers will greatly facilitate the efficient launch of even complex flows, and I can already deliver solutions.

You’ve successfully subscribed to BytesFlow
Welcome back! You’ve successfully signed in.
Great! You’ve successfully signed up.
Success! Your email is updated.
Your link has expired
Success! Check your email for magic link to sign-in.