Interactive CLI for setting up PostgreSQL databases with multiple providers (Neon, Supabase, Railway, Local Docker)
- ๐ฏ Multiple Providers: Neon, Supabase, Railway, Local Docker
- ๐ Region Selection: Choose from 11+ global regions with emoji flags
- โ๏ธ Auto Configuration: Automatically writes database URL to .env
- ๐ Custom .env Paths: Support for any .env file location
- ๐ท๏ธ Custom Variable Names: Use any variable name (DATABASE_URL, POSTGRES_URL, etc.)
- ๐พ Safe Updates: Creates backups before modifying files
- ๐ Overwrite Protection: Asks before overwriting existing variables
- ๐จ Beautiful CLI: Color-coded, interactive prompts
- ๐ Zero Config: Works out of the box with Bun or Node.js
# With Bun
bunx @sidgaikwad/db-setup
# With npm
npx @sidgaikwad/db-setup# With Bun
bun add @sidgaikwad/db-setup
# With npm
npm install @sidgaikwad/db-setup
# With pnpm
pnpm add @sidgaikwad/db-setup
# With yarn
yarn add @sidgaikwad/db-setupThen run:
# Using package scripts
bun run create-db-setup
# or
npm run create-db-setup
# Using npx/bunx
bunx @sidgaikwad/db-setup
# or
npx @sidgaikwad/db-setup# With Bun
bun install -g @sidgaikwad/db-setup
# With npm
npm install -g @sidgaikwad/db-setup
# Then run anywhere
create-db-setup
# or
db-setup# Install the package
bun add @sidgaikwad/db-setup
# Add to package.json scripts (optional)package.json:
{
"scripts": {
"db:setup": "create-db-setup",
"setup": "create-db-setup"
}
}Then run:
bun run db:setup
# or
npm run db:setup$ bunx @sidgaikwad/db-setup
๐๏ธ Database Setup CLI
Configure your PostgreSQL database with ease!
================ Database Setup ================
? Choose your PostgreSQL provider: (Use arrow keys)
โฏ Neon (Serverless PostgreSQL)
Supabase (Open Source Firebase Alternative)
Railway (Platform as a Service)
Local PostgreSQL (Docker)
I already have a DATABASE_URL
I'll configure later
[Select your provider and follow the interactive setup]
================ Environment Configuration ================
? Select your .env file location: (Use arrow keys)
โฏ .env (Root directory)
.env.local (Local environment)
.env.development (Development)
.env.production (Production)
config/.env (Config directory)
apps/backend/.env (Monorepo backend)
Custom path...
? Select the environment variable name: (Use arrow keys)
โฏ DATABASE_URL (Standard)
POSTGRES_URL (Alternative)
DB_URL (Short form)
DB_CONNECTION_STRING (Descriptive)
DIRECT_URL (Prisma direct)
DATABASE_CONNECTION (Verbose)
Custom variable name...
โ
Database configured successfully!
๐ Setup completed successfully!- Automatic CLI authentication
- 11 global regions (AWS + Azure)
- Pooled connections
- Free tier available
- Regions: US East, US West, EU Central, EU West, Asia Pacific, South America
- Project creation via CLI
- Global region selection
- Connection pooling
- Generous free tier
- Features: Real-time, Auth, Storage, Edge Functions
- One-click PostgreSQL deployment
- Automatic environment variables
- Simple pricing
- Perfect for: Quick deployments, side projects
- Instant local PostgreSQL
- Pre-configured docker-compose
- Perfect for development
- No cloud account needed
- Node.js >= 18.0.0 OR Bun >= 1.0.0
- npm, yarn, pnpm, or bun
bunx @sidgaikwad/db-setup
# Select: Neon
# Select: .env (Root directory)
# Select: DATABASE_URL (Standard)bunx @sidgaikwad/db-setup
# Select: Neon
# Select: apps/backend/.env (Monorepo backend)
# Select: DATABASE_URL (Standard)bunx @sidgaikwad/db-setup
# Select: Supabase
# Select: .env.local (Local environment)
# Select: POSTGRES_URL (Alternative)# Primary database
bunx @sidgaikwad/db-setup
# Variable: DATABASE_URL
# Analytics database
bunx @sidgaikwad/db-setup
# Variable: ANALYTICS_DATABASE_URLbun add @sidgaikwad/db-setup
bunx @sidgaikwad/db-setup
# Select: .env.local
# Select: DATABASE_URLbun add @sidgaikwad/db-setup
bunx @sidgaikwad/db-setup
# Select: .env
# Select: DATABASE_URLbun add @sidgaikwad/db-setup
bunx @sidgaikwad/db-setup
# Select: .env
# Select: DATABASE_URLnpm install @sidgaikwad/db-setup
npx @sidgaikwad/db-setup
# Select: .env
# Select: POSTGRES_URL- Use
.env.localfor local development (not committed to git) - Use
.env.productionfor production-specific variables - Use
.env.testfor testing environments - Keep backups of your
.envfiles (CLI creates them automatically) - Use descriptive variable names for multiple databases
- Don't commit
.envfiles with real credentials to git - Don't use the same database for development and production
- Don't forget to add
.env*to your.gitignore
.gitignore:
.env
.env.local
.env.*.local
.env.backup.env.example (commit this):
# Database Configuration
DATABASE_URL=postgresql://user:password@localhost:5432/dbnameContributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
MIT ยฉ Siddharth Gaikwad
- @inquirer/prompts for interactive CLI
- chalk for terminal styling
- Neon, Supabase, Railway for excellent database services
Found a bug or need help?
- ๐ Report an issue
- ๐ฌ Start a discussion
- ๐ง Email: gaikwadsiddharth039@gmail.com
- ๐ฆ NPM Package
- ๐ GitHub Repository
- ๐ Documentation
Made with โค๏ธ by Siddharth Gaikwad