DEV Community

Nfrax
Nfrax

Posted on

Ship Production Apps in Days, Not Months: We Open-Sourced Our Entire Infrastructure Stack

Ship Production Apps in Days, Not Months

There are millions of Python packages and millions of ways to build an app.

You can spend weeks wiring together auth libraries, job queues, webhook handlers, LLM providers, banking APIs—thousands of lines of glue code before you write a single line of business logic.

We think that's backwards.

After years of building SaaS products and rewriting the same infrastructure patterns, we extracted everything into three focused packages and open-sourced them.

One goal: developer experience.

pip install svc-infra ai-infra fin-infra
Enter fullscreen mode Exit fullscreen mode

Let me show you what's inside — and how to get something real running in a few minutes.


Who This Is For

  • Backend engineers who are tired of rebuilding auth, billing, jobs, and webhooks.
  • AI engineers and agents who want reliable, non‑hallucinated infrastructure primitives.
  • Fintech builders who just want Plaid, portfolios, and cashflow analytics to "just work".

If you reach for FastAPI, LangGraph, or Plaid more than once a year, this stack is for you.


From Zero to API in 5 Minutes

Here is the kind of thing you can have running before your coffee cools down:

from svc_infra.api.fastapi.ease import easy_service_app
from svc_infra.api.fastapi.auth import add_auth_users
from svc_infra.api.fastapi.db.sql.add import add_sql_db
from svc_infra.jobs.easy import easy_jobs

app = easy_service_app(name="MyAPI", release="1.0.0")
add_sql_db(app)
add_auth_users(app)
queue, scheduler = easy_jobs()

@app.post("/api/process")
async def process(user=Depends(current_active_user)):
    queue.enqueue("heavy_task", {"user_id": user.id})
    return {"status": "queued"}
Enter fullscreen mode Exit fullscreen mode

You get a real API with auth, database, and background jobs — no glue code, no YAML explosion.


The Problem

Every project starts the same way:

  1. ✅ Set up FastAPI
  2. ⏳ Add authentication (JWT? Sessions? OAuth? MFA?)
  3. ⏳ Wire up a database with migrations
  4. ⏳ Need background jobs? Set up Redis, write a worker, handle retries
  5. ⏳ Want webhooks? Implement HMAC signing, retries, delivery tracking
  6. ⏳ Add AI features? Integrate OpenAI, then Anthropic, then Google...
  7. ⏳ Fintech app? Figure out Plaid, handle bank account syncing

By the time you've written all the infrastructure, you've lost momentum. The actual product idea sits waiting.

And here's the thing: AI agents have the same problem.

With tools like Cursor, Copilot, and Devin writing code autonomously, we noticed something: agents are great at business logic but struggle with infrastructure. They hallucinate auth flows, mess up webhook signatures, reinvent caching patterns with subtle bugs.

Both humans and AI need standardized, battle-tested infrastructure.


Package 1: svc-infra (Backend Infrastructure)

Everything you need to ship a SaaS backend, wired in one function call.

Quick Start

from svc_infra.api.fastapi.ease import easy_service_app
from svc_infra.api.fastapi.auth import add_auth_users
from svc_infra.api.fastapi.db.sql.add import add_sql_db
from svc_infra.jobs.easy import easy_jobs

# Create app with batteries included
app = easy_service_app(name="MyAPI", release="1.0.0")

# Add infrastructure
add_sql_db(app)               # PostgreSQL with migrations
add_auth_users(app)           # Full auth system
queue, scheduler = easy_jobs() # Background jobs

# Your business logic - that's it!
@app.post("/api/process")
async def process(user=Depends(current_active_user)):
    queue.enqueue("heavy_task", {"user_id": user.id})
    return {"status": "queued"}
Enter fullscreen mode Exit fullscreen mode

That's a production-ready API with auth, database, and background jobs.

What's Included

Feature What You Get
Auth JWT, sessions, OAuth/OIDC, MFA/TOTP, API keys, password policies
Billing Usage tracking, subscriptions, invoices, Stripe sync
Jobs Redis queue, retries, exponential backoff, dead letter queue
Webhooks Subscriptions, HMAC-SHA256 signing, delivery retries
Cache Redis/memory, decorators, namespacing, TTL helpers
Observability Prometheus metrics, health probes, OpenTelemetry
Database PostgreSQL + MongoDB, Alembic migrations
Storage S3, local, memory backends
Rate Limiting Per-user, per-endpoint, with headers
Multi-tenancy Tenant isolation built-in

Real Example: Auth System

Here's what add_auth_users(app) gives you:

# Automatic routes registered:
# POST /auth/register
# POST /auth/login
# POST /auth/logout
# POST /auth/forgot-password
# POST /auth/reset-password
# POST /auth/verify
# GET  /auth/me
# POST /auth/mfa/setup
# POST /auth/mfa/verify
# Plus OAuth routes for each provider...
Enter fullscreen mode Exit fullscreen mode

With one function call, you get:

  • JWT tokens with refresh
  • Session cookies
  • OAuth/OIDC (Google, GitHub, etc.)
  • MFA/TOTP
  • Password policies and breach checking
  • Account lockout
  • Key rotation support

Customizable when you need it:

add_auth_users(
    app,
    jwt_lifetime_seconds=3600,
    enable_mfa=True,
    oauth_providers=["google", "github"],
    password_min_length=12,
    require_email_verification=True,
)
Enter fullscreen mode Exit fullscreen mode

GitHub: github.com/nfraxio/svc-infra


Package 2: ai-infra (AI/LLM Infrastructure)

One interface for LLMs, agents, RAG, and MCP—across 10+ providers.

Quick Start

from ai_infra import LLM, Agent, Retriever

# Chat with any provider
llm = LLM()  # Uses OPENAI_API_KEY by default
response = llm.chat("Explain quantum computing")

# Switch providers with one line
llm = LLM(provider="anthropic", model="claude-sonnet-4-20250514")
response = llm.chat("Same question, different model")
Enter fullscreen mode Exit fullscreen mode

Build an Agent with Tools

from ai_infra import Agent

def get_weather(city: str) -> str:
    """Get current weather for a city."""
    return f"72°F and sunny in {city}"

def search_docs(query: str) -> str:
    """Search internal documentation."""
    return db.search(query)

agent = Agent(tools=[get_weather, search_docs])
result = agent.run("What's the weather in Tokyo and how do I configure auth?")
# Agent automatically calls both tools and synthesizes the answer
Enter fullscreen mode Exit fullscreen mode

RAG in 5 Lines

from ai_infra import Retriever

retriever = Retriever()
retriever.add_file("company_docs.pdf")
retriever.add_file("product_manual.md")

results = retriever.search("How do I reset my password?")
Enter fullscreen mode Exit fullscreen mode

Multiple backends supported:

# Development
retriever = Retriever(backend="memory")

# Local persistence
retriever = Retriever(backend="sqlite", path="./vectors.db")

# Production
retriever = Retriever(backend="postgres", connection_string="...")
retriever = Retriever(backend="pinecone", index_name="my-index")
Enter fullscreen mode Exit fullscreen mode

MCP (Model Context Protocol) Support

Full MCP client with interceptors:

from ai_infra import MCPClient
from ai_infra.mcp import RetryInterceptor, CachingInterceptor

async with MCPClient(
    "http://localhost:8080",
    interceptors=[
        RetryInterceptor(max_retries=3),
        CachingInterceptor(ttl=300),
    ]
) as client:
    tools = await client.list_tools()
    result = await client.call_tool("search", {"query": "test"})
Enter fullscreen mode Exit fullscreen mode

Create MCP servers from plain functions:

from ai_infra import mcp_from_functions

def search_docs(query: str) -> str:
    """Search documentation."""
    return db.search(query)

def get_user(user_id: str) -> dict:
    """Get user details."""
    return {"id": user_id, "name": "John"}

mcp = mcp_from_functions(
    name="my-mcp",
    functions=[search_docs, get_user]
)
mcp.run(transport="stdio")
Enter fullscreen mode Exit fullscreen mode

Supported Providers

Provider Chat Embeddings TTS STT Images
OpenAI
Anthropic - - - -
Google
xAI (Grok) - - - -
Ollama (local) - - -
ElevenLabs - - - -
Deepgram - - - -
Stability - - - -

GitHub: github.com/nfraxio/ai-infra


Package 3: fin-infra (Financial Infrastructure)

Production-ready financial data for fintech apps.

Quick Start

from fin_infra.banking import easy_banking
from fin_infra.investments import easy_investments
from fin_infra.markets import easy_market

# Connect bank accounts via Plaid
banking = easy_banking(provider="plaid")
accounts = await banking.get_accounts(access_token)
transactions = await banking.get_transactions(account_id)

# Investment holdings with real P/L
investments = easy_investments(provider="plaid")
holdings = await investments.get_holdings(access_token)
for h in holdings:
    print(f"{h.symbol}: {h.quantity} shares, P/L: ${h.unrealized_gain}")

# Market data
market = easy_market()
quote = market.quote("AAPL")
print(f"AAPL: ${quote.price}")
Enter fullscreen mode Exit fullscreen mode

Financial Calculations

from fin_infra.cashflows import npv, irr, loan_payment

# Net Present Value
cashflows = [-100000, 30000, 30000, 30000, 30000]
value = npv(rate=0.08, cashflows=cashflows)

# Internal Rate of Return
rate = irr(cashflows)

# Loan payments
monthly = loan_payment(principal=250000, rate=0.065, years=30)
Enter fullscreen mode Exit fullscreen mode

What's Included

  • Banking: Plaid/Teller integration, accounts, transactions
  • Investments: Holdings with cost basis, real P/L, asset allocation
  • Market Data: Stocks, crypto, forex quotes and history
  • Credit: Credit scores and monitoring
  • Analytics: Cash flow, savings rate, spending insights
  • Calculations: NPV, IRR, loan amortization

GitHub: github.com/nfraxio/fin-infra


The Philosophy

1. Developer Experience is Everything

There are a million ways to build an app. We obsessed over making infrastructure disappear so you can ship in days, not months—in 10 lines, not 1000.

2. Sensible Defaults, Full Flexibility

Every function works out of the box with zero configuration. But everything is customizable:

# Just works
app = easy_service_app(name="MyAPI")

# Customized
app = easy_service_app(
    name="MyAPI",
    enable_cors=True,
    cors_origins=["https://myapp.com"],
    enable_metrics=True,
    metrics_path="/custom-metrics",
)
Enter fullscreen mode Exit fullscreen mode

3. Composable, Not Monolithic

Use svc-infra alone for a SaaS. Add ai-infra for AI features. Add fin-infra for fintech. They work together but don't require each other.

4. Production-Tested

We run these in production. Not a weekend project—actual error handling, retries, observability, battle-tested patterns.


What's Next

These three packages are just the beginning.

We're expanding to cover more domains—healthcare, e-commerce, IoT, whatever developers need.

We're going multi-language. The goal is the same across any language or framework: developer experience, simplicity, full flexibility, production readiness.

TypeScript, Go, Rust—all coming. Ship production-ready apps fast, in any language.


Get Started

pip install svc-infra ai-infra fin-infra
Enter fullscreen mode Exit fullscreen mode

All MIT licensed. Full docs in each repo.

Links:


Questions?

Drop a comment below! Happy to discuss:

  • Architecture decisions we made
  • Tradeoffs and why
  • How specific features work
  • What you'd like to see added

We built this because we got tired of rewriting the same patterns. Hoping it saves you time too.

⭐ Star us on GitHub if this is useful!

Top comments (1)

Collapse
 
jedrzejdocs profile image
jedrzejdocs

Great stack! The "sensible defaults, full flexibility" philosophy is exactly right.

One thing that would help adoption: more "under the hood" auth documentation. You mentioned this is on your radar - showing what actually happens when you call add_auth_users() would give developers confidence.

I do technical documentation professionally - I'd be happy to contribute a "How Auth Works" page showing the request flow, session handling, JWT lifecycle etc.

Would that be useful? Happy to do it for a small credit in the docs + permission to use it as portfolio.