BFF Template

The template for the file used when adding new entities to a web API using the `add:entity` command.

Add Entity Template Properties

NameRequiredDescriptionDefault
ProfileNameNoThe name of the profile that is added into your launchsettings.json to run your BFF locally.Development
PortNoThe port of the .NET app. Will initially boot to this port and then forward to the SPA proxy.None
ProxyPortNoThe port of your SPANone
AuthorityYesThe authority url for the auth server.None
ClientIdYesThe client id of the client as configured on your authorization server.None
ClientSecretYesThe client secret known only to your application and authorization server.None
CookieNameNoThe name of the cookie for your BFF__Host-{ProjectName}-bff
BoundaryScopesNoA list of strings to add as scopes.None
HeadTitleNoThe text in the head of your app.{ProjectName} App
EntitiesYesA list of entities that will be used to create BFF features.None
RemoteEndpointsNoThe configuration that proxies api calls from your BFF to an external source like your scaffolded boundaries.None

Remote Endpoint

If you want to route your API calls through your BFF as a proxy, you must add a RemoteEndpoint for that entity or route. You can read more about Duende's Remote Endpoints in their docs.

NameRequiredDescriptionDefault
LocalPathNoThe path called in your React app (e.g. /api/recipes)None
ApiAddressNoThe path that the local path is forwarded to (e.g. https://localhost:5375/api/recipes)None

BFF Template Example

Bff:
  ProjectName: RecipeManagementApp
  ProxyPort: 4378
  HeadTitle: Recipe Management App
  Authority: https://localhost:3385
  ClientId: recipe_management.bff
  ClientSecret: 974d6f71-d41b-4601-9a7a-a33081f80687
  RemoteEndpoints:
    - LocalPath: /api/recipes
      ApiAddress: https://localhost:5375/api/recipes
  BoundaryScopes:
    - recipe_management
  Entities:
    - Name: Recipe
      Features:
        - Type: GetList
        - Type: GetRecord
        - Type: AddRecord
        - Type: UpdateRecord
        - Type: DeleteRecord
      Properties:
        - Name: Title
        - Name: Directions
        - Name: RecipeSourceLink
        - Name: Description
        - Name: ImageLink
        - Name: Rating
          Type: number?