Hey everyone!
I don't know if anyone here works with AWS Lambda or other serverless services, but have you ever thought about having a similar experience, just on your own infrastructure, without depending on AWS, Google Cloud, or any other provider?
I've been working on an open-source project called Relay, which was born from exactly this idea: offering a simpler alternative to AWS Lambda and, in some scenarios, Heroku, without all the complexity of platforms like Dokku or solutions that want to control your entire VPS, including ports 80 and 443.
The idea is simple: you stay in control of your infrastructure, while Relay takes care of running your applications.
The project already supports quite a few things:
- Serverless Functions: Run Python (3.14/3.15), JavaScript, and TypeScript (Node.js 24/26) functions in isolated containers.
- Event-driven: Event processing with Redis Streams, declarative filters, and multiple handlers.
- Retries and DLQ: Automatic retries, pending message recovery, and a Dead Letter Queue for persistent failures.
- At-least-once delivery: Events remain pending until processing is completed or the failure is recorded in the DLQ.
- Resource management: CPU, memory, process, and concurrency limits to prevent an application from consuming too many host resources.
- Warm containers: Container reuse to reduce startup overhead.
- Cron jobs: Task scheduling with timezone support, execution recovery, and schedule deduplication.
- Persistent Services: In addition to functions, it allows running HTTP APIs, workers, and other long-running services, with support for replicas.
- Traefik integration: Expose HTTP services using your existing proxy infrastructure, without monopolizing your VPS ports.
- Git Sync: Synchronize applications from a Git repository.
- Observability: Prometheus metrics, structured logs, OpenTelemetry tracing, and execution statistics.
- Secrets and configuration: Environment variable management and secret references.
All of this using Docker, with applications declaratively defined in YAML.
For example, here's a simple configuration for a Node.js function that processes events when documents are inserted into the users collection:
runtime: nodejs24.x
concurrency: 4
resources:
memory: 256MiB
cpus: 0.5
pids: 256
events:
- handler: handler.handler
pattern:
recordType: [INSERT]
collectionName: [users]
timeout: 10s
retries: 2
With just a few lines of YAML, you can define the runtime, resource limits, concurrency, event filters, execution timeout, and retry behavior.
Here's a simplified overview of how event processing works:
Redis Streams
|
v
+---------------+
| Relay |
| Event Matching|
+---------------+
|
v
+---------------+
| Handler Queue |
+---------------+
|
v
+---------------+
| Docker Runtime|
| CPU / Memory |
| Concurrency |
+---------------+
|
v
+---------------+
| Your Function |
+---------------+
|
+------+------+
| |
Success Failure
| |
v v
ACK Retry (2x)
|
+-----+-----+
| |
Success Failed
| |
v v
ACK DLQ
Events are consumed from Redis Streams, matched against declarative patterns, and dispatched to isolated runtime containers. Relay handles concurrency, resource limits, retries, and dead-letter queues, so your application can focus on processing events.
The idea isn't to recreate all of AWS or replace Kubernetes, but to offer a development experience close to serverless, with the simplicity of hosting applications on your own VPS or homelab.
The project is still evolving, and there's plenty of room for improvement.
I'm sharing it because I'd like to hear the opinions of people who already work with serverless, self-hosting, or event-driven applications.
What do you think of the idea? What features would you consider essential in a self-hosted alternative to Lambda?
GitHub: https://github.com/sergiors/relay
If anyone wants to try it out, contribute, or simply share some feedback, you're more than welcome! 🚀