The SnapTop application has been converted from gRPC + Protobuf to FastAPI + Pydantic + JSON. This simplifies the architecture by removing the need for:
- Protocol Buffer definitions and code generation
- Envoy proxy for gRPC-Web translation
- Complex build processes for proto files
- Server: Replaced
grpc_server.pywithfastapi_server.py - Models: Created Pydantic models in
backend/src/models/to replace proto definitions - Port: Changed from
50051to8000 - Protocol: REST API with JSON instead of gRPC
- Client: Updated
grpcClient.tsto use fetch API against REST endpoints - Endpoint: Changed from
http://localhost:8080(Envoy) tohttp://localhost:8000(FastAPI) - Protocol: Simple HTTP/JSON instead of gRPC-Web
/protodirectory - Proto definitions/backend/generated- Generated protobuf Python code/frontend/generated- Generated protobuf JavaScript code/frontend/envoy.yaml- Envoy proxy configuration/frontend/Dockerfile.envoy- Envoy container- Envoy service from
docker-compose.yml
pyproject.toml- Removed gRPC dependencies, added FastAPI and Uvicornpackage.json- Removed grpc-web and google-protobufMakefile- Removed proto generation targetsdocker-compose.yml- Removed envoy service, updated backend port
Generate Recipe
POST /api/recipes/generate- Request:
GenerateRecipeRequest - Response:
Recipe - Status: ✅ Fully implemented
Generate Weekly Meals (TODO)
POST /api/meals/generate-weekly- Request:
GenerateWeeklyMealsRequest - Response:
MealPlan - Status:
⚠️ Stub only
Regenerate Recipe (TODO)
POST /api/recipes/regenerate- Request:
RegenerateRecipeRequest - Response:
Recipe - Status:
⚠️ Not implemented
Modify Recipe (TODO)
POST /api/recipes/modify- Request:
ModifyRecipeRequest - Response:
Recipe - Status:
⚠️ Not implemented
Get Shopping List (TODO)
POST /api/shopping-list/generate- Request:
GetShoppingListRequest - Response:
ShoppingList - Status:
⚠️ Not implemented
# Start all services (backend + frontend)
docker-compose up --build
# Or use the Makefile
make devThe services will be available at:
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- API Docs: http://localhost:8000/docs (FastAPI auto-generated Swagger UI)
Backend:
# Install dependencies
uv sync
# Run the server
uv run python -m backend.src.server.fastapi_serverFrontend:
cd frontend
npm install
npm run dev- Simpler Architecture: No need for Envoy proxy or proto compilation
- Better Developer Experience: Auto-generated API docs at
/docs - Easier Debugging: JSON is human-readable, standard HTTP tools work
- Faster Iteration: No proto generation step in build process
- Type Safety: Pydantic provides runtime validation + Python type hints
- Modern Stack: FastAPI is the current Python API framework standard
This is a breaking change. The old gRPC endpoints are no longer available. If you need the old gRPC server, it's still available at backend/src/server/grpc_server.py but is no longer maintained.