engine

command module
v1.9.24 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2026 License: AGPL-3.0 Imports: 23 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README ΒΆ

Apito Logo

Apito Engine

The open-source GraphQL & REST backend for your database.

Apito Engine is a self-hosted GraphQL stack. You run it on infrastructure you control. When you want managed hosting, sync the same project to Apito Cloud.

Licensed under AGPL-3.0. You can use, modify and self-host it. If you run a modified version as a network service, you must publish your changes under AGPL-3.0. A commercial license is available from Apito LLC. Releases v1.8.26 to v1.8.30 remain FSL-1.1-ALv2; see LICENSING.md.

Website Β· Documentation Β· Discord

AGPL-3.0 Release Go Report Card Build Status


Features

  • GraphQL APIs - Connect your database and get a GraphQL API. Docs
  • Plugins - Extend the engine with Go plugins and HashiCorp plugins. Docs
  • Databases - SQLite, PostgreSQL, MySQL, MariaDB, and MongoDB. Docs
  • Authentication - JWT auth, role-based access control, and API keys. Docs
  • Subscriptions - WebSocket GraphQL subscriptions. Docs
  • Functions - Function execution inside GraphQL queries and mutations. Docs
  • File Storage - File upload and management. Docs
  • πŸ“Š Admin Dashboard - Comprehensive dashboard for schema management, data browsing, and analytics.
🎯 Apito Console

πŸ“‹ Model Management
Apito Console - Model
Design your data models with an intuitive visual editor

πŸ“ Content Management
Apito Console - Content
Manage your content with a powerful admin interface

πŸš€ API Explorer
Apito Console - API
Test and explore your GraphQL APIs in real-time

Watch "releases" of this repo to get notified of major updates.

Quick Start

Install
curl -fsSL https://get.apito.io/install.sh | bash
apito start

The install script, after a successful install, sends one cli_install event to telemetry.apito.io. The event carries the OS, CPU architecture and CLI version, plus a random ID that is generated fresh on every install. It does not send a hostname, an IP, a path or a username. The event is skipped when DO_NOT_TRACK=1 or APITO_TELEMETRY=0 is set, and when the script detects CI (CI, GITHUB_ACTIONS or GITLAB_CI). The CLI has a separate telemetry setting in ~/.apito/telemetry.json. The first apito start asks whether to send anonymous CLI usage to Apito. This install event is not the only telemetry.

The console is at http://localhost:4055. The engine API is at http://localhost:5055.

apito start pulls ghcr.io/apito-io/studio.

Advanced: build from source

Requires Go 1.25.4.

git clone https://github.com/apito-io/engine
cd engine
go run .

The engine listens on http://localhost:5051. GET /health returns {"status":"ok"}.

The first run writes a 32-byte key to .apito/branka.key and later runs reuse it. Do not commit that file. If BRANKA_KEY is set and is not 32 bytes, the process exits with BRANKA_KEY must be exactly 32 bytes. Use another port by setting SERVE_PORT. Leave port 5050 for an existing local engine.

The first boot prints the admin email and a generated password. Save the password. This README does not include one.

How it works

Apito Engine is a GraphQL-first stack with a plugin architecture.

Architecture

Apito Engine uses a modern, cloud-native layout built for scalability:

graph TB
    Client[🌐 Client Applications<br/>Web, Mobile, Desktop]

    subgraph "πŸ”₯ Apito Engine"
        Router[🌐 Echo Router<br/>HTTP/WebSocket Server]
        Auth[πŸ” Auth Service<br/>JWT + API Keys]
        GraphQL[🧠 GraphQL layer<br/>Schema + Resolvers]
        Realtime[⚑ Real-time layer<br/>WebSocket Subscriptions]
        Storage[πŸ“ Storage Service<br/>File Management]

        subgraph "πŸ”Œ Plugin System"
            GoPlugins[⚑ Go Plugins<br/>High Performance<br/>.so files]
            HCPlugins[πŸ›‘οΈ HashiCorp Plugins<br/>Separate process<br/>Cross-language]
        end

        subgraph "πŸ—„οΈ Database Layer"
            DBDrivers[Database Drivers<br/>Connection Pooling]
            MongoDB[(🟠 MongoDB)]
            PostgreSQL[(🐘 PostgreSQL)]
            MySQL[(🐬 MySQL)]
            MariaDB[(🦭 MariaDB)]
            SQLite[(πŸ“„ SQLite)]
        end

        subgraph "πŸ’Ύ Cache Layer"
            Redis[(πŸ”΄ Redis<br/>Cache & Sessions)]
            KVStore[Key-Value Store]
        end
    end

    subgraph "πŸ”§ External Services"
        S3[☁️ AWS S3<br/>File Storage]
        Monitoring[πŸ“Š Monitoring<br/>Sentry, Metrics]
        CDN[🌍 CDN<br/>Static Assets]
    end

    %% Client to Apito Engine
    Client --> Router

    %% Router routing
    Router --> Auth
    Router --> GraphQL
    Router --> Realtime
    Router --> Storage

    %% Auth flow
    Auth --> Redis

    %% GraphQL to plugins
    GraphQL --> GoPlugins
    GraphQL --> HCPlugins

    %% Database connections
    GoPlugins --> DBDrivers
    HCPlugins --> DBDrivers
    GraphQL --> DBDrivers

    %% Database types
    DBDrivers --> MongoDB
    DBDrivers --> PostgreSQL
    DBDrivers --> MySQL
    DBDrivers --> MariaDB
    DBDrivers --> SQLite
    DBDrivers --> SQLite

    %% Cache connections
    GraphQL --> Redis
    Auth --> KVStore

    %% External services
    Storage --> S3
    Router --> Monitoring
    Storage --> CDN

    %% Styling
    classDef openCoreNode fill:#ff6b6b,stroke:#ffffff,stroke-width:2px,color:#ffffff
    classDef database fill:#4ecdc4,stroke:#ffffff,stroke-width:2px,color:#ffffff
    classDef plugin fill:#ffe66d,stroke:#ffffff,stroke-width:2px,color:#000000
    classDef external fill:#a8e6cf,stroke:#ffffff,stroke-width:2px,color:#000000

    class Router,Auth,GraphQL,Realtime,Storage openCoreNode
    class MongoDB,PostgreSQL,MySQL,MariaDB,SQLite database
    class GoPlugins,HCPlugins plugin
    class S3,Monitoring,CDN external

Core Components:

  • 🧠 GraphQL layer - Built with graphql-go/graphql for dynamic schema generation and high-performance query execution
  • 🌐 Echo Router - High-performance HTTP router with middleware for REST endpoints and GraphQL over HTTP
  • πŸ”Œ Plugin System - Dual architecture supporting both Go built-in plugins (.so files) and HashiCorp process-isolated plugins
  • Database drivers - SQLite, PostgreSQL, MySQL, MariaDB, and MongoDB, with connection pooling and transactions
  • πŸ” Auth Service - JWT-based authentication with RSA signing, API keys, and session management
  • ⚑ Real-time layer - WebSocket-based subscriptions for live data updates
  • πŸ“ Storage Service - File upload and management with multiple backend support
Plugin Architecture

The dual plugin system combines:

Go Built-in Plugins (High Performance)
  • Shared Memory - Direct memory access for maximum performance
  • Type Safety - Compile-time type checking and Go's strong typing
  • Fast Execution - No serialization overhead for critical operations
// Example Go plugin
package main

import "github.com/apito-io/engine/interfaces"

var MyPlugin interfaces.NormalPluginInterface = &UploadPlugin{}

type UploadPlugin struct{}

func (p *UploadPlugin) ExecuteFunction(params map[string]interface{}) (interface{}, error) {
    // High-performance plugin logic
    return result, nil
}
HashiCorp Plugins
  • Separate process - Plugins run in a separate process
  • Crash Recovery - Automatic restart on plugin failures
  • Language Agnostic - Support for Go, JavaScript, Python, and more
// Example HashiCorp plugin
func main() {
    plugin := &MyHashiCorpPlugin{}

    hcplugin.Serve(&hcplugin.ServeConfig{
        HandshakeConfig: plugins.HandshakeConfig,
        Plugins: map[string]hcplugin.Plugin{
            "my_plugin": &plugins.HashiCorpPluginRPC{Impl: plugin},
        },
        GRPCServer: hcplugin.DefaultGRPCServer,
    })
}

Client Libraries

Language Admin SDK Plugin SDK
JavaScript js-admin-sdk js-plugin-build-sdk
Go go-admin-sdk go-apito-plugin-sdk
Flutter flutter_admin_sdk

Examples

Creating Your First API
# Using the Apito CLI
apito create project -n fitnessApp

# Connect your database
apito db connect --engine postgresql --host localhost --port 5432

# Generate GraphQL schema from existing tables
apito schema generate

# Deploy locally
apito dev
GraphQL Query Example
# Query with real-time subscription
subscription {
  users(filter: { status: "active" }) {
    id
    name
    email
    posts {
      title
      createdAt
    }
  }
}

# Mutation with custom function
mutation {
  uploadUserAvatar(userId: "123", file: $file) {
    url
    thumbnails
    metadata
  }
}
Plugin Development

Create custom functionality with minimal code:

// main.go - Simple function plugin
package main

import (
    sdk "github.com/apito-io/go-apito-plugin-sdk"
)

func main() {
    // Initialize plugin
    plugin := sdk.Init("image-processor", "1.0.0", "your-api-key")

    // Register a custom function
    plugin.RegisterFunction("processImage", func(args map[string]interface{}) (interface{}, error) {
        imageUrl := args["url"].(string)
        // Process image logic here
        return map[string]interface{}{
            "processedUrl": processedUrl,
            "thumbnails": thumbnails,
        }, nil
    })

    // Register GraphQL mutation
    plugin.RegisterMutation("uploadImage", map[string]interface{}{
        "type": "ImageUploadResult",
        "args": map[string]interface{}{
            "file": sdk.NonNull(sdk.Upload),
            "size": sdk.StringArg(),
        },
        "resolve": "processImage",
    })

    // Start plugin
    plugin.Serve()
}

Configuration

Apito can be configured via environment variables or .env file:

# Database Configuration (choose one)
DATABASE_ENGINE=sqlite    # sqlite | postgresql | mysql | mariadb | mongodb

# MongoDB Configuration
DATABASE_HOST=localhost     # For Atlas: your-cluster.mongodb.net
DATABASE_PORT=27017         # Leave empty for MongoDB Atlas (uses SRV)
DATABASE_NAME=apito
DATABASE_USERNAME=admin     # Usually 'admin' for MongoDB
DATABASE_PASSWORD=password

# Other Database Ports
# DATABASE_PORT=5432        # PostgreSQL
# DATABASE_PORT=3306        # MySQL/MariaDB

# Server Configuration
PORT=5055
HOST=0.0.0.0
ENV=development

# Authentication
PRIVATE_KEY_PATH=keys/private.key
PUBLIC_KEY_PATH=keys/public.key
JWT_TTL=24h

# Storage
STORAGE_ENGINE=local
STORAGE_PATH=./uploads

# Plugins
PLUGIN_DIR=./plugins
ENABLE_PLUGIN_SYSTEM=true

# Optional Services
REDIS_HOST=localhost
REDIS_PORT=6379
SENTRY_DSN=your-sentry-dsn

Development

Plugin Development
# Create a new plugin
mkdir plugins/my-plugin
cd plugins/my-plugin

# Initialize with SDK
go mod init my-plugin
go get github.com/apito-io/go-apito-plugin-sdk

# Build plugin
go build -o my-plugin.so -buildmode=plugin .

# Or build HashiCorp plugin
go build -o my-plugin ./main.go

Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Workflow
  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make your changes and add tests
  4. Run the test suite: make test
  5. Commit your changes: git commit -m 'Add amazing feature'
  6. Push to the branch: git push origin feature/amazing-feature
  7. Open a Pull Request

Community & Support

Documentation

For documentation, visit apito.io/docs.

License

Licensed under AGPL-3.0. You can use, modify and self-host it. If you run a modified version as a network service, you must publish your changes under AGPL-3.0. A commercial license is available from Apito LLC. Releases v1.8.26 to v1.8.30 remain FSL-1.1-ALv2; see LICENSING.md.

Badges

Built with Apito

Built with Apito

[![Built with Apito](https://img.shields.io/badge/Built%20with-Apito-FF4081?style=flat&logo=graphql)](https://apito.io?utm_source=github&utm_medium=referral&utm_campaign=oss-launch&utm_content=readme-website)

Powered by Apito

Powered by Apito

[![Powered by Apito](https://img.shields.io/badge/Powered%20by-Apito-FF4081?style=for-the-badge&logo=graphql)](https://apito.io?utm_source=github&utm_medium=referral&utm_campaign=oss-launch&utm_content=readme-website)

Made with ❀️ by the Apito team and contributors

Website Β· LinkedIn Β· GitHub

Documentation ΒΆ

The Go Gopher

There is no documentation for this package.

Directories ΒΆ

Path Synopsis
Package controller provides HTTP handlers for plugin management operations
Package controller provides HTTP handlers for plugin management operations
middleware
Package middleware provides authentication and authorization middleware for HTTP handlers
Package middleware provides authentication and authorization middleware for HTTP handlers
kv
Package interfaces defines the contracts for all components in the Apito Engine.
Package interfaces defines the contracts for all components in the Apito Engine.
Package models contains common data structures and models used throughout the Apito engine
Package models contains common data structures and models used throughout the Apito engine
Package services provides optimized token services with compression and stateless scope management
Package services provides optimized token services with compression and stateless scope management
plugin
Package plugin provides functionality for loading and managing HashiCorp plugins from individual config.yml files in plugin directories.
Package plugin provides functionality for loading and managing HashiCorp plugins from individual config.yml files in plugin directories.
starterdemo
Package starterdemo fills the public engine's first-run project with a notebook people can open immediately: lists, notes, tags, and sample rows.
Package starterdemo fills the public engine's first-run project with a notebook people can open immediately: lists, notes, tags, and sample rows.
Package telemetry provides OpenTelemetry metric helpers for the Apito engine.
Package telemetry provides OpenTelemetry metric helpers for the Apito engine.
securitytest
Package securitytest contains redacted, deterministic fixtures and assertion helpers for security tests.
Package securitytest contains redacted, deterministic fixtures and assertion helpers for security tests.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL