fastgrpc dev
Start the development server with hot reload and gRPC server reflection.
Arguments
| Argument | Default | Description |
|---|---|---|
<file> |
required | Path to the Python file containing your @service classes |
--host |
127.0.0.1 |
Host to bind |
--port |
50051 |
Port to bind |
What it does
- Imports the entry-point file, executing your
@serviceand@rpcdecorators. - Detects whether all handlers are sync or async (raises if mixed) and picks the matching gRPC stack.
- Runs the codegen pipeline: inspector → lock → validator → proto writer →
protoccompiler. - Synthesizes
*Servicersubclasses with proto↔dataclass conversion wrappers. - Starts the server with reflection enabled.
- Starts the Rust file watcher and rebuilds on every
.pychange.
Examples
fastgrpc dev main.py
fastgrpc dev main.py --port 50061
fastgrpc dev examples/complex/main.py --host 0.0.0.0 --port 50051
Reflection
Dev mode enables gRPC server reflection. This means clients like grpcurl and Postman can discover the schema at runtime without needing a .proto file:
grpcurl -plaintext localhost:50051 list
# → fastgrpc.UserService
# → grpc.reflection.v1alpha.ServerReflection
grpcurl -plaintext localhost:50051 describe fastgrpc.UserService
grpcurl -plaintext -d '{"user_id": 1}' \
localhost:50051 fastgrpc.UserService/GetUser
Output
✓ Serving on grpc://127.0.0.1:50051 (async)
Watching . for changes...
↻ reloading (1 file(s) changed)
✓ reloaded on grpc://127.0.0.1:50051
The (async) or (sync) tag tells you which gRPC stack was selected.
Generated artifacts
Everything goes inside .fastgrpc/ (gitignored):
.fastgrpc/
├── fastgrpc.proto # generated schema
├── fastgrpc_pb2.py # compiled message classes
└── fastgrpc_pb2_grpc.py # compiled servicer base
Plus .fastgrpc.lock at the project root (committed; see Lock file).
To get a visible .proto for client teams, use fastgrpc proto or fastgrpc compile.