{"id":13878905,"url":"https://github.com/planetscale/planetscale-ruby","last_synced_at":"2025-07-16T14:33:13.617Z","repository":{"id":41226784,"uuid":"335461943","full_name":"planetscale/planetscale-ruby","owner":"planetscale","description":"Ruby client for PlanetScale databases","archived":true,"fork":false,"pushed_at":"2022-11-16T19:19:36.000Z","size":85661,"stargazers_count":30,"open_issues_count":2,"forks_count":6,"subscribers_count":11,"default_branch":"main","last_synced_at":"2024-11-13T02:49:22.674Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/planetscale.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}},"created_at":"2021-02-03T00:28:59.000Z","updated_at":"2024-01-04T16:54:27.000Z","dependencies_parsed_at":"2023-01-21T08:46:46.278Z","dependency_job_id":null,"html_url":"https://github.com/planetscale/planetscale-ruby","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/planetscale%2Fplanetscale-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/planetscale%2Fplanetscale-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/planetscale%2Fplanetscale-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/planetscale%2Fplanetscale-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/planetscale","download_url":"https://codeload.github.com/planetscale/planetscale-ruby/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226138849,"owners_count":17579496,"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":[],"created_at":"2024-08-06T08:02:03.822Z","updated_at":"2024-11-24T07:31:24.422Z","avatar_url":"https://github.com/planetscale.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"# PlanetScale Ruby Client\n[![Gem Version](https://badge.fury.io/rb/planetscale.svg)](https://rubygems.org/gems/planetscale)\n\n⚠️ This Gem is not currently maintained. If you're looking to connect to PlanetScale with a Rails application, follow our [Rails guide](https://docs.planetscale.com/tutorials/connect-rails-app) which uses [Connection strings](https://docs.planetscale.com/concepts/connection-strings). ⚠️\n\nThis Gem provides an easy to use client for connecting your Ruby application to PlanetScale. It handles setting up a local proxy that allows you to connect to any PlanetScale database and branch without reconfiguration, so that you can easily swap and choose using only environment variables.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'planetscale'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install planetscale\n\n## Usage\n\nThis Gem exposes one class, and a singleton of that for configuring a 'global' instance of the proxy. This is recommended for most users who do not need to connect to multiple databases simultaneously. There are many ways to configure the connection, for local development we recommend:\n\nThe Gem will pick up configuration created by the CLI, to point it to your database run this in the root of your Rails project:\n\n```\n~\u003e pscale branch switch main --database \u003cdb_name\u003e\nFinding branch main on database \u003cdb_name\u003e\nSuccessfully switched to branch main on database \u003cdb_name\u003e\n```\n\nNow, run the built-in generator to setup the basic configuration: `rails generate planetscale:install`\n\nFinally, point your `database.yml` at the proxy the Gem will start, which will listen on `127.0.0.1:3305`. This will look something like:\n\n```yaml\ndevelopment:\n  \u003c\u003c: *default\n  username: root\n  host: 127.0.0.1\n  port: 3305\n  database: \u003cdb_name\u003e\n```\n\nNow, your Rails app will boot the proxy as the app is starting, and connect to the `main` branch on your DB.\n\n### Service Token Authentication\n\nTo use this Gem in 'production', we'll start by creating a PlanetScale Service Token that can connect to your database. To do this, grab the `pscale` CLI and do:\n\n```\n~\u003e pscale org switch \u003corg_name\u003e\n\n~\u003e pscale service-token create\n  NAME           TOKEN\n  -------------- ------------------------------------------\n  0sph6kvz5bxi   \u003credacted\u003e\n\n~\u003e pscale service-token add-access 0sph6kvz5bxi connect_production_branch --database \u003cdb_name\u003e\n  DATABASE   ACCESSES\n ---------- ---------------------------\n  testdb     connect_production_branch\n```\n\nTo configure your application in production, you'll need to feed it all of the right information via environment variables:\n\n```\nPLANETSCALE_ORG=\u003corg_name\u003e\nPLANETSCALE_DB=\u003cdb_name\u003e\nPLANETSCALE_DB_BRANCH=main\nPLANETSCALE_TOKEN_NAME=0sph6kvz5bxi\nPLANETSCALE_TOKEN=\u003credacted\u003e\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome.\n\n## License\n\nThis gem is licensed under the [Apache License Version 2.0](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplanetscale%2Fplanetscale-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplanetscale%2Fplanetscale-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplanetscale%2Fplanetscale-ruby/lists"}