Polybase is a robust Node.js library designed for seamless integration and synchronization across SQL, NoSQL, graph, and time-series databases. With a built-in CLI, developers can easily manage configurations, query databases, and handle cross-database operations efficiently.
Features
- Multi-Database Support: Handles MongoDB, PostgreSQL, Redis, Neo4j, and InfluxDB with a unified interface.
- Powerful CLI: Supports 10+ commands (e.g., status, retry, clear) for streamlined debugging and database management.
- State Management: Tracks connections and configurations for local and remote databases.
- Circular Dependency Handling: Ensures scalability and maintainability.
- Robust Rollback Mechanism: Guarantees 100% rollback success for critical commands.
- Seamless Configuration Loading: Reads JSON and .env files for environment-based setups.
Install Polybase via npm: npm install polybase-package
Usage
Import Polybase in Your Project const Polybase = require('polybase-package');
To start the Polybase CLI, use node userRun.js.
The Polybase CLI is initialized, providing a command-line interface for managing database configurations and connections.
Checks for Configuration Files: - Polybase-Config.json: The program checks if this file exists in the current working directory. If not found, it creates a template JSON file with placeholders for supported databases. - .env File: Similarly, checks if a .env file exists. If missing, generates a template .env file with key-value placeholders for environment-based configurations.
Provides Templates for Configuration
For Polybase-Config.json:
{
"mongo": {
"url": "url",
"database": "your-database-name"
},
"postgres": {
"host": "localhost",
"port": port,
"user": "your-username",
"password": "your-password",
"database": "your-database-name"
},
"redis": {
"host": "localhost",
"port": port
},
"neo4j": {
"url": "url",
"username": "your-username",
"password": "your-password"
},
"influx": {
"url": "url",
"token": "your-token",
"bucket": "your-bucket",
"org": "your-org"
}
}
For .env:
MongoDB Configuration
MONGO_URI=
MONGO_DATABASE=
PostgreSQL Configuration
POSTGRES_USER=
POSTGRES_HOST=
POSTGRES_DATABASE=
POSTGRES_PASSWORD=
POSTGRES_PORT=
Redis Configuration
REDIS_HOST=
REDIS_PORT=
REDIS_USERNAME=
REDIS_PASSWORD=
InfluxDB Configuration
INFLUX_URL=
INFLUX_TOKEN=
INFLUX_ORG=
INFLUX_BUCKET=
Neo4j Configuration
NEO4J_URI=
NEO4J_USERNAME=
NEO4J_PASSWORD=
Prompts for Manual Configuration: Logs instructions for filling in the placeholder values in the JSON or .env file to set up the required database configurations.
Ready for Commands: Once configurations are provided, the CLI is fully operational, allowing users to run commands like status, retry, configs, and more.
CLI Overview
Polybase includes a CLI for direct database interaction. Run the CLI with: node userRun.js
Available Commands
- status: View the connection status of all configured databases.
- retry: Retry failed database connections.
- clear: Clears the terminal and resets CLI state.
- configs: Displays the current database configurations.
- help: Lists all available commands and potential query executions.
Supported Databases
- MongoDB: Document-based NoSQL database.
- PostgreSQL: Relational SQL database.
- Redis: Key-value store for caching and real-time operations.
- Neo4j: Graph database for relationship-based data models.
- InfluxDB: Time-series database for metrics and monitoring.
Contributing
We welcome contributions! To get started:
- Fork the repository.
- Create a new branch: git checkout -b feature-name.
- Commit your changes: git commit -m 'Add feature'.
- Push to the branch: git push origin feature-name.
- Submit a pull request.
License
Polybase is licensed under the MIT License. See LICENSE for details.
Acknowledgments
Polybase was developed with a focus on simplifying multi-database operations and enhancing developer productivity. Special thanks to the contributors and supporters who made this project possible.
<title>List of Names with Badges</title> <style> .name-list { list-style-type: none; padding: 0; } .name-item { display: flex; align-items: center; margin-bottom: 10px; } .badges { margin-left: 10px; } </style>- Alazar Aklilu
- Nathan Patterson
- Gavin Shadinger