Skip to main content

Interactive database initialization tool

Project description

dbinit

Interactive database initialization tool for setting up local databases with secure credential management.

Features

  • 🎯 Interactive Setup Wizard - Guided configuration with numbered choices
  • 🔐 Interactive Credential Setup - Password hiding and strength validation
  • 🗄️ Multiple Database Support - PostgreSQL (via Docker) and SQLite
  • 📁 Automatic Project Scaffolding - Complete project structure generation
  • 🔒 Secure Credential Storage - Credentials stored in .env files (never committed)
  • 🚀 Auto-start Databases - Automatically start PostgreSQL containers
  • 🎨 Editor Detection - Automatically detects and lists available editors
  • 🔄 Database Upgrades - Upgrade existing projects to new dbinit versions
  • ⚙️ Persistent Configuration - Settings saved and remembered
  • 🛡️ Password Security - Passwords never printed by default

Installation

From pip

pip install dbinit

From Source

Clone the repository and install:

# Regular installation
pip install .

# Or editable/development installation
pip install -e .

Development Setup

pip install -r requirements.txt
pip install -e .

Initial Setup

After installation, run the interactive setup wizard to configure dbinit:

dbinit setup

This will guide you through configuring:

  • Default project path (where new projects are created)
  • Default database type (postgres or sqlite)
  • Auto-start database option
  • Docker Compose command preference
  • Default editor

View your current configuration:

dbinit setup --show

See SETUP_GUIDE.md for detailed setup instructions.

Usage

Create a New Database Project

The create command runs in interactive/guided mode by default:

# Uses your configured default database type
dbinit create myproject

# Or specify database type explicitly
dbinit create myproject --db postgres
dbinit create myproject --db sqlite

Interactive Creation Process:

  1. 🎯 Guided wizard welcomes you and shows project details
  2. 🔐 Prompts for database username
  3. 🔒 Prompts for password (hidden input)
  4. ✅ Validates password strength
  5. 🔁 Requires password confirmation
  6. 📁 Generates complete project structure
  7. 🚀 Starts the database (for PostgreSQL, if auto-start enabled)
  8. 📝 Shows next steps and helpful commands

The interactive mode provides step-by-step guidance and clear feedback throughout the process.

View Stored Credentials

dbinit creds --show myproject

Upgrade Database Project

When dbinit updates, upgrade your existing database projects to the new version:

dbinit upgrade-db myproject

This command will:

  • Detect your project's database type
  • Preserve your existing credentials
  • Regenerate project files with latest templates
  • Update configuration files
  • Mark project with current dbinit version

Note: Always backup your project before upgrading, especially if you have custom modifications.

Project Structure

When you create a project, the following structure is generated:

myproject/
├── docker-compose.yml  # PostgreSQL configuration (Postgres only)
├── .env                # Database credentials (never committed)
├── .gitignore          # Git ignore rules
├── migrations/         # Database migrations directory
└── README.md           # Project documentation

Password Requirements

Passwords must meet the following criteria:

  • At least 8 characters long
  • At least one uppercase letter
  • At least one lowercase letter
  • At least one digit
  • At least one special character (!@#$%^&*()_+-=[]{}|;:,.<>?)

Security

  • Passwords are never printed to the console by default
  • Credentials are stored in .env files (automatically gitignored)
  • Use dbinit creds --show to view credentials when needed
  • Never commit .env files to version control

Commands Summary

Command Description
dbinit setup Interactive setup wizard to configure dbinit
dbinit create <project> Create a new database project (interactive mode)
dbinit creds --show <project> View stored database credentials
dbinit upgrade-db <project> Upgrade existing project to current dbinit version

Requirements

  • Python 3.7+
  • Docker and Docker Compose (for PostgreSQL projects)

Upgrade Workflow

When you update dbinit to a new version:

# 1. Upgrade dbinit
pip install --upgrade dbinit

# 2. Upgrade your existing projects
dbinit upgrade-db myproject1
dbinit upgrade-db myproject2

The upgrade command will:

  • ✅ Preserve your credentials
  • ✅ Update project files to latest templates
  • ✅ Maintain your database data
  • ✅ Update configuration files

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dbinit-0.2.3.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dbinit-0.2.3-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

Details for the file dbinit-0.2.3.tar.gz.

File metadata

  • Download URL: dbinit-0.2.3.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.6

File hashes

Hashes for dbinit-0.2.3.tar.gz
Algorithm Hash digest
SHA256 dced621a785e58111a29d8680905ec5e3667a2c98d4d489607f76de8c75873d9
MD5 bf2a9da36e9e0b9694e1fab0c2447667
BLAKE2b-256 b3d917e487262ad2815c6a4ffc920d810cf16ff00b6728984fd07daffc2856ba

See more details on using hashes here.

File details

Details for the file dbinit-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: dbinit-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 15.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.6

File hashes

Hashes for dbinit-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6a1829302cd9da5ad814b490b9be88d058d5bcdc0076d3520ccfb8c7df40c5bd
MD5 ac12055bc9f5d9cc503c5f0b9a12ed96
BLAKE2b-256 05562438437dae278a0f30c2fcae45a5c577c4f776dfef8b99266c5ef242404f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page