erp-api-route

Generate Next.js 16 API routes with authentication guards and Supabase.

209|46|Updated Feb 13, 2026
One-click install
npx skills add https://github.com/erp-mafia/gnubok --skill erp-api-route
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: erp-api-route
Source: https://github.com/erp-mafia/gnubok/tree/main/.claude/skills/erp-api-route
Command: npx skills add https://github.com/erp-mafia/gnubok --skill erp-api-route

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Generates scalable, repeatable Next.js 16 API route boilerplates for gnubok with consistent authentication guards, Supabase client usage, event emission, and robust error handling.

Core Features & Use Cases

  • Route Template: Standard Next.js 16 API route scaffold with per-request authentication guards, user-scoped data filters, and error signaling.
  • Event Emission: Supports emitting domain events after successful operations, with ensureInitialized() invoked at module scope.
  • Journal Entry Handling: Integrates non-blocking and blocking journal entry creation aligned with business logic.
  • Use Case: Create endpoints for entities like invoices, customers, or vouchers using a uniform pattern.

Quick Start

Create a new Next.js 16 API route under app/api using the ERP API Route Generator template, integrating auth guards, Supabase client usage, event emission, and journal entry handling.

Frequently Asked Questions about erp-api-route

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

FAQPage Schema
How do I create secure Next.js 16 API routes with Supabase authentication guards?

Next.js 16 API routes with Supabase authentication guards are generated by scaffolding boilerplate that enforces per-request auth checks and user-scoped data filters, ensuring defense-in-depth security. This provides consistent route protection and safe data access patterns automatically.

What is defense-in-depth user_id filtering in API route generation?

Defense-in-depth user_id filtering is a security pattern that applies user-scoped data constraints at multiple layers within API routes. It ensures queries automatically filter database records by the authenticated user's ID, preventing unauthorized data access even if upper layers fail.

Do I need to manually initialize Supabase clients for dynamic Next.js API routes?

You do not need to manually initialize Supabase clients for dynamic routes if you use a generator satisfying ensureInitialized() module-level requirements. This pattern handles module-level initialization automatically, supporting dynamic route params and consistent client usage.

What's the best way to handle journal entries in Next.js API routes?

Handling journal entries in Next.js API routes is best achieved by integrating non-blocking and blocking journal entry creation aligned with your business logic. This ensures robust transaction recording and event emission after successful API operations without blocking response times unnecessarily.

Can I emit domain events after successful operations in Next.js 16 endpoints?

You can emit domain events after successful operations in Next.js 16 endpoints by using route templates that support event emission. These templates invoke ensureInitialized() at module scope, allowing you to signal downstream domain events reliably upon successful API completion.

Why are my Next.js API route boilerplates lacking consistent error handling?

Next.js API route boilerplates lack consistent error handling when generated without a standardized template enforcing robust error signaling. Using a uniform API route generator ensures all endpoints under app/api/ possess consistent authentication guards, error handling, and data access patterns.