Package Exports
- @sidgaikwad/db-setup
- @sidgaikwad/db-setup/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@sidgaikwad/db-setup) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
🗄️ Create DB Setup
Interactive CLI for setting up PostgreSQL databases with multiple providers
✨ Features
- 🎯 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 (.env, .env.local, config/.env, etc.)
- 🏷️ Custom Variable Names: Use any variable name (DATABASE_URL, POSTGRES_URL, DB_URL, etc.)
- 💾 Safe Updates: Creates backups before modifying files
- 🔒 Overwrite Protection: Asks before overwriting existing variables
- 🎨 Beautiful CLI: Color-coded, interactive prompts
- 🛡️ Type Safe: Written in TypeScript
- 🚀 Zero Config: Works out of the box with Bun or Node.js
- ⚡ Fast: Optimized for Bun runtime
🚀 Quick Start
Run with bunx (Recommended)
bunx @sidgaikwad/create-db-setupOr with npx
npx @sidgaikwad/create-db-setupOr Install Globally
# With Bun
bun install -g @sidgaikwad/create-db-setup
# With npm
npm install -g @sidgaikwad/create-db-setup
# Then run
create-db-setupOr use the shorter alias
bunx @sidgaikwad/create-db-setup
# or after global install
db-setup📦 Supported Providers
🔷 Neon (Serverless PostgreSQL)
- Automatic CLI authentication
- 11 global regions (AWS + Azure)
- Pooled connections
- Free tier available
🟢 Supabase (Open Source Firebase Alternative)
- Project creation via CLI
- Global region selection
- Connection pooling
- Generous free tier
🚂 Railway (Platform as a Service)
- One-click PostgreSQL deployment
- Automatic environment variables
- Simple pricing
🐳 Local Docker
- Instant local PostgreSQL
- Pre-configured docker-compose
- Perfect for development
🎯 Usage
Simply run the CLI and follow the prompts:
$ bunx @sidgaikwad/create-db-setup
================ Database Setup ================
? Choose your PostgreSQL provider:
❯ Neon (Serverless)
Supabase (Cloud)
Railway
Local PostgreSQL (Docker)
I already have a DATABASE_URL
I'll configure later
[Select your provider and follow the interactive setup]
================ Environment Configuration ================
? Enter the path to your .env file: .env
? Enter the environment variable name for your database URL: DATABASE_URL
✅ DATABASE_URL has been added to your .env file!Flexible Configuration
The CLI now supports:
- Custom .env file paths:
.env,.env.local,config/.env, etc. - Custom variable names:
DATABASE_URL,POSTGRES_URL,DB_CONNECTION_STRING, etc. - Automatic backup: Creates
.env.backupbefore making changes - Overwrite protection: Asks before overwriting existing variables
🛠️ Requirements
- Node.js >= 18.0.0 OR Bun >= 1.0.0
- npm or yarn or pnpm or bun
📚 API
You can also use this as a library in your own Node.js projects:
import { setupNeon, setupSupabase } from "@sidgaikwad/create-db-setup";
// Use individual provider setups
const databaseUrl = await setupNeon();
// Or use the interactive CLI
import { handleDatabaseSetup } from "@sidgaikwad/create-db-setup";
const databaseUrl = await handleDatabaseSetup();🤝 Contributing
Contributions 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
📝 License
MIT © [siddharth]
🙏 Acknowledgments
- @inquirer/prompts for interactive CLI
- chalk for terminal styling
- All the database providers for their excellent CLIs
🐛 Known Issues
See GitHub Issues
📮 Support
- 📧 Email: gaikwadsiddharth039@gmail.com
- 🐦 Twitter: sidd24
- 💬 Discord: Join our server