|
1 |
| -# 📚 Drizzle Setup CLI |
| 1 | +# 🗄️ Drizzle Setup CLI |
2 | 2 |
|
3 |
| -A powerful CLI tool to automatically scaffold and configure database setup using **Drizzle ORM** for PostgreSQL,SQLite,MySQL and More. |
| 3 | +A powerful CLI tool that automatically scaffolds and configures database setup using **Drizzle ORM** for PostgreSQL, SQLite, MySQL, and more databases. |
4 | 4 |
|
5 | 5 | ---
|
6 | 6 |
|
7 | 7 | ## ✨ Features
|
8 | 8 |
|
9 |
| -- 📦 **Zero Config Setup** – Instantly scaffold DB structure and config with minimal input. |
10 |
| -- 📜 **Drizzle Scripts** – Automatically updates `package.json` with Drizzle CLI scripts. |
11 |
| -- 🔧 **.env Auto Update** – Automatically injects required environment variables. |
12 |
| -- 🧩 **Multiple DB Support** – Works seamlessly with PostgreSQL,SQLite,MySQL and More setups. |
13 |
| -- 📁 **Template Copying** – Instantly sets up a working `target-folder` structure. |
| 9 | +- 🚀 **Zero Configuration Setup** – Instantly scaffold database structure and config with minimal input |
| 10 | +- 📜 **Automated Script Generation** – Automatically updates `package.json` with essential Drizzle CLI scripts |
| 11 | +- 🔐 **Environment Management** – Automatically injects required environment variables into `.env` |
| 12 | +- 🗃️ **Multi-Database Support** – Seamlessly works with PostgreSQL, SQLite, MySQL, and other popular databases |
| 13 | +- 📁 **Template System** – Instantly sets up a working project structure with best practices |
| 14 | +- 🎯 **Interactive Setup** – Guided CLI experience with smart defaults |
| 15 | +- 📦 **Dependency Management** – Automatically installs required packages based on your database choice |
14 | 16 |
|
15 | 17 | ---
|
16 | 18 |
|
17 |
| -## 📦 Installation |
| 19 | +## 🚀 Quick Start |
18 | 20 |
|
19 |
| -Install globally via your preferred package manager: |
| 21 | +Navigate to your project directory and run: |
20 | 22 |
|
21 | 23 | ```bash
|
22 |
| -npm install -g drizzle-setup |
23 |
| -# or |
24 | 24 | npx drizzle-setup
|
25 | 25 | ```
|
26 | 26 |
|
| 27 | +The CLI will guide you through an interactive setup process: |
| 28 | + |
| 29 | +### Setup Flow |
| 30 | + |
| 31 | +1. **🗄️ Database Selection** – Choose from PostgreSQL, SQLite, MySQL, and more |
| 32 | +2. **⚙️ Configuration Preset** – Select from optimized presets for different use cases |
| 33 | +3. **📁 Target Directory** – Specify where to create your database files |
| 34 | +4. **📋 Template Selection** – Choose from various boilerplate templates |
| 35 | +5. **🔧 Config Generation** – Automatically create `drizzle.config.ts` |
| 36 | +6. **🔐 Environment Setup** – Update `.env` with required variables |
| 37 | +7. **📦 Package Management** – Install dependencies via your preferred package manager |
| 38 | +8. **✅ Final Verification** – Ensure everything is set up correctly |
| 39 | + |
27 | 40 | ---
|
28 | 41 |
|
29 |
| -## 🚀 Quick Start |
| 42 | +## 🗃️ Supported Databases |
30 | 43 |
|
31 |
| -Just run the CLI in your project directory: |
| 44 | +### PostgreSQL |
32 | 45 |
|
33 |
| -```bash |
34 |
| -drizzle-setup |
35 |
| -``` |
| 46 | +- **Default PostgreSQL** – Standard PostgreSQL setup |
| 47 | +- **Neon** – Serverless PostgreSQL with automatic scaling |
| 48 | +- **Supabase** – Open-source Firebase alternative |
| 49 | +- **Vercel Postgres** – Serverless PostgreSQL by Vercel |
36 | 50 |
|
37 |
| -You'll be guided through: |
| 51 | +### SQLite |
38 | 52 |
|
39 |
| -1. **Choosing your database** (PostgreSQL or SQLite moreover) |
40 |
| -2. **Selecting a config preset** |
41 |
| -3. **Specifying a target folder** |
42 |
| -4. **Copying boilerplate files** |
43 |
| -5. **Setting up `drizzle.config.ts`** |
44 |
| -6. **Updating `.env` and `package.json`** |
45 |
| -7. **Installing dependencies** via your chosen package manager |
| 53 | +- **Default SQLite** – Local SQLite database |
| 54 | +- **Turso** – Edge SQLite database |
| 55 | +- **Bun SQLite** – High-performance SQLite with Bun runtime |
| 56 | +- **Cloudflare D1** – Serverless SQLite at the edge |
46 | 57 |
|
47 |
| ---- |
| 58 | +### MySQL |
48 | 59 |
|
49 |
| -## 🧪 Supported Databases |
| 60 | +- **Default MySQL** – Standard MySQL setup |
| 61 | +- **PlanetScale** – Serverless MySQL platform |
| 62 | +- **Railway MySQL** – Cloud MySQL hosting |
50 | 63 |
|
51 |
| -- PostgreSQL - Default, Neon |
52 |
| -- SQLite - Default, Turso, Bun SQLite |
| 64 | +### Other Databases |
53 | 65 |
|
54 |
| -Each database type comes with its own pre-configured templates and `.env` variables. |
| 66 | +- **MongoDB** – NoSQL document database |
| 67 | +- **Redis** – In-memory data structure store |
| 68 | + |
| 69 | +> Each database type comes with pre-configured templates, optimized settings, and environment variables. |
55 | 70 |
|
56 | 71 | ---
|
57 | 72 |
|
58 |
| -## 🧱 Directory Structure |
| 73 | +## 🏗️ Project Structure |
59 | 74 |
|
60 |
| -After setup, your project might look like this: |
| 75 | +After setup, your project will have a clean, organized structure: |
61 | 76 |
|
62 | 77 | ```
|
63 | 78 | project-root/
|
64 |
| -├── drizzle.config.ts |
65 |
| -├── .env |
66 |
| -├── [target-folder]/ |
67 |
| -│ ├── schema.ts |
68 |
| -│ └── index.ts |
| 79 | +├── node_modules/ # Installed dependencies |
| 80 | +├── drizzle.config.ts # Drizzle configuration |
| 81 | +├── .env # Environment variables |
| 82 | +├── .env.example # Example environment file |
| 83 | +├── package.json # Updated with Drizzle scripts |
| 84 | +├── [target-folder]/ # Your database folder |
| 85 | +│ ├── schema.ts # Database schema definitions |
| 86 | +│ ├── index.ts # Database connection and exports |
69 | 87 | ```
|
70 | 88 |
|
71 | 89 | ---
|
72 | 90 |
|
73 |
| -## 📄 License |
| 91 | +## Perfect for Modern Stacks 🏗️ |
| 92 | + |
| 93 | +This tool shines especially bright with modern frameworks: |
| 94 | + |
| 95 | +### 🚀 **Astro Projects** |
| 96 | + |
| 97 | +```bash |
| 98 | +# In your Astro project |
| 99 | +npx drizzle-setup |
| 100 | +# Choose PostgreSQL + Vercel |
| 101 | +# Boom! Database ready for your Astro app |
| 102 | +``` |
74 | 103 |
|
75 |
| -MIT License |
| 104 | +### ⚡ **Next.js Apps** |
| 105 | + |
| 106 | +```bash |
| 107 | +# Perfect for Next.js API routes |
| 108 | +npx drizzle-setup |
| 109 | +# Select your preferred database |
| 110 | +# Start building features, not configs |
| 111 | +``` |
| 112 | + |
| 113 | +### 🎯 **Any JavaScript/TypeScript Project** |
| 114 | + |
| 115 | +Whether it's Express, Fastify, SvelteKit, or any other framework - this CLI has got you covered. |
| 116 | + |
| 117 | +--- |
| 118 | + |
| 119 | +## Real-World Impact 📈 |
| 120 | + |
| 121 | +**Before Drizzle Setup CLI:** |
| 122 | + |
| 123 | +- ⏰ 2-3 hours of setup time |
| 124 | +- 🐛 Configuration errors and typos |
| 125 | +- 📚 Constant reference to documentation |
| 126 | +- 😫 Frustration and context switching |
| 127 | + |
| 128 | +**After Drizzle Setup CLI:** |
| 129 | + |
| 130 | +- ⚡ 30 seconds to complete setup |
| 131 | +- ✅ Zero configuration errors |
| 132 | +- 🎯 Focus on building features |
| 133 | +- 😊 Happy developer experience |
76 | 134 |
|
77 | 135 | ---
|
| 136 | + |
| 137 | +## 📄 License |
| 138 | + |
| 139 | +MIT License © 2025 Drizzle Team |
0 commit comments