glapi-backend-guidelineslisted
Install: claude install-skill adteco/glapi
# GLAPI Backend Development Guidelines
## Purpose
Establish consistency and best practices for GLAPI's backend development using:
- **Next.js 15** - API routes and server architecture
- **TRPC** - Internal type-safe procedures
- **REST API** - External access via TRPC conversion layer
- **Drizzle ORM** - Type-safe database queries
- **PostgreSQL** - Primary database
- **Clerk** - Authentication
- **Zod** - Input validation
- **TypeScript** - Full type safety
## When to Use This Skill
Automatically activates when working on:
- Creating or modifying TRPC routers, procedures
- Building Next.js API routes (REST endpoints)
- Converting TRPC to REST
- Database operations with Drizzle ORM
- Clerk authentication integration
- Input validation with Zod
- Backend services and business logic
- Backend testing and refactoring
---
## Architecture Overview
### Dual API Pattern
**Your Unique Architecture:**
1. **TRPC (Internal)**: Type-safe procedures for Next.js frontend consumption
2. **REST (External)**: Public API endpoints created by converting TRPC procedures
3. **Shared Services**: Business logic used by both TRPC and REST
4. **Drizzle ORM**: Database access layer
```
Client Request (Frontend)
↓
┌─────────────────┐
│ TRPC (Internal) │ ← Next.js frontend
│ Type-safe │
└─────────────────┘
↓
Service Layer ← Shared business logic
↓
Drizzle ORM
↓
PostgreSQL
External Request (API)
↓
┌──────────────────┐
│ REST API Routes │ ← Ex