Skip to content

[Question] How to globally add context (e.g., user locale) to all requests? #19

Closed

Description

@aleksolutions

Hi team,

First off, thanks for the great work on forge-trpc - it's significantly improved our development experience!

I have a question regarding requests: Is there a recommended way to automatically include additional context, specifically the user's locale, with every request? The goal is to access this locale within the server-side context/handler for each mutation.

Currently, I'm passing the locale manually with each call. I'm wondering if there's a cleaner, global approach, perhaps by extending a shared context or using some form of middleware provided by the adapter.

Thanks for any guidance!

Activity

  1. changed the title [-][Question] How to globally add context (e.g., user locale) to all requests?**[/-] [+][Question] How to globally add context (e.g., user locale) to all requests?[/+] on Apr 23, 2025
  2. locked and limited conversation to collaborators on Apr 24, 2025
  3. converted this issue into a discussion #20 on Apr 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions