Next.js API Endpoint Generator

VerifiedSafe

Creates Next.js API routes using Prisma and Neon PostgreSQL, including CRUD endpoints for products, sales, expenses, and stock movements. Includes JWT authentication and handles offline sync payloads.

Sby Skills Guide Bot
DevelopmentIntermediate
6/2/2026
Claude Code
#nextjs#api-routes#prisma#neon-postgresql#jwt-auth

Recommended for

Automated summary

Generates Next.js API routes with Prisma and Neon PostgreSQL for the Seri application, including JWT authentication and offline sync handling.

Strengths

  • Automates CRUD API route creation with Prisma
  • Integrates JWT authentication to secure endpoints
  • Handles offline sync payloads
  • Uses Neon PostgreSQL for a scalable database

Limitations

  • Specific to the Seri app, requires adaptation for other projects
  • Does not handle updating or deleting existing routes
  • Assumes Prisma and Neon are already configured
When to use it

When you need to quickly create REST API endpoints for a Next.js application using Prisma and Neon.

When not to use it

For projects not using Next.js, Prisma, or Neon, or when JWT authentication is not required.

Security analysis

Safe
Quality score75/100

The skill provides code templates for Next.js API routes with JWT authentication and Prisma. There are no destructive commands, exfiltration attempts, or obfuscated payloads. The code follows standard practices and relies on environment variables for secrets.

No concerns found

How this analysis is made

Examples

Create API resource routes
Create a new API resource for products with CRUD endpoints using Prisma and JWT auth.
Add sync endpoint
Add a sync endpoint for offline queue payloads with authentication.
Create auth login route
Create a login endpoint that verifies PIN and returns a JWT token.

/seri-api - API Endpoint Generator

Generate Next.js API routes with Neon PostgreSQL and Prisma for Seri.

Instructions

  1. Create Next.js Route Handlers in src/app/api/
  2. Use Prisma with Neon adapter for database operations
  3. Add JWT authentication middleware
  4. Handle sync payloads from offline queue
  5. Return proper JSON responses

API Route Template

// src/app/api/{resource}/route.ts
import { NextRequest, NextResponse } from 'next/server';
import { prisma } from '@/lib/prisma';
import { verifyAuth } from '@/lib/auth';

export async function GET(request: NextRequest) {
  const user = await verifyAuth(request);
  if (!user) {
    return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
  }

  const data = await prisma.resource.findMany();
  return NextResponse.json(data);
}

export async function POST(request: NextRequest) {
  const user = await verifyAuth(request);
  if (!user) {
    return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
  }

  const body = await request.json();
  const result = await prisma.resource.create({ data: body });
  return NextResponse.json(result, { status: 201 });
}

Auth Helper

// src/lib/auth.ts
import { NextRequest } from 'next/server';
import { jwtVerify } from 'jose';

export async function verifyAuth(request: NextRequest) {
  const token = request.headers.get('authorization')?.replace('Bearer ', '');
  if (!token) return null;

  try {
    const secret = new TextEncoder().encode(process.env.JWT_SECRET);
    const { payload } = await jwtVerify(token, secret);
    return payload;
  } catch {
    return null;
  }
}

Endpoints to Create

  • POST /api/auth/login - Verify PIN, return JWT
  • POST /api/sync - Handle sync queue items
  • GET/POST /api/products - Product CRUD
  • GET/POST /api/sales - Sales
  • GET/POST /api/expenses - Expenses (OWNER only)
  • GET/POST /api/stock-movements - Stock adjustments

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/next-js-api-endpoint-generator-mma3js0k/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/next-js-api-endpoint-generator-mma3js0k' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/next-js-api-endpoint-generator-mma3js0k/download' --output '.skill-downloads/next-js-api-endpoint-generator-mma3js0k/SKILL.md.part' && mv '.skill-downloads/next-js-api-endpoint-generator-mma3js0k/SKILL.md.part' '.skill-downloads/next-js-api-endpoint-generator-mma3js0k/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

This file does not provide a usable name/description header for this native procedure. It remains available to download and inspect; use the manual method below.

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/next-js-api-endpoint-generator-mma3js0k/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills