@stellar-apps/create-react-hook v1.0.7
@stellar-apps/create-react-app
This is an inst template for launching
Lambda-hosted React SSR apps with API Gateway + CloudFront with custom domains.
Installation
This assumes you've already created an inst workspace with inst init [workspace]
cd my-workspace
yarn inst @stellar-apps/create-react-appInstallation options
- Name- The name of the package you're creating
 
- AWS profile- The name of the AWS profile in your ~/.aws/credentialsfile that you'd like to use to deploy this application
 
- The name of the AWS profile in your 
- Domain name [production]- The domain name to launch the productionversion of your app on
 
- The domain name to launch the 
- S3 bucket [production]- default [Name]-public
- The name of the bucket to deploy your client JS, images, etc. into. These are resources that are external to your application.
 
- default 
- Domain name [staging]- default staging-[Domain name]if[Domain name]is a subdomain, otherwisestaging.[Domain name]
- The domain name to launch the stagingversion of your app on
 
- default 
- S3 bucket [staging]- default [value of staging Domain name]
- See productionabove for description
 
- default 
- Inherits code from- Use the spacebar and arrow keys to select libraries already part of your Workspace to inherit code from, 
e.g. a coreorshareddirectory. You will then be able to import these libraries into your application via the alias~[library name]e.g.import {Header} from '~core'
 
- Use the spacebar and arrow keys to select libraries already part of your Workspace to inherit code from, 
e.g. a 
Configuring CloudFormation
You should pay special attention to these values in serverless.yml EVERY TIME you create a new app 
from this template. This should be the FIRST THING you do after you create an app.
- The default template assumes you're using a unique bucket for the public client assets of this application. If you're using a shared bucket that already exists, be sure to delete the - resources.Resources.ClientS3Bucketsection of the- serverless.ymlthat gets generated.
- The default behavior for client buckets is to - retainthem on- teardownso as not to accidentally empty a bucket that is in use by other applications. To change this behavior, assuming your bucket is unique, you can change the option for- retainto- falsein- custom.syncBundle['webpack/client.config.js'].bucketand comment out- resources.Resources.ClientS3Bucket.DeletionPolicy.
- The default behavior for managing ACM certificates is to - retainthem on- teardown. This is to prevent encountering errors when you try to remove certificates that are still in use by other applications, e.g. wildcard certificates. To change this behavior, set- retainto- falsein- custom.certificateManager.retain
- Pay special attention to the - custom.certificateManager.domainslisted to be sure they are exactly the domains you need a certificate for and that they will use the exact same certificate.
- You will want to glance at the - .env.[stage]files to ensure the proper- PUBLIC_PATHis defined if you're using a CloudFront distribution in front of your S3 bucket.
Managing the application
Starting the app in the development stage and development NODE_ENV on a local server
cd my-workspace
yarn my-app startStarting the app in the development stage and production NODE_ENV on a local server
cd my-workspace
yarn my-app start productionDeploying the CloudFormation stack to staging stage
Note: You have to use this command before using deploy without a --stack flag
cd my-workspace
yarn my-app deploy --stackDeploying the CloudFormation stack to production stage
Note: You have to use this command before using deploy production without a --stack flag
cd my-workspace
yarn my-app deploy production --stackDeploying the application without changing the CloudFormation stack to staging stage
cd my-workspace
yarn my-app deployDeploying the application without changing the CloudFormation stack to production stage
cd my-workspace
yarn my-app deploy productionBundling the application without uploading the staging stage to S3
cd my-workspace
yarn my-app bundleBundling the application without uploading the production stage to S3
cd my-workspace
yarn my-app bundle productionTearing down the staging CloudFormation stack
This removes your CloudFormation stack and all the resources defined within it. Use with extreme caution.
cd my-workspace
yarn my-app teardownTearing down the production CloudFormation stack
This removes your CloudFormation stack and all the resources defined within it. Use with extreme caution.
cd my-workspace
yarn my-app teardown production