Skip to content

Isolate dart:io Usage to Enable Pluggable HTTP Backends #40

Closed

Description

@SandPod

Problem to Solve

Currently, the project relies directly on dart:io for HTTP server functionality, which tightly couples the framework to a specific runtime implementation. This makes it difficult to support alternative HTTP drivers in the future.

Proposal

Abstract all direct usage of dart:io (e.g., HttpServer, HttpRequest, HttpResponse) behind a platform-agnostic interface. This interface should expose the functionality needed by the framework (e.g., route handling, header access, body parsing) without depending on the underlying transport.

Steps:

  • Identify all areas where dart:io is currently used.
  • Create interfaces or platform service classes (e.g., RelicRequest, RelicResponse, RelicServer).
  • Refactor the core framework to use these abstractions.
  • Move dart:io specific logic into an internal implementation that conforms to the new interface.

This will enable future experiments with alternative transports or runtime environments without requiring a rewrite of the core framework logic.

Use Case

In the future, we may want to:

  • Run Relic in WebAssembly where dart:io is unsupported.
  • Plug in a different HTTP backend optimized for a specific platform.
  • Write tests using mock implementations without needing real sockets.

Isolating dart:io usage now allows us to remain flexible and future-proof.

Alternatives

  • Only isolate parts of dart:io (e.g., just the request/response) rather than the whole server lifecycle.

Additional context

No response

How experienced are you with this library?

None

Are you interested in working on a PR for this?

  • I want to work on this

Activity

  1. added
    enhancement
    on Mar 25, 2025
  2. moved this to Next 🌟 in Relic Roadmapon Mar 25, 2025
  3. moved this from Next 🌟 to Now 🔥 in Relic Roadmapon Mar 27, 2025
  4. self-assigned this
    on Mar 27, 2025
  5. moved this from Now 🔥 to Next 🌟 in Relic Roadmapon Apr 2, 2025
  6. moved this from Next 🌟 to Now 🔥 in Relic Roadmapon Apr 2, 2025
  7. moved this from Now 🔥 to Done in Relic Roadmapon Apr 28, 2025
  8. moved this from Inbox 📫 to Done 🚀 in Serverpod Frameworkson Aug 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions