{"id":15688008,"url":"https://github.com/ultirequiem/planetscale","last_synced_at":"2025-05-07T20:11:40.196Z","repository":{"id":57325544,"uuid":"454590197","full_name":"UltiRequiem/planetscale","owner":"UltiRequiem","description":"🪐 A simple client for connecting to PlanetScale","archived":false,"fork":false,"pushed_at":"2023-07-19T08:59:37.000Z","size":119,"stargazers_count":8,"open_issues_count":2,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-07T20:11:17.378Z","etag":null,"topics":["database","db-driver","javascript","mysql","node","nodejs","planetscale","typescript"],"latest_commit_sha":null,"homepage":"https://ulti.js.org/planetscale","language":"TypeScript","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/UltiRequiem.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":"2022-02-01T23:53:37.000Z","updated_at":"2023-03-10T20:56:51.000Z","dependencies_parsed_at":"2024-06-21T17:41:04.759Z","dependency_job_id":"d130cfaa-3e86-4364-896d-47ab029e21e1","html_url":"https://github.com/UltiRequiem/planetscale","commit_stats":{"total_commits":16,"total_committers":2,"mean_commits":8.0,"dds":0.0625,"last_synced_commit":"35cc6de55aafefb917be681711c35dea6daddf05"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UltiRequiem%2Fplanetscale","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UltiRequiem%2Fplanetscale/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UltiRequiem%2Fplanetscale/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UltiRequiem%2Fplanetscale/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/UltiRequiem","download_url":"https://codeload.github.com/UltiRequiem/planetscale/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252949285,"owners_count":21830153,"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":["database","db-driver","javascript","mysql","node","nodejs","planetscale","typescript"],"created_at":"2024-10-03T17:53:12.498Z","updated_at":"2025-05-07T20:11:40.136Z","avatar_url":"https://github.com/UltiRequiem.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PlanetScale\n\nA simple client for connecting to [PlanetScale](https://planetscale.com).\n\n## Setup\n\nYou need to have installed [pscale](https://github.com/planetscale/cli).\n\n```sh\n$ pscale service-token create\n  NAME           TOKEN\n -------------- ------------------------------------------\n  tokenName     token\n\n$ pscale service-token add-access tokenName connect_production_branch --database test\n  DATABASE   ACCESSES\n ---------- ---------------------------\n  test       connect_production_branch\n```\n\nIf you plan to use [dotenv](https://github.com/motdotla/dotenv), you could write\na `.env` file like:\n\n```sh\ndb=\ntokenName=\norg=\ntoken=\n```\n\n## Install\n\n```sh\nnpm install planetscale # yarn add planetscale\n```\n\n## Usage\n\n```js\nimport connect from \"planetscale\";\nimport { env } from \"node:process\";\nimport \"dotenv/config\";\n\nconst { db, tokenName, org, token } = env;\n\nconst connection = await connect({ db, tokenName, org, token });\n\nconst [rows] = await connection.promise().query(\"SELECT * FROM Persons\");\n\nconsole.log(rows);\n\nconnection.end();\n```\n\nThe default export, `connect`, returns a `Connection`, it is basically a wrapper\naround `mysql2.createConnection`.\n\nCheck the [docs](https://github.com/mysqljs/mysql) to know all the API.\n\nCheck [examples/](./examples) for more.\n\n## Licence\n\nReleased under the MIT Licence.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fultirequiem%2Fplanetscale","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fultirequiem%2Fplanetscale","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fultirequiem%2Fplanetscale/lists"}