Skip to main content

dbbasic-cli

Command-line tool for creating and managing DBBasic apps.

Philosophy

"Tools, not frameworks. Scripts, not magic."

The Unix way is small composable tools. CGI was successful because it was just scripts in a directory. No build step, no generators, no magic.

Design Principles

  1. Unix Tools First: Use git, cp, sed - not custom generators
  2. Scripts Over Frameworks: CLI is thin wrapper around standard tools
  3. Optional: Can use dbbasic without CLI
  4. Extensible: Modules can add commands (like Django's manage.py)
  5. No Magic: Everything is visible, debuggable

Installation

pip install dbbasic-cli

Quick Start

# Create a new blog app
dbbasic new blog myblog

# Enter the directory
cd myblog

# Install dependencies
pip install -r requirements.txt

# Run it
python app.py

Core Commands

dbbasic new <type> <name>

Creates a new app from a template.

dbbasic new blog myblog
dbbasic new api myapi
dbbasic new shop myshop

Available templates:

  • blog - WordPress-like blog (~200 lines)
  • microblog - Twitter-like social app (~300 lines)
  • api - REST API (~150 lines)
  • shop - E-commerce (~400 lines)
  • intranet - Basecamp-like project manager (~500 lines)

dbbasic list

Lists all available templates.

dbbasic list

dbbasic run

Runs the app (optional, just python app.py works too).

dbbasic run

# With options
dbbasic run --port 8000

dbbasic test

Runs tests.

dbbasic test

Module Commands

Modules can add their own commands! For example:

# From dbbasic-queue
dbbasic queue:worker    # Start queue worker
dbbasic queue:stats     # Show queue statistics

# From dbbasic-logs
dbbasic logs:tail       # Tail application logs
dbbasic logs:search     # Search logs

# From dbbasic-accounts
dbbasic accounts:create # Create user account
dbbasic accounts:list   # List all accounts

Standard Directory Structure

Every dbbasic app follows this structure:

myapp/
├── app.py              # Main application file
├── data/               # TSV data files
│   ├── posts.tsv
│   └── users.tsv
├── templates/          # HTML templates
│   ├── layout.html
│   ├── home.html
│   └── posts/
│       ├── list.html
│       ├── show.html
│       └── edit.html
├── static/             # CSS, JS, images
│   ├── css/
│   ├── js/
│   └── img/
├── tests/              # Test files
│   └── test_app.py
├── requirements.txt    # Python dependencies
└── README.md           # Documentation

Extending with Module Commands

Modules can provide CLI commands by including a cli.py:

# dbbasic_yourmodule/cli.py

def hello_command(args):
    """Say hello"""
    print("Hello from your module!")

def stats_command(args):
    """Show statistics"""
    print("Module statistics here...")

# Register commands
COMMANDS = {
    'yourmodule:hello': hello_command,
    'yourmodule:stats': stats_command,
}

Now these work automatically:

dbbasic yourmodule:hello
dbbasic yourmodule:stats

No CLI? No Problem!

You don't need the CLI to use dbbasic. The "pure Unix way":

# Clone an example
git clone https://github.com/askrobots/dbbasic-examples
cp -r dbbasic-examples/blog myblog
cd myblog
rm -rf .git

# Run it
python app.py

The CLI is just a convenience wrapper around standard Unix commands.

Comparison

CGI Way (1993)

mkdir myblog
cd myblog
cat > index.cgi << 'EOF'
#!/bin/bash
echo "Content-Type: text/html"
echo ""
echo "<h1>My Blog</h1>"
EOF
chmod +x index.cgi

Rails Way (2005)

rails new blog  # Generates 50+ files
rails g model Post
rails g controller Posts

dbbasic Way (2025)

dbbasic new blog myblog  # Optional convenience
# OR just: git clone + cp + python app.py

Development

# Clone the repo
git clone https://github.com/askrobots/dbbasic-cli
cd dbbasic-cli

# Install in development mode
pip install -e .

# Test it
dbbasic help

Size

  • Core CLI: ~200 lines
  • Total: ~250 lines with packaging
  • Compare to:
    • Rails CLI: ~10,000+ lines
    • Django CLI: ~5,000+ lines
    • CGI: 0 lines (no CLI needed)

License

MIT

Links

Release files for dbbasic-cli 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dbbasic-cli 1.0.0
File Size Uploaded
dbbasic_cli-1.0.0.tar.gz 6.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dbbasic-cli 1.0.0
File Interpreter ABI Platform
dbbasic_cli-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.7 kB

Release files / dbbasic_cli-1.0.0.tar.gz

Download URL dbbasic_cli-1.0.0.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
4c6ab4600d9a7d97d24863617e834d650fdeebf6c73ef3eea3b1415dbd70a625
BLAKE2b-256 checksum
How to use checksums
0f32434d6b267d3a177fad459ac626e2e265ff288cdfb2e9ea4a423c47028bd7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.1

Release files / dbbasic_cli-1.0.0-py3-none-any.whl

Download URL dbbasic_cli-1.0.0-py3-none-any.whl
Size 7.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4cda5d2f7ecb44f5e3c4ee65e53a55995bbdfb84fcc02d7b1b8510196c5f6686
BLAKE2b-256 checksum
How to use checksums
fc75523f98fb9967e76a2bd473f2ed88f573c0b98cee29691b12c91dbfec1bbd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.1

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page