@sidgaikwad/db-setup 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
- # 🗄️ Create DB Setup
1
+ # 🗄️ Database Setup CLI
2
2
 
3
- > Interactive CLI for setting up PostgreSQL databases with multiple providers
3
+ > Interactive CLI for setting up PostgreSQL databases with multiple providers (Neon, Supabase, Railway, Local Docker)
4
4
 
5
- [![npm version](https://badge.fury.io/js/%40sidgaikwad%2Fcreate-db-setup.svg)](https://www.npmjs.com/package/@sidgaikwad/create-db-setup)
5
+ [![npm version](https://badge.fury.io/js/%40sidgaikwad%2Fdb-setup.svg)](https://www.npmjs.com/package/@sidgaikwad/db-setup)
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
7
 
8
8
  ## ✨ Features
@@ -10,51 +10,147 @@
10
10
  - 🎯 **Multiple Providers**: Neon, Supabase, Railway, Local Docker
11
11
  - 🌍 **Region Selection**: Choose from 11+ global regions with emoji flags
12
12
  - ⚙️ **Auto Configuration**: Automatically writes database URL to .env
13
- - 📁 **Custom .env Paths**: Support for any .env file location (.env, .env.local, config/.env, etc.)
14
- - 🏷️ **Custom Variable Names**: Use any variable name (DATABASE_URL, POSTGRES_URL, DB_URL, etc.)
13
+ - 📁 **Custom .env Paths**: Support for any .env file location
14
+ - 🏷️ **Custom Variable Names**: Use any variable name (DATABASE_URL, POSTGRES_URL, etc.)
15
15
  - 💾 **Safe Updates**: Creates backups before modifying files
16
16
  - 🔒 **Overwrite Protection**: Asks before overwriting existing variables
17
17
  - 🎨 **Beautiful CLI**: Color-coded, interactive prompts
18
- - 🛡️ **Type Safe**: Written in TypeScript
19
18
  - 🚀 **Zero Config**: Works out of the box with Bun or Node.js
20
- - ⚡ **Fast**: Optimized for Bun runtime
21
19
 
22
20
  ## 🚀 Quick Start
23
21
 
24
- ### Run with bunx (Recommended)
22
+ ### Option 1: Run Without Installing (Recommended)
25
23
 
26
24
  ```bash
27
- bunx @sidgaikwad/create-db-setup
25
+ # With Bun
26
+ bunx @sidgaikwad/db-setup
27
+
28
+ # With npm
29
+ npx @sidgaikwad/db-setup
28
30
  ```
29
31
 
30
- ### Or with npx
32
+ ### Option 2: Install Locally
31
33
 
32
34
  ```bash
33
- npx @sidgaikwad/create-db-setup
35
+ # With Bun
36
+ bun add @sidgaikwad/db-setup
37
+
38
+ # With npm
39
+ npm install @sidgaikwad/db-setup
40
+
41
+ # With pnpm
42
+ pnpm add @sidgaikwad/db-setup
43
+
44
+ # With yarn
45
+ yarn add @sidgaikwad/db-setup
34
46
  ```
35
47
 
36
- ### Or Install Globally
48
+ **Then run:**
49
+
50
+ ```bash
51
+ # Using package scripts
52
+ bun run create-db-setup
53
+ # or
54
+ npm run create-db-setup
55
+
56
+ # Using npx/bunx
57
+ bunx @sidgaikwad/db-setup
58
+ # or
59
+ npx @sidgaikwad/db-setup
60
+ ```
61
+
62
+ ### Option 3: Install Globally
37
63
 
38
64
  ```bash
39
65
  # With Bun
40
- bun install -g @sidgaikwad/create-db-setup
66
+ bun install -g @sidgaikwad/db-setup
41
67
 
42
68
  # With npm
43
- npm install -g @sidgaikwad/create-db-setup
69
+ npm install -g @sidgaikwad/db-setup
44
70
 
45
- # Then run
71
+ # Then run anywhere
46
72
  create-db-setup
73
+ # or
74
+ db-setup
47
75
  ```
48
76
 
49
- ### Or use the shorter alias
77
+ ## 📦 Adding to Your Project
78
+
79
+ ### In Next.js, Remix, or any Node.js project:
50
80
 
51
81
  ```bash
52
- bunx @sidgaikwad/create-db-setup
53
- # or after global install
54
- db-setup
82
+ # Install the package
83
+ bun add @sidgaikwad/db-setup
84
+
85
+ # Add to package.json scripts (optional)
86
+ ```
87
+
88
+ **package.json:**
89
+
90
+ ```json
91
+ {
92
+ "scripts": {
93
+ "db:setup": "create-db-setup",
94
+ "setup": "create-db-setup"
95
+ }
96
+ }
97
+ ```
98
+
99
+ **Then run:**
100
+
101
+ ```bash
102
+ bun run db:setup
103
+ # or
104
+ npm run db:setup
55
105
  ```
56
106
 
57
- ## 📦 Supported Providers
107
+ ## 🎯 Usage
108
+
109
+ ```bash
110
+ $ bunx @sidgaikwad/db-setup
111
+
112
+ 🗄️ Database Setup CLI
113
+
114
+ Configure your PostgreSQL database with ease!
115
+
116
+ ================ Database Setup ================
117
+
118
+ ? Choose your PostgreSQL provider: (Use arrow keys)
119
+ ❯ Neon (Serverless PostgreSQL)
120
+ Supabase (Open Source Firebase Alternative)
121
+ Railway (Platform as a Service)
122
+ Local PostgreSQL (Docker)
123
+ I already have a DATABASE_URL
124
+ I'll configure later
125
+
126
+ [Select your provider and follow the interactive setup]
127
+
128
+ ================ Environment Configuration ================
129
+
130
+ ? Select your .env file location: (Use arrow keys)
131
+ ❯ .env (Root directory)
132
+ .env.local (Local environment)
133
+ .env.development (Development)
134
+ .env.production (Production)
135
+ config/.env (Config directory)
136
+ apps/backend/.env (Monorepo backend)
137
+ Custom path...
138
+
139
+ ? Select the environment variable name: (Use arrow keys)
140
+ ❯ DATABASE_URL (Standard)
141
+ POSTGRES_URL (Alternative)
142
+ DB_URL (Short form)
143
+ DB_CONNECTION_STRING (Descriptive)
144
+ DIRECT_URL (Prisma direct)
145
+ DATABASE_CONNECTION (Verbose)
146
+ Custom variable name...
147
+
148
+ ✅ Database configured successfully!
149
+
150
+ 🎉 Setup completed successfully!
151
+ ```
152
+
153
+ ## 📚 Supported Providers
58
154
 
59
155
  ### 🔷 Neon (Serverless PostgreSQL)
60
156
 
@@ -62,6 +158,7 @@ db-setup
62
158
  - 11 global regions (AWS + Azure)
63
159
  - Pooled connections
64
160
  - Free tier available
161
+ - **Regions**: US East, US West, EU Central, EU West, Asia Pacific, South America
65
162
 
66
163
  ### 🟢 Supabase (Open Source Firebase Alternative)
67
164
 
@@ -69,73 +166,138 @@ db-setup
69
166
  - Global region selection
70
167
  - Connection pooling
71
168
  - Generous free tier
169
+ - **Features**: Real-time, Auth, Storage, Edge Functions
72
170
 
73
171
  ### 🚂 Railway (Platform as a Service)
74
172
 
75
173
  - One-click PostgreSQL deployment
76
174
  - Automatic environment variables
77
175
  - Simple pricing
176
+ - **Perfect for**: Quick deployments, side projects
78
177
 
79
178
  ### 🐳 Local Docker
80
179
 
81
180
  - Instant local PostgreSQL
82
181
  - Pre-configured docker-compose
83
182
  - Perfect for development
183
+ - No cloud account needed
84
184
 
85
- ## 🎯 Usage
185
+ ## 🛠️ Requirements
186
+
187
+ - Node.js >= 18.0.0 OR Bun >= 1.0.0
188
+ - npm, yarn, pnpm, or bun
86
189
 
87
- Simply run the CLI and follow the prompts:
190
+ ## 💡 Examples
191
+
192
+ ### Example 1: Standard Setup
88
193
 
89
194
  ```bash
90
- $ bunx @sidgaikwad/create-db-setup
195
+ bunx @sidgaikwad/db-setup
196
+ # Select: Neon
197
+ # Select: .env (Root directory)
198
+ # Select: DATABASE_URL (Standard)
199
+ ```
91
200
 
92
- ================ Database Setup ================
201
+ ### Example 2: Monorepo Setup
93
202
 
94
- ? Choose your PostgreSQL provider:
95
- Neon (Serverless)
96
- Supabase (Cloud)
97
- Railway
98
- Local PostgreSQL (Docker)
99
- I already have a DATABASE_URL
100
- I'll configure later
203
+ ```bash
204
+ bunx @sidgaikwad/db-setup
205
+ # Select: Neon
206
+ # Select: apps/backend/.env (Monorepo backend)
207
+ # Select: DATABASE_URL (Standard)
208
+ ```
101
209
 
102
- [Select your provider and follow the interactive setup]
210
+ ### Example 3: Custom Variable Name
103
211
 
104
- ================ Environment Configuration ================
212
+ ```bash
213
+ bunx @sidgaikwad/db-setup
214
+ # Select: Supabase
215
+ # Select: .env.local (Local environment)
216
+ # Select: POSTGRES_URL (Alternative)
217
+ ```
218
+
219
+ ### Example 4: Multiple Databases
105
220
 
106
- ? Enter the path to your .env file: .env
107
- ? Enter the environment variable name for your database URL: DATABASE_URL
221
+ ```bash
222
+ # Primary database
223
+ bunx @sidgaikwad/db-setup
224
+ # Variable: DATABASE_URL
108
225
 
109
- DATABASE_URL has been added to your .env file!
226
+ # Analytics database
227
+ bunx @sidgaikwad/db-setup
228
+ # Variable: ANALYTICS_DATABASE_URL
110
229
  ```
111
230
 
112
- ### Flexible Configuration
231
+ ## 🔧 Integration with Frameworks
113
232
 
114
- The CLI now supports:
233
+ ### Next.js
115
234
 
116
- - **Custom .env file paths**: `.env`, `.env.local`, `config/.env`, etc.
117
- - **Custom variable names**: `DATABASE_URL`, `POSTGRES_URL`, `DB_CONNECTION_STRING`, etc.
118
- - **Automatic backup**: Creates `.env.backup` before making changes
119
- - **Overwrite protection**: Asks before overwriting existing variables
235
+ ```bash
236
+ bun add @sidgaikwad/db-setup
237
+ bunx @sidgaikwad/db-setup
238
+ # Select: .env.local
239
+ # Select: DATABASE_URL
240
+ ```
120
241
 
121
- ## 🛠️ Requirements
242
+ ### Remix
122
243
 
123
- - Node.js >= 18.0.0 OR Bun >= 1.0.0
124
- - npm or yarn or pnpm or bun
244
+ ```bash
245
+ bun add @sidgaikwad/db-setup
246
+ bunx @sidgaikwad/db-setup
247
+ # Select: .env
248
+ # Select: DATABASE_URL
249
+ ```
250
+
251
+ ### SvelteKit
252
+
253
+ ```bash
254
+ bun add @sidgaikwad/db-setup
255
+ bunx @sidgaikwad/db-setup
256
+ # Select: .env
257
+ # Select: DATABASE_URL
258
+ ```
259
+
260
+ ### Express/Fastify
261
+
262
+ ```bash
263
+ npm install @sidgaikwad/db-setup
264
+ npx @sidgaikwad/db-setup
265
+ # Select: .env
266
+ # Select: POSTGRES_URL
267
+ ```
268
+
269
+ ## 📝 Best Practices
125
270
 
126
- ## 📚 API
271
+ ### DO:
127
272
 
128
- You can also use this as a library in your own Node.js projects:
273
+ - Use `.env.local` for local development (not committed to git)
274
+ - Use `.env.production` for production-specific variables
275
+ - Use `.env.test` for testing environments
276
+ - Keep backups of your `.env` files (CLI creates them automatically)
277
+ - Use descriptive variable names for multiple databases
129
278
 
130
- ```typescript
131
- import { setupNeon, setupSupabase } from "@sidgaikwad/create-db-setup";
279
+ ### ❌ DON'T:
132
280
 
133
- // Use individual provider setups
134
- const databaseUrl = await setupNeon();
281
+ - Don't commit `.env` files with real credentials to git
282
+ - Don't use the same database for development and production
283
+ - Don't forget to add `.env*` to your `.gitignore`
135
284
 
136
- // Or use the interactive CLI
137
- import { handleDatabaseSetup } from "@sidgaikwad/create-db-setup";
138
- const databaseUrl = await handleDatabaseSetup();
285
+ ### 🔒 Security
286
+
287
+ **.gitignore:**
288
+
289
+ ```gitignore
290
+ .env
291
+ .env.local
292
+ .env.*.local
293
+ .env.backup
294
+ ```
295
+
296
+ **.env.example** (commit this):
297
+
298
+ ```env
299
+ # Database Configuration
300
+ DATABASE_URL=postgresql://user:password@localhost:5432/dbname
139
301
  ```
140
302
 
141
303
  ## 🤝 Contributing
@@ -150,20 +312,28 @@ Contributions are welcome! Please feel free to submit a Pull Request.
150
312
 
151
313
  ## 📝 License
152
314
 
153
- MIT © [siddharth]
315
+ MIT © [Siddharth Gaikwad](https://github.com/sidgaikwad)
154
316
 
155
317
  ## 🙏 Acknowledgments
156
318
 
157
319
  - [@inquirer/prompts](https://github.com/SBoudrias/Inquirer.js) for interactive CLI
158
320
  - [chalk](https://github.com/chalk/chalk) for terminal styling
159
- - All the database providers for their excellent CLIs
321
+ - [Neon](https://neon.tech), [Supabase](https://supabase.com), [Railway](https://railway.app) for excellent database services
160
322
 
161
- ## 🐛 Known Issues
323
+ ## 🐛 Issues & Support
162
324
 
163
- See [GitHub Issues](https://github.com/sidgaikwad/create-db-setup/issues)
164
-
165
- ## 📮 Support
325
+ Found a bug or need help?
166
326
 
327
+ - 🐛 [Report an issue](https://github.com/sidgaikwad/db-setup/issues)
328
+ - 💬 [Start a discussion](https://github.com/sidgaikwad/db-setup/discussions)
167
329
  - 📧 Email: gaikwadsiddharth039@gmail.com
168
- - 🐦 Twitter: [_sidd24_](https://twitter.com/_sidd24_)
169
- - 💬 Discord: [Join our server](https://discord.gg/mJp3dckf)
330
+
331
+ ## 📮 Links
332
+
333
+ - 📦 [NPM Package](https://www.npmjs.com/package/@sidgaikwad/db-setup)
334
+ - 🐙 [GitHub Repository](https://github.com/sidgaikwad/db-setup)
335
+ - 📚 [Documentation](https://github.com/sidgaikwad/db-setup#readme)
336
+
337
+ ---
338
+
339
+ Made with ❤️ by [Siddharth Gaikwad](https://github.com/sidgaikwad)