dbsmash
v1.0.7
Published
[](https://www.npmjs.com/package/dbsmash) [](https://opensource.org/licenses/MIT) [
- Firebase Firestore
- Supabase (via Prisma ORM)
Describe your app in plain English, select a database, and DbSmash generates production-ready code in seconds.
github
🚀 Features
- 🔍 AI agent converts natural language prompts into schemas
- 🧩 Supports MongoDB (Mongoose), Firestore (Node.js), and Supabase (Prisma)
- 📄 Auto-generates models, seeders, and DB config files
- 🧠 Generates ER diagrams
- 🧪 Automates backend database setup
📦 Installation
npm i dbsmashRequires Node.js v18+
⚙️ Environment Setup
Create a .env file in your project root with the necessary credentials:
# Required for Firebase Firestore
FIREBASE_CREDENTIALS="../../keys.json (download from firestore and save it as keys.json inside the backend root folder)"
# Optional: MongoDB URI
MONGODB_URI=mongodb+srv://username:[email protected]/dbname
# Optional: Prisma/Supabase
Go to dashboard -> project -> projectname -> settings -> api-keys -> Click on connect on the top left
(Inside Connection String)
SUPABASE_DATABASE_URL= Transaction pooler url
SUPABASE_DIRECT_URL= Session pooler url
# AI API Key (Gemini & OpenRouter)
GEMINI_API_KEY=your-key-here
OPEN_ROUTER_MISTRAL=your-key-here
// mistralai/mistral-small-3.2-24b-instruct:free⚠️ Important: Back up your existing
.envfile before runningdbsmash, as it may overwrite it.
🧑💻 CLI Usage
1. Start (Inside Backend Folder)
dbsmash2. Provide a Prompt
Describe your app in plain English, e.g.:
I want an e-commerce app with users, products, and orders3. Select a Database
Choose a database from the prompted list (MongoDB, Firestore, or Supabase).
4. Code Generation
DbSmash will:
- Necessary packages will be installed Automatically
- Generate schema, models, and seeders
- Create database configuration files
Generated Files:
/models/
user.model.js
product.model.js
order.model.js
/config/
dbconnection.js
/seed/
seedUsers.js
seedProducts.js5. Database Initialization
After code generation, DbSmash will prompt you with database-specific commands to spin up the database. Examples:
Supabase:
npx prisma migrate dev
npx prisma studioMongoDB:
node ./src/seed/sampleData.jsFirebase Firestore:
node ./src/firestore/schema.js🧱 Project Structure
dbsmash/
├── lib/ai-agents/ # AI prompt parsing logic
├── models/ # Generated MongoDB or Prisma models
├── config/ # DB connection files
├── seed/ # Sample data for testing
├── server/ # Express + socket.io backend
└── index.js # CLI entry point🛠 Tech Stack
- 🧠 Gemini / OpenRouter (AI agent)
- 🗃 MongoDB / Firestore / Supabase
- ⚙️ Node.js
- 🧰 Prisma ORM
🧪 Example CLI Output
Prompt: "I want a blog app with users and posts"
→ Generating schema...
✔ users.model.js created
✔ posts.model.js created
✔ dbconnection.js created
✔ ER diagram ready📌 Roadmap
- [x] MongoDB & Firestore support
- [x] CLI for instant schema creation
- [ ] PostgreSQL + GraphQL support
- [ ] VS Code extension
- [ ] GitHub Copilot-style schema preview
🤝 Contributing
Pull requests and ideas are welcome! Create an issue or open a discussion to suggest features.
👨💻 Author
Built with ❤️ by N Siddharth Reddy
Backend Developer | Node.js | MongoDB | Prisma | AI Tools
📄 License
This project is licensed under the MIT License.
