Comparison: PgArachne vs. PostgREST
| Feature | PgArachne (+ Universal Functions) | PostgREST |
|---|---|---|
| Setup Speed | High. Universal functions allow instant CRUD similar to PostgREST. | High. Automatically generates endpoints for all tables. |
| Logic Flexibility | Unlimited. Ability to combine universal CRUD with specific RPC functions. | Limited. Most logic must reside in URL filters or Database Views. |
| Schema Handling | Native. Access via schema.function. | Flat/Global. Requires switching profiles in HTTP headers to change schemas. |
| Abstraction | Optional. You can either expose data directly (proxy) or encapsulate it safely. | Low. The API is essentially a mirror of the database schema. |
| AI & LLM Ready | Extreme. JSON-RPC and ability to define “Tool” functions specifically for AI agents. | Medium. AI has to struggle with strict URL parameter syntax. |
| Static Files | Yes. Serves HTML/JS/CSS directly from a single binary. | No. You must configure and manage an external Nginx in front of it. |
| Real-time (SSE) | Yes. Built-in SSE endpoint for PostgreSQL NOTIFY streams. | No. Requires custom wiring (e.g., LISTEN/NOTIFY + separate service). |
| Multi-Database Support | Server-wide (N:1). A single PgArachne instance connects to the server (IP:Port) and can serve all databases hosted there. | Per-Database (1:1). One instance is bound to one specific database. Serving multiple databases requires running multiple instances on different ports. |
| Authentication | JWT & API Keys. Natively supports both worlds. | Primarily JWT. |
| Rate Limiting | Yes. Built-in login rate limiting (configurable). | No. Requires external proxy or middleware. |
Why “Hybrid PgArachne” is the Winner?
Thanks to the Universal Functions (acting as an emulator), you get the best of both worlds:
- Start-up Phase (MVP): Deploy PgArachne with a few proxy functions (like the ones in
universal_table_access.sql) and in minutes you have a functional API for all tables. At this stage, it behaves exactly like PostgREST. - Production Phase: As the application grows, start writing dedicated functions for
sensitive operations (e.g.,
process_payment). This increases security and performance without changing the underlying technology stack. - Frontend & AI: At the same time, your application runs on the same port as the API (thanks to static file serving), and AI agents can call your functions directly via JSON-RPC.
Note: The “Universal Functions” are a set of standard PL/pgSQL functions you can add to your database to enable generic Read, Create, Update, and Delete operations on any table.