Skip to content
Service Extension

Service Extension

Overview

Service Extension in Oblax lets you add custom backend logic beyond what the standard modules provide. While modules like Forms and Bookmarks handle common CRUD patterns, service extension gives you the tools to build domain-specific microservices, custom API endpoints, and automated workflows that plug directly into the platform’s infrastructure.

Service extension is powered by the obxfw CLI — a code-generation tool that scaffolds shared packages and microservices from declarative JSON configuration. You define your domain model, persistence layer, and service type in a config file, and obxfw generates production-ready Go source files.


When to Use Service Extension

Use service extension when you need:

  • Custom domain logic that does not fit the standard module patterns
  • A dedicated microservice for a specific business domain
  • Custom API endpoints that proxy to downstream gRPC services
  • Async consumers that process messages from RabbitMQ
  • Shared domain libraries used across multiple services

Package and Service Types

Packages

A package is a reusable domain library that lives under pkg/go/<name>. It defines the domain model struct, service and persistence interfaces, and a gRPC client. Packages do not contain a main function — they are imported by services.

cd pkg/go
obxfw package init widget

This creates a package directory with an obx_package.json config file. Edit the config to define your fields, persistence targets, and gRPC settings, then build:

cd widget
obxfw package build

Services

A service is a standalone microservice with a main package. Three types are supported:

TypeFlagPurpose
REST--restBFF (Backend for Frontend) services that expose a Fiber HTTP API and proxy to gRPC DOM services
gRPC--grpcDOM (Domain) services that implement business logic and own a persistence layer
Async--asyncRabbitMQ consumer services that process messages and call downstream gRPC services
cd services
obxfw service init widget --rest
obxfw service init widget --grpc
obxfw service init widget --async

Generated Files

Package Build Output

FileDescription
<name>.goDomain model with struct, interfaces, constructors, and validators
service.goConcrete service implementation delegating to a persistence store
persistence.sql.goMySQL persistence with CRUD operations (conditional)
persistence.redis.goRedis persistence with JSON-serialized key-value storage (conditional)
client.grpc.gogRPC client connecting to the downstream DOM service
schema.hclAtlas HCL schema for the MySQL table (conditional)
smthn.protoProtobuf 3 definition for the gRPC service

REST Service Build Output

FileDescription
main.goFiber application entry point with route registration
handlers/handler.goHandler struct with gRPC client fields
handlers/<package_name>.goPer-remote CRUD handler methods

gRPC Service Build Output

FileDescription
main.goEntry point with gRPC server and RabbitMQ subscriber
handlers/handler.goHandler implementing the full gRPC interface
handlers/<name>.gogRPC handler methods for all CRUD operations
handlers/async.goRabbitMQ message handler for rollback operations

Where to next

SectionDescription
ModulesUnderstand the standard modules before building custom services
Flux Events and ScriptsUse event-driven scripts as an alternative to custom services
StorageHandle file uploads and generated content in custom services