MasterMind-DB is a versatile and extensible CLI tool designed for managing databases and ORM-based projects. It supports multiple ORMs, including Sequelize, and integrates seamlessly with Docker for containerized database management.
- Generate database structures, models, migrations, and seeders.
- Supports multiple ORMs (Sequelize, Prisma, TypeORM).
- Docker integration for starting and stopping containers.
- Dynamic configuration management stored in
.mastermindrc
. - Interactive CLI with prompts and spinners for a smooth user experience.
- Handles volumes and services directly in
docker-compose.yml
. - Allows custom configuration and project settings.
-
Node.js (v16 or later)
sudo apt update sudo apt install nodejs npm node -v npm -v
-
Docker (Latest Version)
sudo apt update sudo apt install docker.io sudo systemctl start docker sudo systemctl enable docker docker --version
-
Docker Compose (V2 recommended)
sudo apt install docker-compose docker-compose --version
npm install -g mastermind-db
npm install mastermind-db
mastermind-db init
- Prompts for:
- Root directory for projects.
- Service name.
- ORM type.
mastermind-db create
- Guides through creating a database service.
- Asks for database type (MySQL/PostgreSQL).
- Prompts for ORM (Sequelize/Prisma/TypeORM).
- Optionally generates a Docker Compose setup.
- Optionally starts Docker containers if available.
mastermind-db manage
- Allows updating configurations or generating files (models, migrations, seeders) for existing services.
mastermind-db delete
- Selects and deletes a service.
- Removes folders, updates
.mastermindrc
, and editsdocker-compose.yml
. - Stops and removes running Docker containers and volumes.
mastermind-db config
- Allows managing root directories and ORM configurations.
- Automatically adds services to
docker-compose.yml
. - Handles starting and stopping Docker containers.
- Ensures volume mappings for persistent storage.
mastermind-db check-docker
- Verifies Docker and Docker Compose installation.
mastermind-db start-docker <service-name>
mastermind-db delete
- Deletes services, containers, and volumes.
mastermind-db init
mastermind-db create
Choose:
- Database: MySQL
- ORM: Sequelize
- Generate Docker Compose: Yes
- Start Docker Container: Yes
mastermind-db manage
- Generate models, migrations, and seeders interactively.
mastermind-db delete
- Select service to delete.
- Deletes files, config, and Docker containers/volumes.
Example:
{
"rootDir": "./src",
"services": {
"auth-service": {
"orm": "Sequelize",
"migrationsDir": "./src/auth-service/sequelize/migrations",
"modelsDir": "./src/auth-service/sequelize/models",
"seedersDir": "./src/auth-service/sequelize/seeders"
}
}
}
-
Docker Not Installed:
- Install Docker and Docker Compose as mentioned in prerequisites.
-
Permission Denied for Docker Commands:
- Add the user to the
docker
group.
sudo usermod -aG docker $USER newgrp docker
- Add the user to the
-
Configuration File Issues:
- Run
mastermind-db config
to update settings.
- Run
Contributions are welcome! Feel free to fork this repository and submit pull requests.
This project is licensed under the MIT License.
For any questions or feedback, please reach out to the repository maintainer.