https://github.com/bcdev/remotestate
Python state, React UI. One runtime for notebook apps and addon backends.
https://github.com/bcdev/remotestate
Last synced: 1 day ago
JSON representation
Python state, React UI. One runtime for notebook apps and addon backends.
- Host: GitHub
- URL: https://github.com/bcdev/remotestate
- Owner: bcdev
- License: mit
- Created: 2026-04-27T11:15:30.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2026-06-16T08:11:45.000Z (10 days ago)
- Last Synced: 2026-06-16T10:12:56.993Z (10 days ago)
- Language: TypeScript
- Homepage:
- Size: 364 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# RemoteState
[](https://github.com/bcdev/remotestate/actions/workflows/ci.yml)
[](https://opensource.org/licenses/MIT)
[](https://pypi.org/project/remotestate/)
[](https://www.npmjs.com/package/remotestate)
> Python state, React UI.
RemoteState is a Python-first framework for building stateful React frontends. Python owns the state and behavior, while React owns the presentation. Use it when you want a single source of truth in Python and a typed TypeScript bridge in the browser.
It fits especially well for:
- notebook apps where Python drives the workflow
- frontend addons or plugins that need an optional Python backend
- teams that want one runtime for state, actions, queries, and progress updates
If you want a pure client-side React state library with no Python backend, RemoteState is probably not the right fit.
## What You Get
- Python-owned `Store` state with path-based reads and writes
- `@action` and `@query` methods for mutating and read-only calls
- WebSocket synchronization between Python and React
- typed TypeScript client, provider, and hooks
- task and progress updates from long-running work
- notebook and browser serving from the Python runtime
- optional local fallback clients for addon-style apps
## How It Works
- Python is the source of truth for business state and behavior
- TypeScript/React renders the UI and calls into Python when needed
- the WebSocket bridge carries reads, writes, queries, actions, and task updates
## Simple Example
```python
import remotestate as rs
class Counter(rs.Service):
def __init__(self) -> None:
super().__init__(rs.Store({"count": 0}))
@rs.action
async def increment(self) -> None:
self.store.set("count", self.store.get("count") + 1)
service = Counter()
rs.serve(service, ui_dist="ui/dist")
```
```tsx
import {
RemoteStateProvider,
useRemoteState,
useRemoteStateClient,
} from "remotestate";
type CounterService = {
increment(): Promise;
};
function Counter() {
const client = useRemoteStateClient();
const [count, setCount] = useRemoteState("count", 0);
return (
Count: {count}
void setCount((n) => (n ?? 0) + 1)}>
Local +1
void client.action("increment")}>
Backend +1
);
}
export default function App() {
return (
);
}
```
## Package Docs
- [Python package README](./remotestate-py/README.md)
- [TypeScript package README](./remotestate-ts/README.md)
## License
MIT © [@forman](https://github.com/forman)