backend-dev-guidelines

Codify Langfuse backend development guidelines for tRPC routers, REST endpoints, and services.

322|45|Updated Dec 1, 2025
One-click install
npx skills add https://github.com/Microck/ordinary-claude-skills --skill backend-dev-guidelines-microck
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: backend-dev-guidelines
Source: https://github.com/Microck/ordinary-claude-skills/tree/main/backend-dev-guidelines
Command: npx skills add https://github.com/Microck/ordinary-claude-skills --skill backend-dev-guidelines-microck

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Maintaining consistency and best practices across a complex monorepo backend (Next.js, tRPC, Express, TypeScript) can be challenging, leading to fragmented code and inconsistent patterns. This Skill provides comprehensive guidelines for Langfuse's backend development.

Core Features & Use Cases

  • Layered Architecture Enforcement: Structure tRPC procedures, public API endpoints, and queue processors to delegate business logic to services, ensuring modularity and testability.
  • Multi-Tenant Isolation: Implement projectId filtering and robust authentication (JWT, basic auth) for secure multi-tenant applications.
  • Dual Database & Observability: Integrate PostgreSQL (Prisma) and ClickHouse, with OpenTelemetry, DataDog, and traceException for comprehensive monitoring and error handling.
  • Use Case: When creating a new tRPC router for a feature in the Langfuse monorepo, use this skill to ensure your procedures delegate to services, implement Zod validation, use traceException for error handling, and adhere to the established directory structure and naming conventions.

Quick Start

Create a new tRPC feature in the web package, ensuring it follows the router, procedure, validation, service, and error handling guidelines.

Frequently Asked Questions about backend-dev-guidelines

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure tRPC procedures and REST endpoints in a monorepo backend?

Implement layered architecture by delegating business logic to services. tRPC procedures and REST endpoints should validate input with Zod, call service functions, and handle errors with traceException. This separation ensures modularity, testability, and consistency across your backend.

What's the best way to handle multi-tenant isolation in a TypeScript backend?

Enforce multi-tenant isolation by implementing projectId filtering at the database and service layers, combined with robust authentication (JWT or basic auth). Apply this pattern consistently across tRPC, REST endpoints, Prisma queries, and ClickHouse operations to prevent unauthorized data access.

How do I integrate PostgreSQL and ClickHouse with observability in a Next.js backend?

Use Prisma for PostgreSQL queries and ClickHouse client for analytics queries, then instrument both with OpenTelemetry and DataDog. Wrap errors with traceException to centralize monitoring, enabling comprehensive visibility across your dual-database architecture.

Can I use Zod validation with tRPC procedures and BullMQ processors?

Yes. Apply Zod v4 validation to tRPC input schemas and BullMQ job payloads consistently. This ensures robust input validation across web procedures, queue processors, and API routes, reducing runtime errors and improving data integrity.

What testing strategy should I use for Next.js API routes and queue workers?

Use Jest for web-layer tests (API routes, tRPC procedures) and vitest for worker tests (BullMQ processors, services). This dual-framework approach aligns with the monorepo structure and ensures comprehensive coverage across your backend layers.

Why does environment configuration matter in a multi-tenant monorepo?

Standardized environment configuration prevents inconsistent behavior across tRPC routers, queue processors, and services. Applying established configuration practices ensures multi-tenant isolation, security policies, and observability settings work uniformly throughout your backend.