Skip to content

davidachris/railq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RailQ: Simple SQS-like In-Memory Queue Service for Railway

RailQ is a lightweight, SQS-inspired, in-memory queue service designed for easy deployment on Railway and other cloud platforms. It provides a simple REST API for message queuing, visibility timeouts, and message lifecycle management. Perfect for prototyping, development, and lightweight production use-cases.


Features

  • SQS-like REST API
  • In-memory queue (no persistence)
  • Message visibility timeout and retention
  • Message stats (available/in-flight)
  • Easy to deploy and configure via environment variables

Deploy on Railway


Quick Start

  1. Deploy to Railway (or run locally):

    go run main.go
    # or build and run the binary
    go build -o railq && ./railq
  2. Configure via Environment Variables:

    • QUEUE_VISIBILITY_TIMEOUT (default: 30) — seconds a message is hidden after being received
    • QUEUE_RETENTION_PERIOD (default: "7d") — how long a message is retained (requires duration strings: e.g. 30s, 10m, 2h, 3d, 4mo, 1y)

REST API

All endpoints return JSON. Errors are returned as { "error": "..." }.

POST /send

Enqueue a message.

{
  "message": "your message text"
}

Response:

{
  "id": "string",
  "body": "string",
  "receiptHandle": "string",
  "createdAt": "RFC3339 timestamp"
}

POST /receive

Dequeue (lock) one or more messages for processing. Locked messages are hidden for the visibility timeout.

{
  "maxMessages": 1 // optional, default 1
}

Response:

[
  {
    "id": "string",
    "body": "string",
    "receiptHandle": "string",
    "createdAt": "RFC3339 timestamp"
  }
]

POST /delete

Delete a message by receipt handle (after processing).

{
  "receiptHandle": "string"
}

Response:

  • 204 No Content on success
  • 404 Not Found if not found

POST /extend

Extend the visibility timeout for a locked message.

{
  "receiptHandle": "string",
  "seconds": 30
}

Response:

  • 204 No Content on success
  • 404 Not Found if not found or not locked

POST /purge

Purge all messages from the queue. Response:

  • 204 No Content

GET /stats

Get queue stats. Response:

{
  "messagesAvailable": 0,
  "messagesInFlight": 0
}

GET /config

Get current queue config (visibility timeout, retention, etc). Response:

{
  "visibilityTimeoutSeconds": 30,
  "retentionPeriodSeconds": 86400
}

License

MIT

About

A simple sqs inspired queue for Railway

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published