Given a frontend (front) and a backend (sst), I'm ...
# help
m
Given a frontend (front) and a backend (sst), I'm curious how people are handling the configuration at the frontend? My current thinking is using sst to store certain outputs in SSM (apigateway endpoint, cognito pool ids etc...) and then when deploying the front end, retrieve these and create a config file from them. Thoughts?
f
What u’ve described is a pretty clean approach.
We want to create a frontend construct (ie. a SPA construct or NextJS construct) and handles the config passing
That’s the goal. In the mean while, what u described sounds good.
how r u deploying ur frontend right now?
m
just fleshing out a POC, but the plan is to use netlify via github action .. so github action would do pull down ssm variables step and then trigger the netlify deploy
f
yup that makes sense
m
FWIW We are using a monorepo and exporting the values into a json file then referencing those values from an import in the front end. You can use --outputs-file on deploy to store your CfnOutput in a specified json file.
Copy code
-O, --outputs-file         Path to file where stack outputs will be written as
                             JSON                                       [string]
m
Thanks @Mike McCall.. so do you commit the CfnOutput in your monorepo?
m
The output file if generated during deploy. CfnOutput calls are committed.
Copy code
new cdk.CfnOutput(this, "GraphQLAPIURL", {
      value: api.graphqlUrl
    });