REST API gateway for Orient - webhooks, scheduler, and health monitoring
npm install @orient-bot/api-gatewayREST API gateway for the Orient.
- Scheduler Service: Cron-based message scheduling
- Webhook Forwarding: Route incoming webhooks to handlers
- Health Monitoring: Service health checks and metrics
- Notification Dispatch: Send messages across platforms
``bash`
pnpm add @orient-bot/api-gateway
`typescript
import { createApiServer, SchedulerService } from '@orient-bot/api-gateway';
import { loadConfig } from '@orient-bot/core';
const config = loadConfig();
const server = createApiServer(config);
// Start scheduler
const scheduler = new SchedulerService(config);
await scheduler.start();
// Start API server
server.listen(4098);
`
| Endpoint | Method | Description |
| ---------------- | --------- | ------------------------- |
| /health | GET | System health status |/api/schedules
| | GET, POST | Manage scheduled messages |/api/webhooks
| | GET, POST | Manage webhook forwards |/webhook/*
| | POST | Incoming webhook handler |
`json`
{
"name": "Daily standup reminder",
"cronExpression": "30 9 1-5",
"targetType": "slack",
"targetId": "#standup",
"message": "Time for standup! 🚀"
}
`bashBuild
pnpm build
Docker
This package includes a per-package Dockerfile for containerized deployment:
`bash
Build the Docker image
docker build -t orienter-api-gateway -f packages/api-gateway/Dockerfile .Run the container
docker run -d \
--name api-gateway \
-p 4100:4100 \
orienter-api-gateway
`For full stack deployment:
`bash
docker compose -f docker/docker-compose.v2.yml --profile api up -d
``