🚀 PoC: Simple Rate Limiting with FastAPI Rate limiting is essential to keep APIs fast and stable by controlling request frequency. In this PoC, we demonstrate a simple fixed window rate limiting approach. This protects your API from overload by limiting each client to 10 requests per minute. 🔹 Endpoints: - GET /api/gis/vehicles - GET /api/gis/features 🔹 Rate Limiting: - Fixed window (60 seconds) - 10 requests/minute per client (by header or IP) - Returns HTTP 429 with a clear message if exceeded 🔹 Architecture: - In-memory store - Simple, clean code - Easy to test with curl Check out the full PoC, code, and blog post for details and a Mermaid diagram! 👇 https://lnkd.in/dyQcBwmT #Python #FastAPI #GIS #RateLimiting #API #PoC #Backend #SoftwareEngineering #OpenSource
Simple Rate Limiting with FastAPI: Protecting APIs from Overload
More Relevant Posts
-
What is Dependency Injection? DI is a design pattern where an object receives what it needs (DB session, client, cache, config) instead of creating those dependencies itself. That small shift pays off: - looser coupling (swappable implementations) - easier testing (fake/stub dependencies) - cleaner architecture (objects do one job) In Python, DI often turns into either manual wiring everywhere or heavy frameworks. That's why we built #diwire: An extremely fast type-driven DI container for Python that builds your object graph from type hints with dependencies, scopes + deterministic cleanup, async support, and integrations with the most popular libraries (FastAPI, Pydantic, and more). If you want a concrete "this is how it looks in a real app" example, start here: GitHub: https://lnkd.in/gshHbkWP Integrations docs: https://lnkd.in/gDz_Phya
To view or add a comment, sign in
-
-
🚀 Boost your FastAPI JSON performance by 2x+ FastAPI 0.131.0 introduces a major performance upgrade for JSON responses — and many developers will get it for free. If you declare a response_model, FastAPI now leverages Pydantic v2’s Rust-powered core for validation and serialization. ⚡ What changed? Previously, JSON encoding relied heavily on Python’s json.dumps() — flexible but CPU-bound. Now, serialization flows through Pydantic Core (Rust): 👉 Faster response generation 👉 Lower latency 👉 Higher throughput 👉 Reduced CPU usage 📊 This is especially impactful for: • High-traffic microservices • LLM / RAG backends • Real-time APIs • Data-heavy endpoints 💡 In short: same code, significantly better performance. ✅ How to benefit 1. Upgrade to FastAPI ≥ 0.131.0 2. Use Pydantic v2 3. Declare response_model on your endpoints That’s it — no complex refactoring required. For production systems handling thousands of requests per second, this is a meaningful performance win. Upgrade. Declare response models. Ship faster APIs. #FastAPI #Python #Backend #Performance #Microservices #APIDesign #Pydantic #LLM #RAG
To view or add a comment, sign in
-
-
🚀 𝟲𝟬 𝗗𝗮𝘆𝘀 𝗼𝗳 𝗖𝗼𝗱𝗶𝗻𝗴 | 𝗗𝗦𝗔 𝘅 𝗥𝗲𝗮𝗹 𝗪𝗼𝗿𝗹𝗱 𝗣𝗿𝗼𝗷𝗲𝗰𝘁𝘀 #Day60 | 𝗟𝗥𝗨 𝗖𝗮𝗰𝗵𝗲 & 𝗦𝗲𝘀𝘀𝗶𝗼𝗻 𝗠𝗮𝗻𝗮𝗴𝗲𝗺𝗲𝗻𝘁 Built an optimized LRU (Least Recently Used) Cache using a combination of HashMap and Doubly Linked List to achieve O(1) time complexity for both get and put operations. Focused on: • Constant-time system design • Cache replacement policies • Pointer manipulation clarity • Data structure integration • Backend optimization thinking 📌 Code and documentation: https://lnkd.in/gxzGJ4nB 60 days. 60 applied implementations. From basic arrays to system-level design thinking. Feedback welcome. #DSA #LRUCache #SystemDesign #BackendDevelopment #DataStructures #Python #60DaysOfCoding #LearningInPublic #SoftwareEngineering
To view or add a comment, sign in
-
Day 52/106: Kinetic Energy. Phase 2: The API Layer. Yesterday, we defined the database schema (Potential Energy). Today, we started writing the API resolvers (Kinetic Energy). A database is just a static warehouse. The API is the logistics network that makes it useful. We spent the day deep in the backend logic—ensuring that when a request hits the server, the response is calculated, formatted, and returned in milliseconds. ▪️ defining the endpoints. ▪️ securing the routes. ▪️ optimizing the query logic. It is not enough to just store data. You have to move it efficiently. The engine is starting to hum. #PixelNode #BuildInPublic #BackendDev #API #Python #Nodejs #SystemDesign
To view or add a comment, sign in
-
Built a Research Assistant Agent that can fetch and summarize information from Wikipedia — all powered by LangGraph's graph-based architecture. What it does: → Takes a user query → Decides whether to use a tool → Fetches relevant results from Wikipedia → Returns a well-structured answer. Tech Stack: • LangGraph (for agent orchestration) • Python • Groq (LLM provider) • Wikipedia API The ReAct pattern (Reason → Act → Observe) is a game changer!
To view or add a comment, sign in
-
-
FastAPI Dependency Injection: Power Tool or Footgun? FastAPI’s dependency injection is incredibly powerful — and often misused. Used well: • Clean separation of concerns • Testable business logic • Infrastructure easily mocked or swapped Used poorly: • Hidden execution paths • Hard-to-debug request flows • Accidental global state Rule of thumb: • Inject behavior, not logic • Keep dependencies shallow • Avoid side effects during injection Modern frameworks don’t remove design principles. They demand them more. #FastAPI #Python #CleanCode #BackendEngineering #APIDesign #SoftwareArchitecture
To view or add a comment, sign in
-
Today I built and deployed a basic ML API using Python and FastAPI. The focus was not just training a model, but understanding how ML works inside real backend systems. I implemented: - Request–response flow - Input validation - Model loading at startup - Error handling - SQLite database logging - Clean architecture (API → Service → DB → Model) - Deployment to a public server This helped me understand that ML in production is more about system design and integration than just model accuracy. You can check out the project here: https://lnkd.in/gn_S46VY Small step, but meaningful progress. #MachineLearning #Backend #FastAPI #LearningInPublic
To view or add a comment, sign in
-
Tired of messy code in LangGraph? Meet a tidier way to build Agentic Workflows. We’ve just released a new Travel Agent Chatbot Demo built with Picoflow. While there are many LangGraph implementations in Python, developers often struggle with messy code when managing complex transitions and conditional logic. Picoflow solves this by providing a clean, structured organization for your ChatBot’s logic. Explore the demo: 📺 Watch the Video: https://lnkd.in/dxHpGm2B 💻 Travel Demo Code:https://lnkd.in/dkCpvXa9 🎨 React ChatBot Demo UI: https://lnkd.in/dYuMq-cp (Connect this directly to your local Picoflow server!) Build faster, stay organized. Visit www.picoflow.io to learn more.
To view or add a comment, sign in
-
-
● Why Async Matters in FastAPI (And When To Use It) While building APIs, I realized something important: Not all endpoints should be written the same way. FastAPI supports both synchronous and asynchronous functions — but using async correctly can significantly improve performance. 🔹 What’s Happening Here? •The request waits for an external API •Instead of blocking the thread, async allows other requests to be processed. •This improves concurrency under high traffic. 🔹 When Should You Use Async? Use async when: •Calling external APIs •Querying databases (with async drivers) •Performing I/O operations 💡 WHY THIS MATTER Efficient backend systems are not just about writing endpoints. They’re about handling multiple users without slowing down. Understanding async is crucial for building scalable APIs. Backend performance is architecture + execution. #BackendDevelopment #FastAPI #Python #APIDesign #ScalableSystems
To view or add a comment, sign in
-
-
Decoder Launches Visual Code Navigation Tool with LLM Integration 📌 Decoder launches a groundbreaking visual code navigation tool that integrates large language models (LLMs) directly into the development workflow, enabling developers to trace complex call chains through codebases without relying on grep. By parsing Python ASTs into a structured SQLite graph and powering an MCP server, the tool slashes token usage and communication overhead-offering a faster, smarter way to explore code. 🔗 Read more: https://lnkd.in/dZKjeb5p #Decoder #Llm #Pythonast #Callgraph #Sqlite
To view or add a comment, sign in
Explore related topics
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development