When building the backend engine for GoPanda—a digital marketplace connecting travelers with local vehicle rental shops—we needed a stack that was fast to develop with, highly performant, and type-safe.
While the React frontend gets the visual praise, the real heavy lifting happens in our Python API layer. Here’s a breakdown of the stack we chose, and how it helps us handle the complexities of a rental marketplace.
The Core Stack: FastAPI & PostgreSQL
We decided to build the API using FastAPI paired with PostgreSQL (via SQLAlchemy and Alembic for migrations).
FastAPI is arguably the best Python web framework right now for building REST APIs. The automatic Swagger UI generation and deep integration with Pydantic for validation saved us countless hours of writing boilerplate serialization code.
Here are a few specific ways this stack helped us solve marketplace challenges:
1. Complex Validation with Pydantic
A vehicle marketplace is tricky because the data structures are so diverse. The payload required to book a scooty rental in Guwahati is different from the payload required to list a premium self-drive car.
Pydantic shines here. By defining strict Pydantic models for our different vehicle types and booking requests, we ensure that bad data never even reaches our route handlers. If a shop owner tries to submit a vehicle listing without a valid price or description, FastAPI automatically returns a clean, detailed 422 Unprocessable Entity response.
2. Preventing Abuse with Slowapi
Because we act as an aggregator for local shops (like bike rentals), our search and inventory endpoints are prime targets for scraping by competitors. Additionally, we need to protect our booking endpoints from spam.
Instead of writing custom rate-limiting middleware, we integrated Slowapi. It seamlessly wraps our FastAPI routes, allowing us to define granular rate limits (e.g., 5/minute for booking attempts, 60/minute for search queries) using Redis or memory as the backing store.
3. Offloading Assets to Cloudinary
Images make or break a rental marketplace. Shop owners upload multiple high-resolution photos of their vehicles, but serving those directly from our backend server or database would destroy performance.
We integrated Cloudinary directly into our asset upload flow. When a shop owner adds a new vehicle, our FastAPI backend acts as a secure proxy—it validates the image file, generates a secure signature, and uploads it to Cloudinary. The database simply stores the optimized Cloudinary URLs. This keeps our PostgreSQL database lean and ensures images are served via a fast global CDN.
The Takeaway
Building GoPanda reinforced my love for the modern Python web ecosystem. The combination of FastAPI for speed, SQLAlchemy for robust data modeling, and Pydantic for bulletproof validation provides an incredible developer experience.
If you've got any questions, drop them below. Thank you all.
Top comments (1)
What stood out to me is that you weren't just choosing technologies, you were deciding where responsibilities belong.
Validation, abuse prevention and asset delivery each have their own place in the system.
That's often what separates a maintainable backend from one that becomes difficult to evolve later.
Nice work. 🤝