About Portfolio Cases Services Blog Contact 🎙 Talk to AI
EN DE RU
🎙 Talk to AI
August 1, 2026 · 3 min read

Open-source AI-native infra: Replace Vercel, Sentry, PostHog & Resend with a single Rust-based self-hosted agent

I’m Denis Shokhirev, Enterprise AI architect based in Erlangen, Germany. Over the past six months, I’ve shipped 14 production AI agents for DACH B2B clients using a stack of Claude, Supabase, n8n, Doppler, and self-hosted Postgres. Last week, for the third time this quarter, I traced a critical alert that got silently dropped somewhere between PostHog and Resend. The cost of running four overlapping SaaS tools — each with unique billing, incident surface, and privacy risks — is starting to outwe

Denis Shokhirev
Denis Shokhirev
Agentic AI Systems Architect
Telegram LinkedIn

I’m Denis Shokhirev, Enterprise AI architect based in Erlangen, Germany. Over the past six months, I’ve shipped 14 production AI agents for DACH B2B clients using a stack of Claude, Supabase, n8n, Doppler, and self-hosted Postgres. Last week, for the third time this quarter, I traced a critical alert that got silently dropped somewhere between PostHog and Resend. The cost of running four overlapping SaaS tools — each with unique billing, incident surface, and privacy risks — is starting to outweigh their convenience. So why not consolidate into a single Rust-based, self-hosted infra agent?

The SaaS Stack Fracture: Where Problems Surface

1. Fragmentation and Complexity

Vercel for deploy, Sentry for error tracking, PostHog for analytics, Resend for email — each with separate dashboards, keys, and integration code. In production, it’s not just cognitive overhead: on a recent industrial automation project, we spent 3 hours debugging a missing error notification, only to find the webhook failed silently inside a third-party SaaS. Multiply this by every pipeline and the friction compounds.

2. Cost, Data Residency, and Compliance

Once your event throughput crosses 10,000/day, SaaS bills start resembling a mid-level engineer’s salary. For DACH clients, GDPR (DSGVO) compliance — data residency, auditability, and control — is non-negotiable. American SaaS with EU “regions” is often flagged at security reviews (see BSI Grundschutz).

Pattern: The Self-hosted AI Infra Agent

Why Rust?

Rust is not hype. I’ve run three production services on Rust in the last year, with sub-30ms API latency and zero crashes. The safety guarantees (memory safety, thread safety) are critical for AI infra where unpredictable payloads and concurrency are the norm.

Which SaaS can you genuinely replace?

SaaSSelf-hosted Rust-based AlternativeNotes
Vercel (deploy, edge functions)Axum, Shuttle, Docker ComposeAPI server, edge logic in Rust, deployed via Compose
Sentry (error tracking)Sentry self-hosted, tracing + opentelemetryLocal instance, Rust crate integration
PostHog (analytics)ClickHouse, RudderStack, custom eventsSelf-owned event storage and analytics
Resend (email)Mailpit + lettreLocal SMTP relay + Rust mailer

Building the Unified Agent: Core Workflow

1. Architecture

One Rust binary (Axum/Actix base) encapsulates:

  • REST/GraphQL API for ingesting events
  • Error logging and monitoring (tracing, Sentry crate)
  • Email sending (letre, Mailpit)
  • Analytics event pipeline (ClickHouse, Postgres, async queue/RabbitMQ)
  • Metrics dashboard (via Tauri/webview or connect Metabase/Superset)

2. Code Example: Event Ingest + Email


use axum::{Router, routing::post, extract::Json};
use serde::Deserialize;
use lettre::{Message, SmtpTransport, Transport};

#[derive(Deserialize)]
struct Event {
    user_id: String,
    event_type: String,
    payload: serde_json::Value,
}

async fn ingest_event(Json(event): Json) {
    // Write event to ClickHouse/Postgres
    // Log errors (Sentry integration)
    // Trigger email on certain events
    let email = Message::builder()
        .from("[email protected]".parse().unwrap())
        .to("[email protected]".parse().unwrap())
        .subject("New Event")
        .body(format!("Event: {:?}", event))
        .unwrap();

    let mailer = SmtpTransport::relay("localhost").unwrap().build();
    mailer.send(&email).ok();
}

// main, router, etc.

3. Analytics Integration

Events are written directly to ClickHouse for analysis. For dashboards, I use self-hosted Metabase or Superset — no vendor lock-in, full schema control. This enables advanced event modeling, retention analysis, and custom metrics without SaaS constraints.

Security: Static and Runtime Analysis

1. Static Analysis

For Rust: clippy and semgrep. For any Python glue code: bandit. On three recent agent launches, semgrep flagged a recurring XSS vector in auto-generated UIs — see the Semgrep docs for patterns and usage. (Ref: Semgrep, 2023)

2. Runtime Isolation

Docker Compose provides process and network isolation. Volumes for logs, and separate networks for agent and DB. For LLM agents, namespaces and resource quotas limit blast radius. Logs are shipped to central storage for audit and incident tracing.

Production Orchestration: Automation & Monitoring

n8n + Doppler for workflow and secrets

n8n acts as the automation layer: on certain events (error, threshold breach), it triggers alerts to Slack, Teams, or Telegram. Doppler manages secrets outside code, reducing credential leakage risk.


version: '3.9'
services:
  ai-infra-agent:
    build: .
    ports:
      - "8080:8080"
    environment:
      - RUST_LOG=info
      - DATABASE_URL=postgres://user:pass@db/aiagent
      - CLICKHOUSE_URL=http://clickhouse:8123
    depends_on:
      - db
      - clickhouse
  db:
    image: postgres:15
  clickhouse:
    image: clickhouse/clickhouse-server:23

FAQ

Can you run all this on a single machine?

Yes, if your event rate is under ~10,000/sec. Most B2B agent setups run fine on a single 8GB RAM box for hundreds of users.

How does SLA compare to SaaS?

You own uptime, backups, and patching. But you avoid SaaS outages and vendor lock. With proper monitoring, availability matches or exceeds most SaaS for internal workloads.

What about legal/audit requirements?

You control all logs and data retention (2+ years if needed), which is essential for GDPR/DSGVO and regulated sectors.

How do you handle updates and CVEs?

Rust service containers rarely have critical CVEs, but use tools like watchtower or CI/CD to auto-update base images and crates.

What if I still need SaaS integration?

Use REST/webhooks for external APIs, but keep core data and logic on your infra. Minimize external dependencies for critical flows.

Which part of your AI infra is most likely to silently fail in production — error reporting, email delivery, or analytics drift? I’d genuinely like to know.

I offer a free 30-min stack audit for DACH founders building AI in regulated markets. DM me on LinkedIn or write to @ger_dennis_ai.

Continue reading
How to Turn Codebase Chaos into a Queryable Knowledge Graph in 1 Day: The Graphify Case
Your AI Agent Can Be Hacked via Plugins: How to Secure Claude Code and Codex Skills in Production
OpenAI Codex hard resets usage limits after unexpected drains — how to protect production from API quota shocks
172 Production-Ready Claude Code Skills: How to Accelerate AI Agent Integration into Business Workflows (Without the Pain)
All articles →
Ready to build?

Turn your process into an AI system

Fixed price. Production quality. DACH B2B focus.

Start a project → ← All articles