ALL TOOLKITS/fastapi-rust-template
STARTER TEMPLATE⭐ 88 ON GITHUBVERIFIED ASSET

FastAPI + Rust PyO3 Native Extension Boilerplate

Combine Python's developer speed with Rust's raw CPU performance for high-compute vector math.

$npx degit devlinkhub/fastapi-rust-pyo3 my-service

Architecture & Overview

Write your web endpoints in FastAPI while compiling heavy CPU calculations (tokenization, vector math, audio processing) into zero-overhead native Rust extensions via PyO3 and Maturin.

FOLDER & REPO STRUCTURE
fastapi-rust-pyo3/
  rust_core/
    Cargo.toml
    src/lib.rs
  api/
    main.py
    routes/
  Dockerfile
  pyproject.toml

What's Included

  • Maturin-based native Rust crate compilation for Python 3.12
  • FastAPI async endpoint routing with Pydantic v2 schemas
  • Multi-stage Dockerfile compiling Rust binaries down to minimal image sizes
  • Benchmark test suite comparing pure Python vs Rust native execution
TECH STACK
FastAPIRustPyO3Python 3.12Docker
EXPLORE ON GITHUB