跳转到内容

Core Concepts

此内容尚不支持你的语言。

import { Card, CardGrid } from ‘@astrojs/starlight/components’;

MiniGateway is built around a few core concepts that make it flexible and powerful.

MiniGateway follows a modular architecture with three main components:

The heart of MiniGateway - handles routing, proxy logic, and request transformation. Extensible plugins for authentication, rate limiting, logging, and custom transformations. A modern dashboard for monitoring, configuration, and real-time analytics.

Routes define how incoming requests are matched and forwarded to target services.

Routes are matched using path patterns with support for:

  • Exact matching: /api/users matches exactly that path
  • Wildcard matching: /api/* matches any path starting with /api/
  • Parameter matching: /api/users/:id extracts id as a parameter

Each route can be configured with:

PropertyDescription
pathThe incoming path pattern to match
targetThe destination URL to proxy to
methodsHTTP methods to allow (GET, POST, etc.)
pluginsPlugins to apply for this route
timeoutRequest timeout in milliseconds

Plugins extend MiniGateway’s functionality. They can be applied globally or to specific routes.

PluginPurpose
authAuthentication and authorization
rate-limitRequest rate limiting
transformRequest/response transformation
cacheResponse caching
loggerRequest logging

You can create custom plugins by implementing the Plugin interface:

interface Plugin {
name: string;
onRequest?: (context: RequestContext) => Promise<void>;
onResponse?: (context: ResponseContext) => Promise<void>;
}

MiniGateway uses a database for storing configuration and runtime data.

  • SQLite: Local development and small deployments
  • LibSQL: Turso/LibSQL for distributed edge deployments
  • PostgreSQL: Enterprise deployments (planned)

The core schema includes:

  • routes: Route definitions
  • plugins: Plugin configurations
  • logs: Request/response logs
  • metrics: Performance metrics