Providing Live Implementations for API groups with @effect/platform

hey folks! I'm learning how to use @effect/platform based on the docs, and I saw in this section (https://github.com/Effect-TS/effect/tree/main/packages/platform#your-first-httpapigroup) that it's possible to separate the interface of the API from its actual implementation. The question I have is: is it possible to use groups that already have a built-in live implementation instead of having to implement them through HttpApiBuilder.group(api, <groupName>)? I would like to be able to do something similar to the example in the runtime guides:

class Notifications extends Effect.Tag("Notifications")<
  Notifications,
  { readonly notify: (message: string) => Effect.Effect<void> }
>() {
  static Live = Layer.succeed(this, { // << I want to to this
    notify: (message) => Console.log(message)
  })
}


I want to be able to do kinda like this:

class UsersApi extends HttpApiGroup.make('users').pipe(
  HttpApiGroup.add(
    HttpApiEndpoint.get('findById', '/users/:id').pipe(
      HttpApiEndpoint.setSuccess(User),
      HttpApiEndpoint.setPath(
        Schema.Struct({
          id: Schema.NumberFromString,
        })
      )
    )
  )
) {
  static Live = /* what goes here? */
}


my intent here is to create "controllers" for resources, so that would be even better if it was possible to provie the implementation next to each endpoint of the groups instead of after all the endpoint definitions
Was this page helpful?