API Reference¶
This section documents the APIs and data layers in AccessALI.
API Layers¶
Server Actions¶
Server Actions handle data mutations and queries in Next.js.
API Routes¶
API Routes handle webhooks, file uploads, and external integrations.
See: API Routes Reference
Repositories¶
Repositories provide type-safe database access using Prisma.
See: Repository Layer
Use Cases¶
Use Cases orchestrate business logic across multiple data sources.
See: Use Cases Layer
Authentication¶
NextAuth.js handles authentication and session management.
See: Authentication API
Quick Example¶
// Server Action
'use server'
export async function createPayment(data: PaymentInput) {
const session = await auth()
return createPaymentUseCase(session.user.id, data)
}
// Use Case
export async function createPaymentUseCase(userId: string, data: PaymentInput) {
const payment = await createPayment(userId, data)
await sapAdapter.recordPayment(payment)
return payment
}
// Repository
export async function createPayment(userId: string, data: PaymentInput) {
return prisma.payment.create({
data: { ...data, userId }
})
}