Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Reboot Bank (Pydantic)

For the impatient:

  1. Prepare an environment by either:
  2. Run the application

Overview

This repository contains an example bank ("Rebank") written using Reboot, with its API defined using Pydantic models.

The Reboot '.proto' definitions can be found in the api/ directory, grouped into subdirectories by proto package, while backend specific code can be found in backend/ and front end specific code in frontend/web/ and MCP Apps in frontend/mcp/ and a React Native (Expo) mobile front end in frontend/mobile/.

For more information on all of the Reboot examples, please see the docs.

Prepare an environment by...

Using VSCode connected to a GitHub Codespace

This method requires running VSCode on your machine: if that isn't your bag, see the other environment option below.

This repository includes a Dev Container config (more about Dev Containers) that declares all of the dependencies that you need to build and run the example. Dev Containers can be started locally with VSCode, but we recommend using GitHub's Codespaces to quickly launch the Dev Container:

  1. Right-click to create a Codespace in a new tab or window:
    • Open in GitHub Codespaces
    • Important: In order to view the example's front end, you must connect your local VSCode to the codespace: you cannot use VSCode in a browser window.
  2. Go to https://github.com/codespaces and click the three dots next to the codespace you just created and then click Open in Visual Studio Code.

Now you're ready to run the application!

Installing prerequisites directly

Running directly on a host requires:

  • A platform of either:
    • Linux: x86_64 or arm64, with glibc>=2.35 (Ubuntu Jammy and other equivalent-generation distributions)
    • Mac: arm64 (Apple M1 and newer) with MacOS>=14.0 and Xcode>=15.2
    • ... or talk to us if your desired platform isn't currently supported!
  • uv - A tool to manage python, pip, and venv.
  • Node.js
    • Including npm.
  • Docker
    • Note: the example does not run "inside of" Docker, but Docker is used to host a native support service for local development.

If you are unable to meet any of these requirements, we suggest using the VSCode and Dev Container environment discussed above.

Now you're ready to run the application!

Run the application

Backend

Our backend is implemented in Python and we must install its dependencies before running it. The most notable of those dependencies is the reboot PyPI distribution, which contains both the Reboot CLI (rbt) and the reboot Python package.

Using uv, we can create and activate a virtualenv containing this project's dependencies (as well as fetch an appropriate Python version) using:

uv sync
source .venv/bin/activate

Run the backend

Then, to run the application, you can use the Reboot CLI rbt (present in the active virtualenv):

rbt dev run

Running rbt dev run will watch for file modifications and restart the application if necessary. See the .rbtrc file for flags and arguments that get expanded when running rbt dev run. By default it serves the app under a name, https://bank.localhost, through portless: install it once with npm install -g portless and start its proxy with portless proxy start. To use plain ports instead, run rbt dev run --config=ports.

Front end

Similar to the backend, the front end has dependencies that need to be installed before running it. Open a separate terminal/shell and do:

cd frontend/
npm install
npm run dev

That starts a single Vite dev server that serves both the web app and the MCP Apps, as https://frontend-bank.localhost, which the backend serves them from (the name matches the backend's bank.localhost, which is how the two trust each other): npm run dev is portless frontend-bank vite, portless being a dev dependency, mirroring the .rbtrc. Visit https://bank.localhost for the web app. Without portless (rbt dev run --config=ports), run npm run dev:ports instead and visit http://localhost:9991.

The web app requires signing in. In development, click "Sign in" and pick (or make up) a Development identity. Signing in auto-constructs your User, which signs you up as a customer of the bank (see backend/src/user_servicer.py), so the web app shows only your own accounts. The web app and the MCP frontend share sign-on: signing in on one signs you in on the other.

The mobile app signs in too, against the same OAuth server, and with the same useSignIn() / useSignOut() / useUser() hooks. It cannot use the browser-redirect flow the web app uses — React Native has no page to redirect and no cookie jar to hold the session — so it builds an auth object with expoAuth({...}) from @reboot-dev/reboot-react/native and passes it to its RebootClientProvider as nativeAuth, and Reboot runs the standard authorization-code flow with PKCE that native apps use instead, keeping the resulting tokens in the device keychain. Because backend/src/main.py lists the app's redirect URI in OAuth(skip_consent_for_redirect_uris=...), Reboot signs the user straight in, with no consent screen — the same treatment the web app gets. A client that registers some other redirect URI still gets one.

MCP

The application is also an MCP server: an MCP client can call its tools and render its UIs (the frontend/mcp/ directories) right in the chat. The easiest way to get connected is the setup wizard that the backend serves at https://bank.localhost (or http://localhost:9991 without portless): it walks you through connecting the chat client of your choice (Claude, ChatGPT, ...) — including the public tunnel those clients need to reach your machine — and suggests example prompts to try. The MCP endpoint itself is https://bank.localhost/mcp.

Tests

The application comes with backend tests.

Before you run the tests, you'll need to ensure you've run rbt generate. If you've already run rbt dev run without modifying .rbtrc, rbt generate will have been run for you as part of that command. Otherwise, you can do it manually.

rbt generate

rbt generate will automatically make required Reboot '.proto' dependencies like rbt/v1alpha1/options.proto available on the import path without you having to check them into your own repository.

Now you can run the tests using pytest:

pytest backend/

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages