superapp
Backend

Overview

What @superapp/backend does, how it works, and what routes it exposes.

Chat in Claude

@superapp/backend is a data access layer that turns your databases into a secure, authenticated API. Point it at Postgres, MySQL, SQLite, or CSV files and get instant CRUD with row-level security, audit logging, and an admin UI.

import { createEngine } from '@superapp/backend'
import { createHonoMiddleware } from '@superapp/backend/adapters/hono'
import { serve } from '@hono/node-server'
import { Hono } from 'hono'

const engine = createEngine({
  connections: {
    main: process.env.PG_URL!,
  },
})

const app = new Hono()
app.route('/', createHonoMiddleware(engine))
serve({ fetch: app.fetch, port: 3001 })

Routes

RouteMethodDescription
/dataPOSTQuery, insert, update, delete records
/schemaGETIntrospect available tables and columns
/auth/**Authentication endpoints (login, register, session)
/adminGETAdmin UI dashboard
/admin/api/**Admin API for managing connections and permissions

Request Pipeline

Every /data request passes through a 10-step pipeline:

Request → Rate Limit → Validate → JWT → Session → Roles → Permissions → Query Build → Execute → Audit → Response

Key Concepts

  • Databases -- Named database sources (Postgres, MySQL, SQLite, CSV) connected via native drivers
  • Auth Providers -- Pluggable authentication (better-auth or custom); client-side auth lives in @superapp/auth
  • Permissions -- Row-level security with operation blocks (select, insert, update, delete), each with inline roles
  • Adapters -- Framework bindings for Hono, Next.js, Express, and generic handlers

Next Steps

On this page