Documentation

Adapters

New
Browse documentation

Published 2026-08-13. V2 is a prerelease; the web core is release-gated and other previews are named separately. What beta means.

Read this page as HTML, Markdown, or structured JSON—or open the published Markdown with an AI assistant. Gemini receives the prompt through your clipboard because its signed-out page does not reliably prefill URL text; paste when the new tab opens. External assistants need the public site URL.

1.4.1
Unavailable in this version
1.5
Unavailable in this version

Adapter System

Amber 2.0 routes session storage and pub/sub messaging through adapter interfaces. In-memory adapters are built in; an application can register a separate implementation when it needs an external store or message broker.

Why Adapters?

In Amber 1.x, Redis was required for sessions and WebSocket messaging. This created issues:

  • Required Redis installation for development
  • External dependency even for simple apps
  • No flexibility for other backends

Amber 2.0 solves this with:

  • Memory-based adapters work immediately
  • No external dependencies required
  • Implement custom adapters for any backend
  • Tests can use the in-memory implementations without an external service

Built-in Adapters

Memory Adapters (Default)

File: config/environments/development.yml — edit the existing session: and pubsub: keys. Apply the same shape deliberately to test.yml or production.yml; environment files do not inherit from one another.

YAML
session:
  key: "amber.session"
  store: "signed_cookie"
  adapter: "memory"
  expires: 3600

pubsub:
  adapter: "memory"

Memory adapters are perfect for:

  • Development environments
  • Testing
  • Single-server deployments
  • Simple applications

Cookie Sessions

For stateless session storage:

File: one file under config/environments/, such as config/environments/production.yml — replace that environment's existing session: section.

YAML
session:
  key: "amber.session"
  store: "signed_cookie"
  expires: 3600

Configuration

Session Configuration

File: config/environments/production.yml — replace the existing session: section after registering the custom database adapter.

YAML
session:
  key: "myapp.session"
  adapter: "database"  # Your custom adapter
  expires: 86400       # 24 hours

PubSub Configuration

File: the applicable file under config/environments/ — edit the existing pubsub: section.

YAML
pubsub:
  adapter: "memory"  # Or custom adapter name

Custom Adapters

Implement custom adapters for your specific needs:

  • Database sessions (PostgreSQL, MySQL)
  • Redis (via community shard)
  • Cloud storage (AWS DynamoDB)
  • Message queues (RabbitMQ, Kafka)

See Session Adapters and PubSub Adapters for implementation guides.

Migration from Redis

If you used Redis in Amber 1.x, see the Migration Guide for step-by-step migration instructions.