2.0.0 • Published 2 years ago

@pinegraph/react-website-cdk-constructs v2.0.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
2 years ago

React Website Constructs

What is this?

This package is an AWS CDK construct for hosting a secure react website. It sets up HTTPs Certificates, S3 (for storing your assets), Cloudfront (a CDN for caching resources and speeding up delivery), and DNS records.

AWS CDK enables people to have infrastructure as code (IAC). That is, with just a few commands, you'll have a fully running and functional production ready service in the cloud.

Problem

There are 2 problems. Firstly, it's hard to setup hosting a website even with popular cloud based technologies. Second, it's hard to setup a secure website. People often forget to enable secure headers to prevent XSS, clickjacking, and encryption in transit.

Benefits

By using this construct, you'll get a secure website that you can spin up in seconds.

Setup

  1. This package assummes that you are familiar with AWS CDK and already have a CDK app created. If not, follow this tutorial.
  2. Go to the AWS console and register the domain you want. This can be done in the Route 53 console and requires you to verify multiple emails.
  3. Once you have a CDK app ready and a dmoain, create a new stack or modify an existing one to include the ReactWebsiteConstruct. See the Example CDK App Code below.
  4. Deploy your change via cdk deploy.
  5. Go to your website and voila!

Example CDK App Code

new ReactWebsiteConstruct(this, "ReactWebsiteConstruct", {
  domainName: props.domainName,
  sourceAsset: s3deploy.Source.asset("../Website/build")
}

Questions?

Reach out to us on discord.

Releasing

  1. npm run build
  2. npm publish --access public