β

ObjectQL v4.0 is currently in Beta.

ObjectStack LogoObjectQL
Server & Deployment

Server & Deployment

Learn how to configure, integrate, and deploy ObjectQL applications

ObjectQL is designed to be framework-agnostic and can be integrated with any Node.js server or deployed to various environments. This section covers server configuration, integration patterns, and deployment strategies.

Overview

The server layer in ObjectQL provides:

  • Multiple Framework Support: Express, Next.js, Fastify, and more
  • API Styles: REST, JSON-RPC, GraphQL, OData V4, and WebSocket support
  • Configuration Management: Environment-based configuration
  • Plugin System: Extend functionality with plugins
  • Microservices: Federation and distributed architectures

Key Topics

Configuration

Configure your ObjectQL application:

  • Database connections
  • Environment variables
  • Metadata loading
  • Driver configuration
  • Runtime options

Server Integration

Integrate ObjectQL with web frameworks:

  • Express.js setup
  • Next.js integration
  • Fastify adapter
  • Custom server setup
  • HTTP API exposure

Microservices & Federation

Build distributed systems with ObjectQL:

  • Service federation
  • Remote data sources
  • Cross-service queries
  • Load balancing
  • Service discovery

Plugin System

Extend ObjectQL with plugins:

  • Creating custom plugins
  • Plugin lifecycle
  • Bundling behavior
  • Sharing plugins
  • Official plugins

Quick Setup

// objectstack.config.ts
import { ObjectStackKernel } from '@objectstack/runtime';
import { HonoServerPlugin } from '@objectstack/plugin-hono-server';
import { ObjectQLPlugin } from '@objectql/core';
import { SqlDriver } from '@objectql/driver-sql';

const kernel = new ObjectStackKernel([
  {
    name: 'my-app',
    objects: {
      User: {
        name: 'User',
        fields: {
          name: { type: 'text', required: true },
          email: { type: 'text', required: true }
        }
      }
    }
  },
  new SqlDriver({
    client: 'postgresql',
    connection: process.env.DATABASE_URL
  }),
  new ObjectQLPlugin(),
  new HonoServerPlugin({ port: 3000 })
]);

await kernel.start();

Configuration File

// objectstack.config.ts
import { defineConfig } from '@objectql/core';

export default defineConfig({
  datasources: {
    default: {
      driver: 'sql',
      client: 'postgresql',
      connection: {
        host: process.env.DB_HOST,
        database: process.env.DB_NAME,
        user: process.env.DB_USER,
        password: process.env.DB_PASSWORD
      }
    }
  }
});

Deployment Patterns

Traditional Server

Deploy to VPS, EC2, or dedicated servers:

  • Process management with PM2
  • Nginx reverse proxy
  • Environment configuration
  • Database migrations

Serverless

Deploy to serverless platforms:

  • AWS Lambda
  • Vercel Functions
  • Cloudflare Workers
  • Database connection pooling

Containers

Deploy with Docker:

  • Dockerfile configuration
  • Docker Compose setup
  • Kubernetes deployment
  • Health checks and monitoring

Next Steps

On this page