Our review
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 you need to quickly create REST API endpoints for a Next.js application using Prisma and Neon.
For projects not using Next.js, Prisma, or Neon, or when JWT authentication is not required.
Security analysis
SafeThe 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
Examples
Create a new API resource for products with CRUD endpoints using Prisma and JWT auth.Add a sync endpoint for offline queue payloads with authentication.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
- Create Next.js Route Handlers in
src/app/api/ - Use Prisma with Neon adapter for database operations
- Add JWT authentication middleware
- Handle sync payloads from offline queue
- 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 JWTPOST /api/sync- Handle sync queue itemsGET/POST /api/products- Product CRUDGET/POST /api/sales- SalesGET/POST /api/expenses- Expenses (OWNER only)GET/POST /api/stock-movements- Stock adjustments
Next.js App Router Expert
Development
A skill that turns Claude into a Next.js App Router expert.
README Generator
Development
Creates professional and comprehensive README.md files for your projects.
API Documentation Writer
Development
Generates comprehensive API documentation in OpenAPI/Swagger format.