Skip to content

feat: Add support for RPC middlewares - #4126

Merged
SandPod merged 13 commits into
serverpod:mainfrom
gitrema:middleware-relic
Nov 25, 2025
Merged

SandPod merged 13 commits into
serverpod:mainfrom
gitrema:middleware-relic

Conversation

@gitrema

@gitrema gitrema commented Oct 29, 2025 •

Copy link
Copy Markdown
Contributor

Summary

Adds experimental middleware support to Serverpod by integrating relic's native Middleware system. Middleware enables interception, modification, and short-circuiting of HTTP requests and responses before they reach endpoint handlers.

Motivation

Take a look at Issue #4194

Design Decisions

  1. Relic Native Types: No custom abstraction - uses relic's Middleware typedef directly for simplicity and familiarity
  2. Immutability: List.unmodifiable() prevents mutations after Server construction
  3. WebSocket Bypass: WebSocket upgrade requests require direct connection access and cannot pass through middleware
  4. ExperimentalApi Pattern: Follows existing pattern for exposing experimental features

Pre-launch Checklist

  • I read the Contribute page and followed the process outlined there for submitting PRs.
  • This update contains only one single feature or bug fix and nothing else. (If you are submitting multiple fixes, please make multiple PRs.)
  • I read and followed the Dart Style Guide and formatted the code with dart format.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///), and made sure that the documentation follows the same style as other Serverpod documentation. I checked spelling and grammar.
  • I added new tests to check the change I am making.
  • All existing and new tests are passing.
  • Any breaking changes are documented below.

If you need help, consider asking for advice on the discussion board.

Breaking changes

No breaking changes, the new feature is behind an experimental flag.

Summary by CodeRabbit

  • New Features
    • Added middleware support to Serverpod servers for request and response processing.
    • Introduced built-in logging middleware with configurable output destinations and optional verbose mode for detailed header logging.
    • Added middleware configuration validation to warn about large middleware lists.

@github-actions

github-actions Bot commented Oct 29, 2025 •

Copy link
Copy Markdown

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@coderabbitai

coderabbitai Bot commented Oct 29, 2025 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Adds middleware support to Serverpod through ExperimentalFeatures, introducing a new logging middleware implementation, a middleware validator utility, and integrating middleware configuration into the Server initialization flow. Exports two new middleware modules and updates the Server constructor to accept and register user-provided middleware.

Changes

Cohort / File(s) Change Summary
Public API Exports
packages/serverpod/lib/serverpod.dart
Added exports for src/server/middleware/logging_middleware.dart and src/server/middleware/middleware_validator.dart
Experimental Features Integration
packages/serverpod/lib/src/server/experimental_features.dart
Added public middleware field of type List<Middleware>? to ExperimentalFeatures with documentation; updated constructor to accept and initialize the new middleware parameter
Middleware Implementations
packages/serverpod/lib/src/server/middleware/logging_middleware.dart, packages/serverpod/lib/src/server/middleware/middleware_validator.dart
New loggingMiddleware factory function providing configurable HTTP request/response logging with verbose mode support; new MiddlewareValidator class with validation utility and recommendedMaxMiddleware constant (10)
Server Integration
packages/serverpod/lib/src/server/server.dart
Added optional middleware parameter to Server constructor; initializes private _middleware field and registers each middleware in the server's router during injection
Serverpod Initialization
packages/serverpod/lib/src/server/serverpod.dart
Integrated middleware flow: retrieves middleware from ExperimentalApi, passes to Server constructor, logs configuration, and invokes MiddlewareValidator.validate at startup; updated _initializeServerpod signature to remove experimentalFeatures parameter
Middleware Export Tests
packages/serverpod/test/server/middleware/middleware_export_test.dart
New comprehensive test suite validating public API exports for Relic middleware types, logging middleware options, MiddlewareValidator, and ExperimentalFeatures integration
Middleware Validator Tests
packages/serverpod/test/server/middleware/middleware_validator_test.dart
New test suite covering validator behavior: warnings for large middleware lists (>10), edge cases, threshold validation, and documentation of duplicate detection limitations
Integration Tests
tests/serverpod_test_server/test/middleware/api_middleware_forwarding_test.dart, tests/serverpod_test_server/test/middleware/logging_middleware_test.dart
New integration tests validating middleware forwarding with tracking/counting middleware, execution order, error handling, separate error logging, and loggingMiddleware functionality across request cycles

Sequence Diagram

sequenceDiagram
    participant Server Init
    participant ExperimentalApi
    participant MiddlewareValidator
    participant Server
    participant Router
    participant Middleware Chain
    participant HTTP Request

    Server Init->>ExperimentalApi: Retrieve middleware list
    ExperimentalApi-->>Server Init: Return List<Middleware>?
    
    Server Init->>MiddlewareValidator: validate(middleware)
    alt Middleware list > 10
        MiddlewareValidator->>Server Init: Log warning
    end
    
    Server Init->>Server: new Server(middleware: [...])
    Server->>Router: Register each middleware
    Router-->>Server: Middleware registered
    
    Server-->>Server Init: Server ready
    
    HTTP Request->>Middleware Chain: Incoming request
    loop Each middleware in order
        Middleware Chain->>Middleware Chain: Execute middleware
    end
    Middleware Chain-->>HTTP Request: Response
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Areas requiring extra attention:
    • packages/serverpod/lib/src/server/serverpod.dart: Complex initialization flow refactoring with middleware extraction, validation, and logging; verify proper parameter removal and middleware propagation through Server constructor
    • packages/serverpod/lib/src/server/middleware/logging_middleware.dart: Multiple code paths for verbose/non-verbose modes, error handling, and fallback logger logic; ensure correct handling of WebSocket and non-Response results
    • packages/serverpod/lib/src/server/server.dart: Verify middleware registration order in router injection and that the unmodifiable list copy preserves expected behavior
    • Integration between ExperimentalFeatures, ExperimentalApi, and Server initialization to ensure middleware flows correctly through the entire startup sequence

Possibly related PRs

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed PR description is mostly complete with clear summary, motivation, design decisions, completed checklist, and breaking changes section.
Title check ✅ Passed The title accurately describes the main feature addition: experimental middleware support with relic integration for HTTP request/response interception.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gitrema

gitrema commented Oct 29, 2025

Copy link
Copy Markdown
Contributor Author

@nielsenko would you mind to review this one when you have time, thanks.

@gitrema

gitrema commented Nov 7, 2025

Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@gitrema gitrema changed the title feat: Add experimental middleware support using relic's Pipeline feat: Add experimental middleware Nov 8, 2025
@gitrema
gitrema marked this pull request as ready for review November 11, 2025 19:46
@gitrema

gitrema commented Nov 12, 2025

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 12, 2025

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (5)
packages/serverpod/test/server/middleware/middleware_export_test.dart (1)

12-108: Rename tests to follow Given/When/Then wording

Our *_test.dart guideline asks for Given/When/Then phrasing. Please adjust these descriptions (e.g., “Given middleware exports When … Then …”) so this suite stays consistent with the required style.

As per coding guidelines

tests/serverpod_test_server/test/middleware/logging_middleware_test.dart (1)

7-521: Bring test descriptions in line with Given/When/Then convention

Per the *_test.dart guideline we should phrase each test(...) description as Given/When/Then. Please rename the cases in this file so they follow that structure.

As per coding guidelines

tests/serverpod_test_server/test/middleware/api_middleware_forwarding_test.dart (1)

77-245: Rename tests to Given/When/Then format

Per our /*_test.dart guideline, test descriptions need the Given/When/Then phrasing. Please adjust the names in this file (e.g., “Given middleware adds custom header When request completes Then response contains header”).

packages/serverpod/test/server/middleware/middleware_validator_test.dart (1)

16-186: Adopt Given/When/Then test descriptions

The coding guideline for /*_test.dart files asks for Given/When/Then phrasing. Rename these tests accordingly so the intent reads clearly (e.g., “Given empty middleware list When validate Then no warning”).

packages/serverpod/lib/src/server/middleware/middleware_validator.dart (1)

95-101: Avoid double “WARNING” prefix

MiddlewareValidator.validate already prefixes the message with “WARNING:”, and serverpod.dart writes '$timestamp WARNING: $message', producing “WARNING: WARNING: …”. Drop the inner prefix to keep the log clean.

Apply this diff:

-        'WARNING: Large middleware list detected (${middleware.length} middleware registered). '
-        'Consider reducing the number of middleware for better performance. '
-        'Each request passes through all middleware in sequence.',
+        'Large middleware list detected (${middleware.length} middleware registered). '
+        'Consider reducing the number of middleware for better performance. '
+        'Each request passes through all middleware in sequence.',
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 01d437d and 100e496.

📒 Files selected for processing (10)
  • packages/serverpod/lib/serverpod.dart (1 hunks)
  • packages/serverpod/lib/src/server/experimental_features.dart (2 hunks)
  • packages/serverpod/lib/src/server/middleware/logging_middleware.dart (1 hunks)
  • packages/serverpod/lib/src/server/middleware/middleware_validator.dart (1 hunks)
  • packages/serverpod/lib/src/server/server.dart (3 hunks)
  • packages/serverpod/lib/src/server/serverpod.dart (4 hunks)
  • packages/serverpod/test/server/middleware/middleware_export_test.dart (1 hunks)
  • packages/serverpod/test/server/middleware/middleware_validator_test.dart (1 hunks)
  • tests/serverpod_test_server/test/middleware/api_middleware_forwarding_test.dart (1 hunks)
  • tests/serverpod_test_server/test/middleware/logging_middleware_test.dart (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.dart

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.dart: Format all Dart code using dart format . before committing
Code must pass Dart analyzer in strict mode (util/run_tests_analyze or melos lint_strict)
Use descriptive variable and function names

Files:

  • packages/serverpod/lib/src/server/middleware/logging_middleware.dart
  • tests/serverpod_test_server/test/middleware/logging_middleware_test.dart
  • packages/serverpod/lib/src/server/experimental_features.dart
  • packages/serverpod/test/server/middleware/middleware_export_test.dart
  • packages/serverpod/test/server/middleware/middleware_validator_test.dart
  • packages/serverpod/lib/src/server/middleware/middleware_validator.dart
  • packages/serverpod/lib/serverpod.dart
  • tests/serverpod_test_server/test/middleware/api_middleware_forwarding_test.dart
  • packages/serverpod/lib/src/server/server.dart
  • packages/serverpod/lib/src/server/serverpod.dart
**/lib/**/*.dart

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Remove unnecessary comments from production code

Files:

  • packages/serverpod/lib/src/server/middleware/logging_middleware.dart
  • packages/serverpod/lib/src/server/experimental_features.dart
  • packages/serverpod/lib/src/server/middleware/middleware_validator.dart
  • packages/serverpod/lib/serverpod.dart
  • packages/serverpod/lib/src/server/server.dart
  • packages/serverpod/lib/src/server/serverpod.dart
**/*_test.dart

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*_test.dart: Write test descriptions using the Given/When/Then pattern
Organize tests with passing/success cases first, group related cases using group(), then follow with error cases

Files:

  • tests/serverpod_test_server/test/middleware/logging_middleware_test.dart
  • packages/serverpod/test/server/middleware/middleware_export_test.dart
  • packages/serverpod/test/server/middleware/middleware_validator_test.dart
  • tests/serverpod_test_server/test/middleware/api_middleware_forwarding_test.dart
🧠 Learnings (9)
📓 Common learnings
Learnt from: tp
Repo: serverpod/serverpod PR: 3747
File: tests/serverpod_new_auth_test/serverpod_new_auth_test_server/pubspec.yaml:37-38
Timestamp: 2025-07-02T16:09:27.702Z
Learning: In Serverpod migration testing, it's appropriate for test servers like serverpod_new_auth_test_server to include dependencies on both legacy packages (e.g., serverpod_auth_server) and new modular packages to enable comprehensive testing of migration paths from old to new authentication systems.
📚 Learning: 2025-08-25T19:46:58.073Z
Learnt from: tp
Repo: serverpod/serverpod PR: 3917
File: modules/new_serverpod_auth/serverpod_auth_idp/serverpod_auth_idp_server/analysis_options.yaml:3-6
Timestamp: 2025-08-25T19:46:58.073Z
Learning: In Serverpod, test tool paths like `test/integration/test_tools/serverpod_test_tools.dart` are configured per project in the "generator.yaml" file and managed by a generator system, so they don't need to be updated manually across all files at once.

Applied to files:

  • tests/serverpod_test_server/test/middleware/logging_middleware_test.dart
  • packages/serverpod/test/server/middleware/middleware_export_test.dart
  • packages/serverpod/lib/serverpod.dart
  • tests/serverpod_test_server/test/middleware/api_middleware_forwarding_test.dart
  • packages/serverpod/lib/src/server/serverpod.dart
📚 Learning: 2025-07-02T16:09:27.702Z
Learnt from: tp
Repo: serverpod/serverpod PR: 3747
File: tests/serverpod_new_auth_test/serverpod_new_auth_test_server/pubspec.yaml:37-38
Timestamp: 2025-07-02T16:09:27.702Z
Learning: In Serverpod migration testing, it's appropriate for test servers like serverpod_new_auth_test_server to include dependencies on both legacy packages (e.g., serverpod_auth_server) and new modular packages to enable comprehensive testing of migration paths from old to new authentication systems.

Applied to files:

  • tests/serverpod_test_server/test/middleware/logging_middleware_test.dart
  • packages/serverpod/test/server/middleware/middleware_export_test.dart
  • packages/serverpod/lib/serverpod.dart
  • tests/serverpod_test_server/test/middleware/api_middleware_forwarding_test.dart
  • packages/serverpod/lib/src/server/serverpod.dart
📚 Learning: 2025-10-15T11:44:29.873Z
Learnt from: CR
Repo: serverpod/serverpod PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-10-15T11:44:29.873Z
Learning: Applies to **/*_test.dart : Organize tests with passing/success cases first, group related cases using group(), then follow with error cases

Applied to files:

  • tests/serverpod_test_server/test/middleware/logging_middleware_test.dart
  • packages/serverpod/test/server/middleware/middleware_export_test.dart
  • packages/serverpod/test/server/middleware/middleware_validator_test.dart
  • tests/serverpod_test_server/test/middleware/api_middleware_forwarding_test.dart
📚 Learning: 2025-07-02T16:07:50.947Z
Learnt from: tp
Repo: serverpod/serverpod PR: 3747
File: modules/new_serverpod_auth/serverpod_auth_migration/serverpod_auth_migration_server/lib/src/business/migrating_email_endpoint_base.dart:4-4
Timestamp: 2025-07-02T16:07:50.947Z
Learning: In Serverpod, tp prefers importing the full package (e.g., 'package:serverpod_auth_migration_server/serverpod_auth_migration_server.dart') as a baseline rather than using smaller local imports, even within the same package where it might be considered a "self-import".

Applied to files:

  • tests/serverpod_test_server/test/middleware/logging_middleware_test.dart
  • packages/serverpod/test/server/middleware/middleware_export_test.dart
  • packages/serverpod/lib/serverpod.dart
  • packages/serverpod/lib/src/server/serverpod.dart
📚 Learning: 2025-11-04T12:09:52.649Z
Learnt from: marcelomendoncasoares
Repo: serverpod/serverpod PR: 4150
File: examples/auth/auth_flutter/lib/widgets/profile_info.dart:23-30
Timestamp: 2025-11-04T12:09:52.649Z
Learning: In Serverpod example and testing projects (e.g., examples/auth/auth_flutter), prefer letting errors bubble up naturally rather than handling them gracefully with catchError or try-catch blocks. This helps developers see what went wrong during development and testing.

Applied to files:

  • tests/serverpod_test_server/test/middleware/logging_middleware_test.dart
  • tests/serverpod_test_server/test/middleware/api_middleware_forwarding_test.dart
📚 Learning: 2025-11-03T15:40:41.827Z
Learnt from: SandPod
Repo: serverpod/serverpod PR: 4144
File: modules/new_serverpod_auth/serverpod_auth_idp/serverpod_auth_idp_server/lib/src/providers/passkey/endpoints/passkey_idp_base_endpoint.dart:0-0
Timestamp: 2025-11-03T15:40:41.827Z
Learning: In Serverpod authentication IDP endpoint files (modules/new_serverpod_auth/serverpod_auth_idp/serverpod_auth_idp_server), endpoint base classes should import `serverpod_auth_idp_server/core.dart` to access the Session type, rather than importing `package:serverpod_auth_core_server/session.dart` directly. This pattern is consistently used in Apple, Email, and Google endpoint files.

Applied to files:

  • packages/serverpod/test/server/middleware/middleware_export_test.dart
  • packages/serverpod/lib/serverpod.dart
  • packages/serverpod/lib/src/server/serverpod.dart
📚 Learning: 2025-09-17T16:09:20.868Z
Learnt from: nielsenko
Repo: serverpod/serverpod PR: 3980
File: packages/serverpod/lib/src/web_server/web_server.dart:102-115
Timestamp: 2025-09-17T16:09:20.868Z
Learning: In Serverpod's web server authentication handling (packages/serverpod/lib/src/web_server/web_server.dart), query parameter authentication fallback (`authenticationKey ??= queryParameters['auth']`) is intentionally maintained for legacy compatibility reasons, even though it has security implications regarding credential leakage.

Applied to files:

  • packages/serverpod/lib/serverpod.dart
  • packages/serverpod/lib/src/server/server.dart
  • packages/serverpod/lib/src/server/serverpod.dart
📚 Learning: 2025-06-12T12:35:56.188Z
Learnt from: exaby73
Repo: serverpod/serverpod PR: 3619
File: packages/serverpod/test/server/command_line_args_test.dart:220-250
Timestamp: 2025-06-12T12:35:56.188Z
Learning: `CommandLineArgs` in Serverpod is intentionally designed so that if any CLI argument is invalid, the parser discards all parsed values and falls back to the built-in defaults, while emitting a log message. Maintainers consider this acceptable and do not plan to change it.

Applied to files:

  • packages/serverpod/lib/src/server/serverpod.dart

@SandPod

SandPod commented Nov 12, 2025

Copy link
Copy Markdown
Contributor

@gitrema Could you comment on this issue so that I can assign it to you? #4194

@SandPod SandPod linked an issue Nov 12, 2025 that may be closed by this pull request
1 task

@nielsenko nielsenko left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some suggestions and questions

@gitrema
gitrema force-pushed the middleware-relic branch 4 times, most recently from 335bb32 to 56887cc Compare November 18, 2025 06:32

@nielsenko nielsenko left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some more comments 😊

@nielsenko nielsenko left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More feedback.

I don't like middleware_export_test.dart. It is full of runtime tests that would be trivially caught by the compiler (if they were not true), and hence I was confused by them.

I get that you want to test that these types, functions, etc. are available to the user, but I think it would be better to have a test file that contains not runtime tests. Simply reference the entities needed. Add a big comment explaining why this test file is weird, and warns against simply point importing the missing stuff, if it starts to fail.

@nielsenko nielsenko left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a single comment to consider. Other than that it looks good. Thank you @gitrema

@SandPod SandPod left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work! Really nice to see this feature finished! :D

I have some last NIT comments around what we expose. I think we shouldn't cause confusion by providing multiple ways handling logging in the framework. But I do believe that the logging middleware is a good example on how to use middleware that can be adapted for different purposes.

For that reason I think we should move it to the Example project.

I know you have already spent some time on this, if you don't have time to fix this in the near future, we could do a quick push to the branch and solve the last hurdle :)

gitrema and others added 6 commits November 25, 2025 09:08
Add middleware using relic's native Middleware typedef.
This enables users to register middleware that will be executed
in order using relic's Pipeline system.

Key features:
- Uses relic's Middleware typedef (Handler Function(Handler))
- Comprehensive documentation with examples

   🤖 Generated with [Claude Code](https://claude.com/claude-code)

   Co-Authored-By: Claude <[email protected]>
Middleware is executed in order for all requests.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Completes the middleware integration by:
- Adding verbose logging when middleware is enabled for debugging visibility
- Adding comprehensive integration tests to verify end-to-end middleware execution

The integration tests validate:
- Middleware can modify responses (adding custom headers)
- Middleware executes for every request
- Multiple middleware execute in correct order (onion model)
- Server operates normally without middleware (no regression)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Implements comprehensive HTTP request/response logging middleware:

Implementation:
- Factory function loggingMiddleware() returns relic Middleware
- Monotonic Stopwatch for accurate timing (NTP-safe)
- Separate logger/errorLogger parameters for flexible routing
- Verbose mode for request/response headers
- Wall-clock UTC timestamps for display

Test Coverage (14 tests):
- Basic logging (method, URI, status, timing)
- Verbose mode (headers)
- Multiple requests and middleware chaining
- Error path with custom logger routing
- Separate error logger functionality

Exports loggingMiddleware from serverpod.dart public API.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Adds comprehensive tests to verify that all middleware-related types
and implementations are properly exported from the serverpod.dart
public API.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Move the logging_middleware in the example app.

@SandPod SandPod left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! @nielsenko Do you want to take a last look at this?

@nielsenko nielsenko left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SandPod LGTM

@SandPod SandPod changed the title feat: Add experimental middleware feat: Add support for RPC middlewares Nov 25, 2025
@SandPod
SandPod merged commit d6ce6b6 into serverpod:main Nov 25, 2025
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 25, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add middleware support to RPC in Serverpod

3 participants