Skip to content
This repository was archived by the owner on Aug 21, 2026. It is now read-only.
This repository was archived by the owner on Aug 21, 2026. It is now read-only.

Dependency Injection in backend #46

Open

Description

@dnys1

Related to #40. Based off a Discord thread.

It is common to have a set of service providers shared between functions on the backend (for example, Sentry). Currently, in order to use the same provider in multiple functions, users are required to initialize the provider at the start of each call, e.g.

// functions/my_api.dart

Future<void> _initializeSentry({ required String dsn }) async {
  // initialize sentry provider
}

Future<void> tracedFunction({
  // params...
  @Env.sentryDsn required String sentryDsn,
}) async {
  await _initializeSentry(dsn: dsn);
}

It would be nice if there was a way to consolidate this logic even more so functions can either move this logic to a middleware or have a pre-initialized service provider injected into the function like env variables are currently injected.

Activity

  1. added a commit that references this issue on Mar 9, 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

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions