Git Product home page Git Product logo

krishanthisera / aws-edge-functions Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 117 KB

This repository is a Terraform sub-module designed for use with the AWS Static Hosting module. Its primary purpose is to deploy Lambda@Edge functions for prerender integration with CloudFront. Enhance page loading speed and search engine indexing for SPAs and dynamic web applications.

HCL 22.54% TypeScript 60.72% JavaScript 16.74%
cloudfront lambda-functions prerender spacelift terraform cdn edge-computing iac s3 static-site typescript

aws-edge-functions's Introduction

AWS Edge Functions - Terraform Sub-Module

This repository serves as a Terraform sub-module designed for use with the AWS Static Hosting module. The primary purpose of this module is to deploy a set of Lambda@Edge functions that provide prerender integration for CloudFront. This enables faster page loading and improved search engine indexing for Single Page Applications (SPAs) and other dynamic web applications.

Usage

To use this module in your Terraform configuration, simply add the following code:

module "edge-functions" {
  source = "github.com/krishanthisera/aws-edge-functions.git"
}

After adding the module, run terraform init to initialize your configuration.

Technologies Used

This module is built using the following technologies and tools:

  • Terraform: Infrastructure as Code (IaC) tool used to manage AWS resources.
  • TypeScript: Language used to write the Lambda@Edge functions.
  • turbo-repo: A tool used for repository management and monorepo setups.
  • esbuild: Used to bundle the TypeScript code and set environment variables during the build process.

How to Use as a Terraform Module

To use this repository as a Terraform module, you can refer to the example provided in the AWS Static Hosting repository. It showcases how to integrate this module to enable prerendering with CloudFront.

Prerender Integration

The deployed Lambda@Edge functions work in conjunction with CloudFront to perform prerendering. This means that when a request is made to CloudFront for a page of your SPA (from a crawler), the Lambda@Edge functions will leverage prerender service to generate a prerendered version of the page and serve it to the user. This leads to improved page loading times and better SEO performance.

Handling Environment Variables

As you are not able to set environment variables at runtime for the Lambda@Edge functions, during the build process, esbuild is used to configure the necessary environment variables and bundle them into the build artifacts.

How to Contribute

Contributions to this project are welcome! If you have any bug reports, feature requests, or improvements to suggest, you can do so by creating a pull request or opening an issue. Your feedback is highly valuable to us, and we appreciate any contributions made to enhance this module.

Contact

If you have any questions or need further assistance, you can contact the project maintainer by creating an issue in this repository.

aws-edge-functions's People

Contributors

krishanthisera avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.