For the impatient:
- Prepare an environment by either:
- Run the application
This repository contains an example online store application written using Reboot.
It was originally forked from GoogleCloudPlatform/microservices-demo, and demonstrates how Reboot makes it simple to write correct microservice applications.
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 web/.
For more information on all of the Reboot examples, please see the docs.
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:
- Right-click to create a Codespace in a new tab or window:
- 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.- You can set your default editor to VSCode for codespaces to avoid this step in the future. See these instructions for more information.
Now you're ready to run the application!
Running directly on a host requires:
- A platform of either:
- Linux:
x86_64orarm64, withglibc>=2.35(Ubuntu Jammy and other equivalent-generation distributions) - Mac:
arm64(Apple M1 and newer) withMacOS>=14.0andXcode>=15.2 - ... or talk to us if your desired platform isn't currently supported!
- Linux:
- Rye - A tool to manage
python,pip, andvenv.- If you are already familiar with Python virtual environments, feel free to use your tool of choice with
pyproject.toml. Python >= 3.10 and < 3.13 is required.
- If you are already familiar with Python virtual environments, feel free to use your tool of choice with
- Node.js
- Including
npm.
- Including
- 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!
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 rye, we can create and activate a virtualenv containing this project's dependencies (as well as fetch an appropriate Python version) using:
rye sync --no-lock
source .venv/bin/activateTo demonstrate sending emails in the boutique you'll need to export your Mailgun API key as an environment variable.
Replace MY_MAILGUN_API_KEY with your own mailgun API key, which you can get
from your Mailgun account:
export RBT_SECRET_MAILGUN_API_KEY="MY_MAILGUN_API_KEY"Then, to run the application, you can use the Reboot CLI rbt (present in the active virtualenv):
rbt dev runRunning 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.
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 web/
npm install
npm startIf using VSCode, the page will load automatically. If not using VSCode, visit http://127.0.0.1:3000.
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 generaterbt 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/This repository contains a Dockerfile that makes it possible to run this application on
the Reboot Cloud! To use the Reboot Cloud you
currently still need an invitation; sign up at https://cloud.reboot.dev/ to be considered.
Once you've received an invitation to use Reboot Cloud, you will also receive an API key. You can then run this application on Reboot Cloud as follows:
rbt cloud up --api-key=YOUR_API_KEYTo make calls to the application that just started, find the application's URL
in the output of rbt cloud up:
'yourapp' is available at: YOUR_URLTell the front end to talk to it by updating the VITE_REBOOT_URL value in
web/.env:
VITE_REBOOT_URL=YOUR_URLThen, in the web/ directory, run npm run build.
Once built, this front end can be deployed to any static hosting provider like S3, Vercel, Cloudflare or Firebase hosting.