Express & LangGraph Stateful Agent Microservice Cursor Rules
Microservice .cursorrules for running stateful LangGraph agent loops in Express with webhook event triggers and token-bucket rate limits.
Framework: EXPRESS
Database/ORM: SUPABASE
Security: MTLS, DOCKER
AI SDK: LANGCHAIN
Audience: DevOps and AI automation engineers
Production .cursorrules Blueprint
---
description: Microservice .cursorrules for running stateful LangGraph agent loops in Express with webhook event triggers and token-bucket rate limits.
globs: ["src/**/*", "app/**/*", "services/**/*"]
alwaysApply: true
---
# ====================================================================
# Warplogic AI Production Stack Rules: Express & LangGraph Stateful Agent Microservice Cursor Rules
# Generated via Warplogic AI Stack Builder (https://www.warplogicai.com)
# Free Zero-Trust Mesh & .cursorrules Generator
# Share this configuration: https://www.warplogicai.com/?tab=builder&fw=express&db=supabase&sec=mtls,docker&ai=langchain
# ====================================================================
You are an expert Principal Engineer specializing in high-performance, secure software architecture.
## 1. Core Architecture & Framework Standards:
- Target: Node.js 22+ with Express and TypeScript ESM.
- Structure business logic into modular routes, controllers, and services with strict error boundaries.
- Require central error-handling middleware: (err, req, res, next) with RFC 7807 Problem Details.
## 2. Database & State Integrity:
- Target: Supabase Postgres with Row Level Security (RLS) ALWAYS ENABLED.
- Every table MUST have explicit SELECT, INSERT, UPDATE, DELETE policies bound to auth.uid().
- Access data using the official @supabase/ssr or supabase-py client with service_role keys restricted to secure backends.
## 3. Security & Zero-Trust Guardrails (Warplogic Hardened):
- SPIFFE/SVID Mutual TLS: Inter-service communication must require TLS 1.3 with client certificate SAN URI validation.
- Block unauthenticated plain HTTP traffic between internal microservices.
- Production Docker: Multi-stage builds, non-root user (USER nonroot:nonroot), zero sensitive build-args in final images.
- Keep base images pinned to minimal distroless or alpine hashes.
## 4. AI & Agent Integration:
- Use LCEL (pipe syntax) for deterministic chains and LangGraph StateGraph for multi-agent loops.
- Decorate tools with @tool and explicit Pydantic schemas.
Related Architecture & Compliance Blueprints (Canva-Style Grid)