Skip to content
Back to blog
nSelfOpen SourceCLIDevOpsDocker

Building nSelf: From One Shell Script to an Open-Source CLI

2 min read

nSelf started as a 200-line bash script that stood up Docker containers. Now it is a proper CLI with 30+ commands. Here is how it grew.

Every project I built in 2024 needed the same backend: Postgres, Hasura, auth, file storage, and Nginx. Each time I would copy docker-compose files from the last project, change the env vars, and hope I remembered all the gotchas. Eventually the copy-paste overhead got bad enough that I wrote a shell script to automate it.

That script became nSelf. The first version was 200 lines of bash that generated docker-compose.yml and nginx.conf from a .env file. It worked, but bash is not a language you want to maintain at scale. The rewrite into a proper CLI happened over the summer of 2025, with the first public release (v0.3.0) on August 11.

The core idea stayed the same: your entire backend is defined in one .env file. Run nself build to generate all the configs, nself start to bring up the stack, nself urls to see what is running. No YAML to hand-edit, no Docker knowledge required beyond installing Docker itself.

The hardest engineering problem was SSL certificates for local development. Browsers reject self-signed certs, so nSelf creates a local Certificate Authority with mkcert, generates wildcard certs for *.localhost, and installs the CA into the system trust store. One command: nself trust. After that, every local subdomain has valid HTTPS.

nSelf now has over 30 commands covering the full lifecycle: database migrations, Hasura metadata management, frontend app configuration, service health checks, and automated backups. It runs production workloads on $4/month Hetzner servers and local dev environments on MacOS and Linux.

Related Posts