Skip to main content

Introduction

Poge provides a Next.js API backend for PostgreSQL database operations. The API handles query execution, connection management, schema exploration, and statistics tracking.

Base URL

All API endpoints are relative to your Poge deployment:
http://localhost:3000/api

Authentication

Poge uses client-side authentication with no server-side auth required. Database credentials are passed directly in API requests and used to establish connections via PostgreSQL connection pooling.
All database credentials (host, port, user, password) must be included in each request. These are not stored server-side.

Request Format

All POST endpoints accept JSON payloads with the following structure:
{
  "host": "localhost",
  "port": 5432,
  "user": "postgres",
  "password": "your_password",
  "database": "mydb",
  "sslMode": "disable"
}

SSL Mode Options

sslMode
string
SSL connection mode. Options:
  • disable - No SSL (default)
  • require - Require SSL with self-signed certificates allowed
  • prefer - Try SSL first, fallback to non-SSL

Response Format

Success Response

Successful responses return JSON with appropriate status codes (200, 201):
{
  "data": {},
  "executionTime": 45
}

Error Response

Error responses include detailed error information:
{
  "error": "Connection refused",
  "details": "Unable to connect to the database server. Please check if the server is running and the host/port are correct.",
  "code": "ECONNREFUSED"
}

Common Error Codes

CodeDescription
ECONNREFUSEDDatabase server is not reachable
ENOTFOUNDHostname cannot be resolved
28P01Authentication failed (invalid credentials)
3D000Database does not exist
28000User lacks database permissions
ECONNRESETConnection reset (often SSL misconfiguration)

Rate Limiting

No rate limiting is enforced. Connection pooling handles concurrent requests efficiently.

Available Endpoints

Connection Pooling

Poge uses PostgreSQL connection pooling to optimize performance. Each unique connection configuration (host, port, user, database) maintains a separate pool.

Pool Configuration

  • Max clients per pool: 10
  • Idle timeout: 30 seconds
  • Connection timeout: 5 seconds
See Pool Statistics for monitoring active connections.

Query Caching

Read-only SELECT queries are automatically cached to improve performance. See Cache Statistics for details.