{"id":15518077,"url":"https://github.com/iamrajiv/neon-db-cli","last_synced_at":"2025-04-23T04:07:54.857Z","repository":{"id":166319000,"uuid":"641806496","full_name":"iamrajiv/neon-db-cli","owner":"iamrajiv","description":"The NeonDB CLI Tool is a command-line interface that enables interaction with the Neon Database APIs.","archived":false,"fork":false,"pushed_at":"2024-11-08T18:38:17.000Z","size":5115,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-23T04:07:47.087Z","etag":null,"topics":["cli","go","neondatabase","postgresql","serverless","sql"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iamrajiv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-17T07:53:44.000Z","updated_at":"2025-03-29T04:16:05.000Z","dependencies_parsed_at":"2025-03-05T04:41:47.514Z","dependency_job_id":null,"html_url":"https://github.com/iamrajiv/neon-db-cli","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamrajiv%2Fneon-db-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamrajiv%2Fneon-db-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamrajiv%2Fneon-db-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamrajiv%2Fneon-db-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iamrajiv","download_url":"https://codeload.github.com/iamrajiv/neon-db-cli/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250366720,"owners_count":21418772,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","go","neondatabase","postgresql","serverless","sql"],"created_at":"2024-10-02T10:14:51.575Z","updated_at":"2025-04-23T04:07:54.848Z","avatar_url":"https://github.com/iamrajiv.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"https://neon.tech/favicon/favicon.png\" height=\"auto\" width=\"200\" /\u003e\n\u003cbr /\u003e\n\u003ch1\u003eNeon Database CLI\u003c/h1\u003e\n\u003cp\u003e\nCLI tool to interact with the Neon Database APIs\n\u003c/p\u003e\n\u003ca href=\"https://github.com/iamrajiv/neon-db-cli/network/members\"\u003e\u003cimg src=\"https://img.shields.io/github/forks/iamrajiv/neon-db-cli?color=0969da\u0026style=for-the-badge\" height=\"auto\" width=\"auto\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/iamrajiv/neon-db-cli/stargazers\"\u003e\u003cimg src=\"https://img.shields.io/github/stars/iamrajiv/neon-db-cli?color=0969da\u0026style=for-the-badge\" height=\"auto\" width=\"auto\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/iamrajiv/neon-db-cli/blob/main/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/github/license/iamrajiv/neon-db-cli?color=0969da\u0026style=for-the-badge\" height=\"auto\" width=\"auto\" /\u003e\u003c/a\u003e\n\u003c/div\u003e\n\n## About\n\nThe NeonDB CLI Tool is a command-line interface that enables interaction with the Neon Database APIs.\n\n[Neon](https://neon.tech/) is a fully managed serverless PostgreSQL solution. Neon offers modern developer features such as serverless computing, branching, bottomless storage, and more. Learn more about Neon [here](https://neon.tech/docs/introduction).\n\nThe Neon API allows you to programmatically manage your Neon account and its objects, including:\n\n- API keys\n- Projects\n- Branches\n- Compute endpoints\n- Databases\n- Roles\n\nTo authenticate with the Neon API, you need to include an API key token in the Authorization header of your API request.\n\nThe Neon API uses `Bearer Token Authentication`. Therefore, the Authorization header should be formatted as follows:\n\n- `H 'Authorization: Bearer $NEON_API_KEY'`\n\nFor example:\n\n```shell\ncurl 'https://console.neon.tech/api/v2/projects' \\\n  -H 'Accept: application/json' \\\n  -H 'Authorization: Bearer $NEON_API_KEY' \\\n  -H 'Content-Type: application/json'\n\n```\n\nTo try an API request in the browser from this page, click the `Try It` button on any Neon API endpoint, and enter the token in the `Bearer` prompt. You can select the endpoint from the sidebar.\n\nThe [Get a list of projects](https://api-docs.neon.tech/reference/listprojects) endpoint is a simple one to try as it only requires an API key token.\n\nA Neon API key is a randomly-generated 64-bit token that remains valid until it is revoked.\n\nTo create an API key, follow these steps:\n\n1. Go to the **[Developer Settings](https://console.neon.tech/app/settings/api-keys)** page in the Neon Console.\n2. Provide a name for the API key.\n3. Click **Create** and copy the generated token.\n\nStore the token in a secure location. Once you leave the `Developer Settings` page in the Neon Console, the token will not be visible or copyable.\n\nFor more information on managing Neon API keys, refer to the [Manage API keys](https://neon.tech/docs/manage/api-keys) section in the Neon documentation.\n\nThe project's folder structure is as follows:\n\n```shell\n.\n├── .env\n├── LICENSE\n├── Makefile\n├── README.md\n├── apis\n│   ├── api_keys\n│   │   └── api_keys.go\n│   └── projects\n│       └── projects.go\n├── assets\n│   └── neon-db-cli.svg\n├── cmd\n│   └── cmd.go\n├── go.mod\n├── go.sum\n├── main.go\n└── utils\n    └── utils.go\n```\n\n## Usage\n\n1. Follow the instructions **[here](https://neon.tech/docs/get-started-with-neon/setting-up-a-project)** to set up a project in Neon.\n2. Configure the database connection details in a **`.env`** file.\n3. Run the command **`make all`** to install all the dependencies, remove the previous binary, and build a new binary named **`neondb`**.\n4. Use the command **`./neondb`** to run the CLI tool.\n\nWhen we run `./neondb`, we get the following output:\n\n```shell\n➜  neon-db-cli git:(main) ✗ ./neondb\nNeon Database CLI\n\nUsage:\n  neondb [command]\n\nAvailable Commands:\n  completion   Generate the autocompletion script for the specified shell\n  createapikey Create a new API key for your Neon account\n  help         Help about any command\n  listapikeys  List API keys for your Neon account\n  revokeapikey Revoke an API key for your Neon account\n\nFlags:\n  -h, --help   help for neondb\n\nUse \"neondb [command] --help\" for more information about a command.\n```\n\n### Instructions for setting environment variables\n\nTo run the project locally, create a `.env` file and add the following environment variables:\n\n- **`API_KEY`**: API key for your Neon account.\n\nYou can find your API key on the [Developer Settings](https://console.neon.tech/app/settings/api-keys) page.\n\n## Demonstration\n\nBefore the demonstration, I set up the new project and configured the database connection details in a `.env` file.\n\nWhen I run the available commands, I get the following output:\n\n#### completion\n\n```shell\n➜  neon-db-cli git:(main) ✗ ./neondb completion\nGenerate the autocompletion script for neondb for the specified shell.\nSee each sub-command's help for details on how to use the generated script.\n\nUsage:\n  neondb completion [command]\n\nAvailable Commands:\n  bash        Generate the autocompletion script for bash\n  fish        Generate the autocompletion script for fish\n  powershell  Generate the autocompletion script for powershell\n  zsh         Generate the autocompletion script for zsh\n\nFlags:\n  -h, --help   help for completion\n\nUse \"neondb completion [command] --help\" for more information about a command.\n```\n\n#### createapikey\n\n```shell\n➜  neon-db-cli git:(main) ✗ ./neondb createapikey --keyname=key2\n{\"id\":000002,\"key\":\"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\"}\n```\n\n#### help\n\n```shell\n➜  neon-db-cli git:(main) ✗ ./neondb help\nNeon Database CLI\n\nUsage:\n  neondb [command]\n\nAvailable Commands:\n  completion   Generate the autocompletion script for the specified shell\n  createapikey Create a new API key for your Neon account\n  help         Help about any command\n  listapikeys  List API keys for your Neon account\n  revokeapikey Revoke an API key for your Neon account\n\nFlags:\n  -h, --help   help for neondb\n\nUse \"neondb [command] --help\" for more information about a command.\n```\n\n#### listapikeys\n\n```shell\n➜  neon-db-cli git:(main) ✗ ./neondb listapikeys\n[{\"id\":000002,\"name\":\"key2\",\"created_at\":\"2023-05-17T07:42:45Z\",\"last_used_at\":null,\"last_used_from_addr\":\"\"},{\"id\":000001,\"name\":\"key1\",\"created_at\":\"2023-05-16T19:12:11Z\",\"last_used_at\":\"2023-05-17T07:43:51Z\",\"last_used_from_addr\":\"49.37.25.219\"}]\n```\n\n#### revokeapikey\n\n```shell\n➜  neon-db-cli git:(main) ✗ ./neondb revokeapikey --keyid=000002\n{\"id\":000002,\"name\":\"key2\",\"revoked\":true,\"last_used_at\":null,\"last_used_from_addr\":\"\"}\n```\n\n## License\n\n[MIT](https://github.com/iamrajiv/neon-db-cli/blob/main/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiamrajiv%2Fneon-db-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiamrajiv%2Fneon-db-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiamrajiv%2Fneon-db-cli/lists"}