Anyone here coupled SST with a React Native applic...
# help
s
Anyone here coupled SST with a React Native application? I'm interested to hear your approach in terms of exposing infrastructure based env variables to the React Native application, both locally for development, and then during CI/CD flow.
Feel like I need a tool that parses CDK output into env vars, allowing piping of operations.
l
We're running a SST + Flutter app but decided on codebase separation between the two. We only have 3 variables per named environment that are required by flutter (cognito pool, cognito client id and API) so opted to share those once after creation (it's not often that you rebuild cognito from scratch). Then we have a simple enough config to be able to import specific ones for any dev's local environment (single config file)
If we ever feel the need for exposing the params in a pipe I think this approach is viable: https://docs.serverless-stack.com/environment-variables#working-with-secrets
I'm already doing something pretty similar with an internal API secret generation and it works just fine (just need to keep to a naming convention and you're golden)
o
Just wrote a script that reads outputs from cloudformation and parameter store using the AWS SDK. I'm using normal react with CRA, so that script writes all the values into a .env file
t
We really should make sst-env more flexible
s
Ta for the insights. I'm gonna go for the approach of setting SSM values via the CDK, and then read those values via SDK within the React Native app. It makes it more fluid and consistent developing and deploying across envs for me, albeit it a bit more boilerplate.