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.
• 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.
Installation
To install Polybase via npm, run:
npm install polybase-package
Usage
Step 1: Import Polybase into Your Project
const Polybase = require('polybase-package');
Step 2: Run the following command to start the Polybase CLI:
node userRun.js
Once initialized, Polybase provides a command-line interface for managing database configurations and connections. It also performs the following configuration file checks in the current working directory:
Polybase-Config.json: If not found, the CLI creates a template JSON file with placeholders for supported databases.
{
"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"
}
}
.env File: If not found, the CLI generates a template .env file with key-value placeholders for environment-based configurations to be used in your own Polybase-Config.js file, which you can export via module.exports.
# 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=
module.exports = {
mongoUri: process.env.MONGO_URI || 'your-default-mongo-uri',
postgresUser: process.env.POSTGRES_USER || 'your-default-postgres-user',
redisHost: process.env.REDIS_HOST || 'localhost',
influxToken: process.env.INFLUX_TOKEN || 'your-default-influx-token',
neo4jUri: process.env.NEO4J_URI || 'your-default-neo4j-uri'
};
Ready for Commands
Once configurations are provided, the CLI is fully operational, allowing users to run commands like status, retry, configs, and more.
• 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.
In this version 1.0.3 launch, the package functions to set up and check database configurations. We are actively working on additional functionality to allow developers to query databases and handle cross-database operations (see 'help' command). More commands coming soon!
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.
Alazar Aklilu | Software Engineer | ||
Nathan Patterson | Software Engineer | ||
Gavin Shadinger | Software Engineer |
We welcome contributions! To get started:
1. Clone the repository:
git clone https://github.com/oslabs-beta/Polybase.git
2. Create a new branch for your work:
git checkout -b feature-name
3. Decide where to contribute:
• Contribute to the Polybase-Package
• Contribute to the Polybase-Platform (Website)
4. Commit your changes:
git commit -m 'Add feature'
Push your branch:
git push origin feature-name
5. Submit a pull request to one of the following branches, depending on your work:
• main (requires review)
• dev (requires review)
Note: Please do not push or merge any changes into the following branches:
• alazar
• nathan
• gavin
Polybase was developed with a focus on simplifying multi-database operations and enhancing developer productivity. This project was built through OSLabs, a nonprofit tech accelerator dedicated to advancing open-source software and fostering innovation within the tech community.
Polybase is licensed under the MIT License. See LICENSE for details.