https://github.com/trflorian/realtimedb-local-server
A tiny web server using Python and FastAPI to wrap part of the REST API of Firebase Realtime DB.
https://github.com/trflorian/realtimedb-local-server
fastapi firebase python realtime-database
Last synced: 4 months ago
JSON representation
A tiny web server using Python and FastAPI to wrap part of the REST API of Firebase Realtime DB.
- Host: GitHub
- URL: https://github.com/trflorian/realtimedb-local-server
- Owner: trflorian
- License: mit
- Created: 2024-09-05T22:05:19.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-04-20T11:48:25.000Z (about 1 year ago)
- Last Synced: 2025-04-20T12:10:52.306Z (about 1 year ago)
- Topics: fastapi, firebase, python, realtime-database
- Language: Python
- Homepage:
- Size: 33.2 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Realtime DB Local Server


A tiny web server to manage player data and transmit real-time updates via Server-Sent Events (SSE).
All endpoints operate under the `/players` path.
This project is part of the multiplayer firebase project:
https://github.com/trflorian/multiplayer-firebase
## API Overview
**Endpoints:**
* **`GET /players.json`**
* **Purpose:** Stream real-time updates of the *entire* player list via Server-Sent Events (SSE).
* **Behavior:** Periodically pushes the full player dataset to connected clients.
* **`PUT /players/{player_id}.json`**
* **Purpose:** Create a new player or update an existing player's data.
* **Identifies Player By:** `player_id` in the URL path.
* **Requires:** Player data matching the `Player` model in the request body.
* **`DELETE /players/{player_id}.json`**
* **Purpose:** Delete a specific player.
* **Identifies Player By:** `player_id` in the URL path.
## Quickstart
Run the project locally in develop mode using uv. This will automatically create a virtual environment for you and install the required packages.
```bash
uv run fastapi dev
```
For detailed specifications, schemas, and interactive testing, you can refer to the auto-generated documentation at the `/docs` path when you run the server locally.
## Testing
The project contains some basic unit tests and a simple test for some API endpoints.
To run the test suite, use the following command:
```bash
uv run pytest
```