{"id":26125989,"url":"https://github.com/powersync-ja/self-host-demo","last_synced_at":"2025-07-15T18:33:20.070Z","repository":{"id":234551857,"uuid":"783809035","full_name":"powersync-ja/self-host-demo","owner":"powersync-ja","description":null,"archived":false,"fork":false,"pushed_at":"2025-05-13T15:12:28.000Z","size":814,"stargazers_count":60,"open_issues_count":3,"forks_count":11,"subscribers_count":13,"default_branch":"main","last_synced_at":"2025-05-13T16:32:49.383Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/powersync-ja.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2024-04-08T16:01:09.000Z","updated_at":"2025-05-13T15:12:33.000Z","dependencies_parsed_at":"2024-04-25T09:28:59.754Z","dependency_job_id":"be264194-4870-4857-adfa-26ce743cfe11","html_url":"https://github.com/powersync-ja/self-host-demo","commit_stats":null,"previous_names":["powersync-ja/self-host-demo"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/powersync-ja/self-host-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/powersync-ja%2Fself-host-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/powersync-ja%2Fself-host-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/powersync-ja%2Fself-host-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/powersync-ja%2Fself-host-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/powersync-ja","download_url":"https://codeload.github.com/powersync-ja/self-host-demo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/powersync-ja%2Fself-host-demo/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265451461,"owners_count":23767769,"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":"2025-03-10T17:27:30.660Z","updated_at":"2025-07-15T18:33:20.033Z","avatar_url":"https://github.com/powersync-ja.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PowerSync Self-Hosted Example\n\nThis is an example self-hosted project using the PowerSync Open Edition version of the [PowerSync Service](https://github.com/powersync-ja/powersync-service), which is published to Docker Hub as `journeyapps/powersync-service`.\n\nThis example uses Docker Compose to define and run the containers.\n\nLearn more about self-hosting PowerSync [here](https://docs.powersync.com/self-hosting/getting-started).\n\n# Run\n\nThis repository contains basic demonstrations in the `demos` folder.\n\n- [Node.js (Postgres)](./demos/nodejs/README.md)\n\n  - This can be started from the repo root with `docker compose -f demos/nodejs/docker-compose.yaml up`\n\n- [Node.js (Postgres + Custom Write Checkpoints)](./demos/nodejs-custom-checkpoints/README.md)\n\n  - This can be started from the repo root with `docker compose -f demos/nodejs-custom-checkpoints/docker-compose.yaml up`\n\n- [Node.js (MongoDB)](./demos/nodejs-mongodb/README.md)\n\n  - This can be started from the repo root with `docker compose -f demos/nodejs-mongodb/docker-compose.yaml up`\n\n- [Node.js (MySQL)](./demos/nodejs-mysql/README.md)\n\n  - This can be started from the repo root with `docker compose -f demos/nodejs-mysql/docker-compose.yaml up`\n\n- [Django](./demos/django/README.md)\n\n  - This can be started from the repo root with `docker compose -f demos/django/docker-compose.yaml up`\n\n- [Supabase](./demos/supabase/README.md)\n\n  - See the README for instructions.\n\n- [Node.js (Postgres + Postgres Sync Bucket Storage)](./demos/nodejs-postgres-bucket-storage/README.md)\n\n  - This can be started from the repo root with `docker compose -f demos/nodejs-postgres-bucket-storage/docker-compose.yaml up`\n\n# Config\n\nThe configuration can be modified to match other project topologies.\n\nEdit the demo `.env` files and config files in the `./config` directory with your specific settings.\n\n### Connections\n\nPopulate the `replication-\u003econnections` entry with your database connection details.\n\n- **Postgres:** A simple Postgres server is provided in the `ps-postgres.yaml` Docker Compose file. Be sure to keep the credentials in `powersync.yaml` in sync with the config in `ps-postgres.yaml` if using this server.\n\n- **MongoDB:** See the [`nodejs-mongodb` demo](./demos/nodejs-mongodb/) for MongoDB connection configuration.\n\n### Storage\n\nThe [PowerSync Service](https://github.com/powersync-ja/powersync-service) uses MongoDB under the hood to store sync bucket state and operation history, regardless of whether you are syncing with a Postgres or MongoDB backend source database.\n\nA basic MongoDB replica-set service is available in `ps-mongo.yaml`. The `powersync.yaml` config is configured to use this service by default. Different MongoDB servers can be configured by removing the `include` statement from `docker-compose.yaml` and updating `powersync.yaml`.\n\n### Authentication\n\nThis example uses JWKS which provides the public key directly to the PowerSync instance in `powersync.yaml`'s `jwks` section.\n\nThe `key-generator` project demonstrates generating RSA key pairs for token signing.\n\n### Sync Rules\n\n[Sync Rules](https://docs.powersync.com/usage/sync-rules) are currently defined by placing them in `./config/sync_rules.yaml`.\n\n### Memory Limits\n\nIt's recommended to set the `NODE_OPTIONS=\"--max-old-space-size=\u003csize\u003e\"` environment variable to increase the default Node.js memory limit.\n\nService memory limits should be adjusted to roughly 80 percent of the system memory capacity.\n\n# Cleanup\n\nIf you want to start from a fresh start:\n\n- Delete the Docker volumes `mongo_storage` and `db_data`\n  Their full names might vary depending on the directory where the `docker-compose` command was executed.\n- Delete the service Docker containers.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpowersync-ja%2Fself-host-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpowersync-ja%2Fself-host-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpowersync-ja%2Fself-host-demo/lists"}