Skip to content

Framework Integrations

OJS provides official framework integration packages (“contrib” packages) for the most popular web frameworks in each language. These adapters connect OJS to your existing application stack with idiomatic APIs — request-scoped clients, dependency injection, transactional enqueue, and compatibility adapters for migration.

All contrib packages are currently in alpha (API may change). Each package depends on the corresponding OJS SDK.

LanguageFrameworkPackageHighlights
GoGinojs-ginMiddleware, request-scoped client
GoEchoojs-echoMiddleware, context integration
GoFiberojs-fiberMiddleware, Locals-based client
GoGORMojs-gormTransactional enqueue via after-commit hooks
GoAWS Lambdaojs-serverlessLambda handler adapter for SQS jobs
JS/TSExpress@openjobspec/expressMiddleware, req.ojs client
JS/TSNestJS@openjobspec/nestjsModule, @OjsJob() decorator, DI
JS/TSNext.js@openjobspec/nextjsServer Actions, Route Handler helpers
JS/TSFastify@openjobspec/fastifyPlugin, decorator-based client
JS/TSBullMQ@openjobspec/bullmqBullMQ-compatible API for migration
PythonDjangoopenjobspec-djangoApp, management commands, on_commit enqueue
PythonFlaskopenjobspec-flaskExtension, app factory pattern
PythonFastAPIopenjobspec-fastapiDependency injection, lifespan management
PythonCeleryopenjobspec-celery@task decorator, drop-in migration
PythonSQLAlchemyopenjobspec-sqlalchemyTransactional enqueue via session events
JavaSpring Bootojs-springAuto-config, @OjsJob, Actuator health
JavaQuarkusojs-quarkusCDI extension, MicroProfile Health
JavaMicronautojs-micronautBean factory, health indicator
RustActix-webojs-actixMiddleware, app data integration
RustAxumojs-axumState extractor, Tower layer
RustDieselojs-dieselTransactional enqueue via connection callbacks
RubyRailsojs-railsActiveJob adapter, Railtie, after_commit
RubySinatraojs-sinatraExtension, helper methods
RubySidekiqojs-sidekiqperform_async compat API for migration

Repository: ojs-go-contrib

Terminal window
go get github.com/openjobspec/ojs-go-contrib/ojs-gin
import (
ojs "github.com/openjobspec/ojs-go-sdk"
ojsgin "github.com/openjobspec/ojs-go-contrib/ojs-gin"
)
r := gin.Default()
r.Use(ojsgin.Middleware(ojs.ClientConfig{URL: "http://localhost:8080"}))
r.POST("/orders", func(c *gin.Context) {
client := ojsgin.Client(c)
job, _ := client.Enqueue(c.Request.Context(), "order.process", []any{orderID})
c.JSON(200, gin.H{"job_id": job.ID})
})

Repository: ojs-js-contrib

Terminal window
npm install @openjobspec/express @openjobspec/sdk
import express from 'express';
import { ojsMiddleware } from '@openjobspec/express';
const app = express();
app.use(ojsMiddleware({ url: 'http://localhost:8080' }));
app.post('/orders', async (req, res) => {
const job = await req.ojs.enqueue('order.process', [req.body.orderId]);
res.json({ jobId: job.id });
});

Repository: ojs-python-contrib

Terminal window
pip install openjobspec-django
settings.py
INSTALLED_APPS = ['openjobspec_django']
OJS_URL = 'http://localhost:8080'
# views.py
from openjobspec_django import get_ojs_client
def create_order(request):
client = get_ojs_client()
# Enqueues only after the transaction commits
job = client.enqueue_after_commit("order.process", [order.id])
return JsonResponse({"job_id": job.id})

Repository: ojs-java-contrib

<dependency>
<groupId>org.openjobspec</groupId>
<artifactId>ojs-spring</artifactId>
<version>0.2.0</version>
</dependency>
@SpringBootApplication
@EnableOjs
public class App { }
@Service
public class OrderService {
@Autowired private OjsClient ojs;
@Transactional
public void createOrder(Order order) {
orderRepo.save(order);
ojs.enqueue("order.process", List.of(order.getId()));
}
}

Spring Boot auto-configuration provides OjsClient bean, Actuator health indicator, and @OjsJob annotation for handler registration.


Repository: ojs-rust-contrib

[dependencies]
ojs-actix = "0.1"
use ojs_actix::{OjsMiddleware, OjsClient};
let client = OjsClient::new("http://localhost:8080");
HttpServer::new(move || {
App::new()
.app_data(web::Data::new(client.clone()))
.wrap(OjsMiddleware::new())
.route("/orders", web::post().to(create_order))
})

Repository: ojs-ruby-contrib

# Gemfile
gem 'ojs-rails'
config/application.rb
config.active_job.queue_adapter = :ojs
# app/jobs/order_job.rb
class OrderJob < ApplicationJob
queue_as :orders
def perform(order_id)
order = Order.find(order_id)
order.process!
end
end
# app/controllers/orders_controller.rb
OrderJob.perform_later(order.id) # Enqueued via after_commit

Railtie auto-configuration reads from config/ojs.yml or environment variables.


Three contrib packages provide drop-in compatibility with existing job systems, enabling incremental migration:

AdapterOriginal SystemWhat it does
@openjobspec/bullmqBullMQQueue and Worker classes backed by OJS
openjobspec-celeryCelery@task decorator backed by OJS
ojs-sidekiqSidekiqperform_async API backed by OJS

These adapters let you switch from the original system to OJS by changing a single import, without rewriting handler code. See the migration guides for detailed walkthroughs.