{"id":22485053,"url":"https://github.com/planetary-social/planetary-graphql","last_synced_at":"2025-08-02T18:31:21.608Z","repository":{"id":60340697,"uuid":"538801254","full_name":"planetary-social/planetary-graphql","owner":"planetary-social","description":"graphql endpoint to ssb-db2 secure scuttlebutt server","archived":false,"fork":false,"pushed_at":"2023-04-03T06:52:02.000Z","size":379,"stargazers_count":4,"open_issues_count":6,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-04-14T07:11:41.874Z","etag":null,"topics":["secure-scuttlebutt","securescuttlebutt","ssb"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/planetary-social.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}},"created_at":"2022-09-20T03:57:38.000Z","updated_at":"2024-01-13T16:40:46.000Z","dependencies_parsed_at":"2023-01-30T06:46:36.530Z","dependency_job_id":null,"html_url":"https://github.com/planetary-social/planetary-graphql","commit_stats":{"total_commits":88,"total_committers":4,"mean_commits":22.0,"dds":0.5113636363636364,"last_synced_commit":"4217ac260c5366493a9931df7fa93f02f75b8782"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/planetary-social%2Fplanetary-graphql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/planetary-social%2Fplanetary-graphql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/planetary-social%2Fplanetary-graphql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/planetary-social%2Fplanetary-graphql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/planetary-social","download_url":"https://codeload.github.com/planetary-social/planetary-graphql/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227719157,"owners_count":17809338,"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":["secure-scuttlebutt","securescuttlebutt","ssb"],"created_at":"2024-12-06T17:11:57.693Z","updated_at":"2024-12-06T17:13:39.960Z","avatar_url":"https://github.com/planetary-social.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# planetary-graphql\n\nThis is a graphql server that is designed to complement a room-server.\nWhen properly configured it will provide a GraphQL API allowing you to query:\n- details about the room (name, notices)\n- membership of the room\n- posts made by room members\n\nThe data provided by this API conforms to the [ssb-public-web-hosting-spec]\n\n## Run locally (Development)\n\n```bash\nnpm install\nnpm run dev\n```\n\n## Deploy\n\n### Digitial Ocean setup\n\n1. spin up a droplet, adding SSH keys\n2. assign a \"reserved IP address\" (static address)\n3. ssh into the droplet, e.g.\n    ```bash\n    ssh root@157.230.72.191\n    ```\n4. install node\n    - install [nvm](https://github.com/nvm-sh/nvm)\n    - `nvm install 16`\n        - (you may need to log out and in for nvm to be registered)\n5. install `planetary-graphql`\n    ```bash\n    git clone https://github.com/planetary-social/planetary-graphql.git\n    cd planetary-graphql\n    npm i\n    ```\n6. set up environment variables\n    ```bash\n    cp .env.template .env\n    ```\n    - you will need to edit this file to make sure the details are correct`\n        - these environment variables are required for room related API:\n            - `ROOM_KEY` - ssb id of the room\n            - `ROOM_HOST` - the hostname of the room\n            - `ROOM_URL` - the URL the room is being served at. This should be an absolute URL. E.g. `https://localhost:3000` or `https://civic.love`\n            - `MAGIC_TOKEN` - the token used to bypass invites for the `go-ssb-room` server\n7. install [pm2](https://www.npmjs.com/package/pm2) (process manager)\n   ```bash\n   npm install pm2 -g\n   pm2 startup\n   ```\n8. start the process!\n   ```bash\n   npm start\n   ```\n9. check the server is live using your browser\n   - visit e.g. `http://157.230.72.191:4000/graphql` (assume default PORT)\n\n\nOther useful commands:\n\n```bash\nnpm run stop          // close the pm2 process does\npm2 restart graphql   // restart the graphql process\npm2 monit             // detailed monitoring for pm2 processes\n```\n\n#### Pair with a Room Server\n\nYou will need to add this peer as a member of the room (so that it can poll the room for updates).\n\n1. open the `secret` file at `DB_PATH/secret` (default: `./db/secret`)\n2. copy the `id` from this file\n3. in the room-server, add this `id` as a member\n\n### Health checks\n\nIf using `pm2`, you can run `pm2 list` to see the cpu/mem/uptime of your server.\n\nChecking disk usage in the `planetary-graphql` folder:\n    ```bash\n    du -h db/db2\n    ls -lh db/db2/log.bipf\n    ```\n\n### Update\n\n```\ncd planetary-graph\ngit pull origin master\nnpm install\npm2 restart all\n```\n\n\u003c!-- References --\u003e\n\nssb-public-web-hosting-spec: https://github.com/ssbc/ssb-public-web-hosting-spec\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplanetary-social%2Fplanetary-graphql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplanetary-social%2Fplanetary-graphql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplanetary-social%2Fplanetary-graphql/lists"}