spp-backend-patterns

Establish backend patterns for SPP-Sekolah with Prisma 7 and Midtrans webhooks.

Updated Mar 9, 2026
One-click install
npx skills add https://github.com/tegars5/spp-sekolah --skill spp-backend-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: spp-backend-patterns
Source: https://github.com/tegars5/spp-sekolah/tree/main
Command: npx skills add https://github.com/tegars5/spp-sekolah --skill spp-backend-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Traditional backend architectures often entangle business logic with infrastructure, causing duplication, inconsistency, and slow delivery. This Skill defines a set of patterns for SPP-Sekolah that separate concerns and enforce safe, scalable API design.

Core Features & Use Cases

  • Service Layer pattern to isolate business logic from controllers.
  • Prisma transactions and anti-duplication checks for invoices and payments.
  • Idempotent webhook handling for Midtrans.
  • Centralized error handling, validation (Zod), and RBAC.
  • Audit logging for financial actions and governance.

Quick Start

Implement the patterns by aligning existing and new modules to the Service Layer, Prisma-based data access, and a webhook-aware payment flow.

Frequently Asked Questions about spp-backend-patterns

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

FAQPage Schema
How do I structure a backend service layer with Prisma to separate business logic from controllers?

A service layer pattern isolates business logic from controllers by using thin controllers for request handling, dedicated services for logic, and Prisma 7 repositories for data access. This enforces modularity, prevents duplication, and streamlines API delivery.

How does idempotent webhook handling work for Midtrans payment workflows?

Idempotent webhook handling for Midtrans workflows uses anti-duplication checks and Prisma transactions to ensure payment events are processed only once. This prevents duplicate invoice entries and maintains financial data integrity during concurrent webhook deliveries.

What's the best way to enforce RBAC and centralized error handling in a payment API?

Implement RBAC through dedicated middlewares and centralize error handling to standardize validation and permission failures across API surfaces. Applying Zod validation ensures robust data integrity for financial actions like invoice generation and student management.

Do I need Prisma transactions for invoice and payment processing in a school billing system?

Prisma transactions are required for invoice and payment processing to enforce atomic database updates. They work with anti-duplication checks to guarantee that concurrent billing actions and webhook payloads do not cause data inconsistencies or duplicate records.

Why should I use audit logging for financial actions in a school SPP backend?

Audit logging for financial actions in a school SPP backend provides governance and traceability for sensitive operations. It tracks payment modifications and invoice updates across the service layer, ensuring accountability and simplifying compliance verification.

Can I apply these backend patterns to API surfaces beyond Students, Invoices, and Payments?

These backend patterns can be applied across all API surfaces by aligning new modules to the service layer architecture. Using thin controllers, repository-based Prisma data access, and centralized validation ensures consistent, scalable design for any new endpoint.