Skip to content

fastgrpc run

Start the production server. No watcher, no reflection.

fastgrpc run <file> [--host HOST] [--port PORT]

Arguments

Argument Default Description
<file> required Path to the Python file containing your @service classes
--host 0.0.0.0 Host to bind (defaults to all interfaces, unlike dev)
--port 50051 Port to bind

How it differs from dev

Feature dev run
File watching yes no
Hot reload yes no
gRPC reflection yes no
Default host 127.0.0.1 0.0.0.0

The codegen pipeline runs once at startup, the server is started, and the process blocks on wait_for_termination() (or the equivalent for async). On SIGINT it stops gracefully with a 5-second grace period.

Example

fastgrpc run main.py
fastgrpc run main.py --port 50051
fastgrpc run main.py --host 0.0.0.0 --port 8080

Run behind a reverse proxy or load balancer. fastgrpc does not currently terminate TLS or handle HTTP/JSON transcoding — those belong upstream.

A typical deployment uses one process per CPU core. Python's GIL means a single async server is single-threaded for compute; horizontal scale across processes is the right answer.

Containerized example:

FROM python:3.12-slim
WORKDIR /app
COPY pyproject.toml .
RUN pip install -e .
COPY . .
EXPOSE 50051
CMD ["fastgrpc", "run", "main.py"]

Inspecting a running server without reflection

Since reflection is off, clients need the .proto schema to call your service. Generate it once:

fastgrpc compile main.py --out ./contract/

Distribute contract/fastgrpc.proto to clients, or commit it to a shared schema repo.