create-postgresql
v1.0.1723724944026
Published
A command-line interface (CLI) tool to quickly create a temporary PostgreSQL database for development purposes.
Downloads
20
Readme
create-postgresql
A command-line interface (CLI) tool to quickly create a temporary PostgreSQL database for development purposes. The PostgreSQL instance is running in my own server in Hetzner. The database is store automatically deleted every day at midnight UTC.
You can host the backend yourself if you want. The backend source code is available at create-postgresql.
Quick Start
npx create-postgresql
Installation
You can install create-postgresql
globally using npm:
npm install -g create-postgresql
Usage
After installation, you can run the CLI tool using the following command:
create-postgresql
This will start the process of creating a temporary PostgreSQL database.
Options
The CLI supports several command-line options:
--api-url, -a
: Overrides the default backend API URL.--frontend-url, -f
: Overrides the default frontend URL.--poll-interval, -p
: Polling interval in milliseconds (default: 2000)--max-attempts, -m
: Maximum poll attempts (default: 30)
Example usage with options:
create-postgresql --api-url https://api.example.com --frontend-url https://app.example.com
How It Works
- When you run the command, it generates a unique session ID.
- It opens a verification URL in your default browser.
- The CLI waits for you to complete the verification process. This is needed to prevent abuse.
- Once verified, the CLI continue its work to create a temporary PostgreSQL database.
- Finally, it displays the database credentials and connection information for both the direct and pooled connections. It also runs a quick check to ensure the database is working.
Development
To set up the project for development:
Clone the repository:
git clone https://github.com/nicnocquee/create-postgresql.git cd create-postgresql
Install dependencies:
npm install
Run the development version:
npm run dev
Dependencies
- axios: Promise-based HTTP client for making API requests
- open: Opens URLs in the user's preferred browser
- yargs: Command-line argument parser
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
License
This project is licensed under the MIT License.