{"id":27915297,"url":"https://github.com/powersync-ja/powersync-dotnet-backend-demo","last_synced_at":"2025-07-07T21:36:52.493Z","repository":{"id":287024105,"uuid":"963331307","full_name":"powersync-ja/powersync-dotnet-backend-demo","owner":"powersync-ja","description":null,"archived":false,"fork":false,"pushed_at":"2025-04-29T16:00:14.000Z","size":24,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-06-14T03:31:06.637Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/powersync-ja.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2025-04-09T14:12:25.000Z","updated_at":"2025-04-29T16:00:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"263cb771-af96-4279-aeee-63c194111962","html_url":"https://github.com/powersync-ja/powersync-dotnet-backend-demo","commit_stats":null,"previous_names":["powersync-ja/powersync-dotnet-backend-demo"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/powersync-ja/powersync-dotnet-backend-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/powersync-ja%2Fpowersync-dotnet-backend-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/powersync-ja%2Fpowersync-dotnet-backend-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/powersync-ja%2Fpowersync-dotnet-backend-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/powersync-ja%2Fpowersync-dotnet-backend-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/powersync-ja","download_url":"https://codeload.github.com/powersync-ja/powersync-dotnet-backend-demo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/powersync-ja%2Fpowersync-dotnet-backend-demo/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260268608,"owners_count":22983601,"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-05-06T15:52:28.621Z","updated_at":"2025-06-17T00:34:12.507Z","avatar_url":"https://github.com/powersync-ja.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PowerSync .NET Backend\n\n## Overview\n\nThis repository contains a demo .NET 9 backend API that provides authentication and data synchronization endpoints for a [PowerSync](https://www.powersync.com/) enabled application. It allows client devices to sync data with a PostgreSQL database.\n\n### Endpoints\n\n1. **GET `/api/auth/token`**\n   - PowerSync uses this endpoint to retrieve a JWT access token for authentication.\n\n2. **GET `/api/auth/keys`**\n   - PowerSync uses this endpoint to validate the JWT returned from the authentication endpoint.\n\n3. **PUT `/api/data`**\n   - PowerSync uses this endpoint to sync upsert events from the client application.\n\n4. **PATCH `/api/data`**\n   - PowerSync uses this endpoint to sync update events from the client application.\n\n5. **DELETE `/api/data`**\n   - PowerSync uses this endpoint to sync delete events from the client application.\n\n6. **POST `/api/data`**\n- PowerSync uses this endpoint to sync upsert batched events from the client application.\n\n## Requirements\n\n- [.NET 9 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/9.0)\n- PostgreSQL, MongoDB, or MySQL database\n- PowerSync credentials\n\n## Environment Variables\n\nThe application requires the following environment variables:\n\n```\nDATABASE_URI=\u003cyour_database_connection_string\u003e\nDATABASE_TYPE=\u003cpostgresql|mongodb|mysql\u003e\nPOWERSYNC_PRIVATE_KEY=\u003cyour_private_key\u003e\nPOWERSYNC_PUBLIC_KEY=\u003cyour_public_key\u003e\nPOWERSYNC_URL=\u003cyour_powersync_url\u003e\nPORT=5000\nJWT_ISSUER=\u003cyour_jwt_issuer\u003e\n```\n\n## Running the Application\n\n### 1. Clone the repository\n```sh\ngit clone https://github.com/dean-journeyapps/powersync-dotnet-api-demo.git\ncd powersync-dotnet-api-demo\n```\n\n### 2. Build and Run with Docker\n\n1. **Create a new `.env` file in the root project directory and add the variables as defined in the `.env` file**\n    ```sh\n    cp .env.template .env\n    ```\n\n1. **Build the Docker image:**\n   ```sh\n   docker build -t powersync-dotnet .\n   ```\n\n2. **Run the container:**\n   ```sh\n   docker run -p 5000:5000 --env-file .env powersync-dotnet\n   ```\n\nThis will start the app on `http://127.0.0.1:5000`.\n\n### 3. Running Locally with .NET CLI\n\n1. Restore dependencies:\n   ```sh\n   dotnet restore\n   ```\n2. Build the application:\n   ```sh\n   dotnet build\n   ```\n3. Run the application:\n   ```sh\n   dotnet run --project PowerSync.Api\n   ```\n\n## Testing the API\n\nYou can test if the API is running by opening:\n```\nhttp://127.0.0.1:5000/api/auth/token\n```\nYou should receive a JSON response with an access token.\n\n## Contributing\n\nIf you wish to contribute, please fork the repository and submit a pull request.\n\n## License\n\nThis project is licensed under the MIT License.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpowersync-ja%2Fpowersync-dotnet-backend-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpowersync-ja%2Fpowersync-dotnet-backend-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpowersync-ja%2Fpowersync-dotnet-backend-demo/lists"}