{"id":16203082,"url":"https://github.com/michidk/serverless-webapp","last_synced_at":"2025-03-19T07:30:36.662Z","repository":{"id":45727802,"uuid":"483203566","full_name":"michidk/serverless-webapp","owner":"michidk","description":"A web application deployment using Terraform for AWS, Azure, and GCP.","archived":false,"fork":false,"pushed_at":"2024-03-26T10:53:33.000Z","size":139,"stargazers_count":7,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-17T04:36:54.577Z","etag":null,"topics":["aws","azure","cloud","gcp","hacktoberfest","serverless","terraform"],"latest_commit_sha":null,"homepage":"","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/michidk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-19T10:42:59.000Z","updated_at":"2023-06-26T16:20:40.000Z","dependencies_parsed_at":"2024-10-27T20:21:20.153Z","dependency_job_id":"1c609bb3-9d63-4d1e-b541-76e9f4f9f1bc","html_url":"https://github.com/michidk/serverless-webapp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michidk%2Fserverless-webapp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michidk%2Fserverless-webapp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michidk%2Fserverless-webapp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michidk%2Fserverless-webapp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michidk","download_url":"https://codeload.github.com/michidk/serverless-webapp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244379000,"owners_count":20443378,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","azure","cloud","gcp","hacktoberfest","serverless","terraform"],"created_at":"2024-10-10T09:51:27.571Z","updated_at":"2025-03-19T07:30:36.202Z","avatar_url":"https://github.com/michidk.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"Serverless Web App on AWS, GCP, and Azure using Terraform\n===\n\nThis sample application contains full [Terraform](https://terraform.io/) deployments for the [three major cloud platforms](https://www.statista.com/chart/18819/worldwide-market-share-of-leading-cloud-infrastructure-service-providers/), namely: [Amazon Web Services (AWS)](https://aws.amazon.com/), [Microsoft Azure (AZ)](https://azure.microsoft.com/), and [Google Cloud Platform (GCP)](https://cloud.google.com/).\n\n## About this Project\n\nThe goal of this project is to make those three deployments as homogeneous as possible to be able to compare the differences. Since not all cloud platforms offer the same features and work similarly, the resulting architectures differ slightly. Another aim was to make the deployments self-contained (they deploy the function code and frontend automatically), use only [Serverless](https://www.cloudflare.com/learning/serverless/what-is-serverless/) services as well as move all common parts out of the deployment (shared OpenAPI config and code).\n\nThe goals of the Terraform deployments in this project are:\n\n- Use only Serverless services\n- Use standards like OpenAPI\n- Make the architectures as homogeneous as possible\n- Self-contained / Move common parts out of the deployment\n\nThe application itself is a simple text analysis service that comes with a web-based frontend:\n\n![A screenshot of the sample web app](.github/images/screenshot.png)\n\n## Contents\n\nThe relevant parts of this repository are:\n\n| Folder/File | Description |\n| ---- | ----------- |\n| [.devcontainer/](.devcontainer) | The [vscode devcontainer](https://code.visualstudio.com/docs/remote/containers) for this project |\n| [.github/](.github/) | Reamd resources |\n| [.vscode/](.vscode/) | [vscode](https://code.visualstudio.com/) settings |\n| [aws/](aws/) | The AWS deployment |\n| [azure/](azure/) | The Azure deployment |\n| [common/](common/) | Common parts of the deployments |\n| [common/api/](common/api/) | The OpenAPI config |\n| [common/function/](common/function/) | The code for the FaaS function |\n| [common/website/](common/website/) | The static website for the frontend |\n| [common/mime-types.json](common/mime-types.json) | The MIME type definitions for uploads |\n| [gcp/](gcp/) | The GCP deployment |\n| [justfile](justfile) | The just configuration |\n\n## Setup\n\nYou can start up this project rather quickly using the [vscode devcontainers](https://code.visualstudio.com/docs/remote/containers), which are based on Docker.\n\nUsing the command runner [just](https://github.com/casey/just/), apply the Terraform configuration using `just apply \u003cfolder\u003e`, with `aws`, `gcp` or `azure` as the folder name.\n\n## The Architecture\n\n### General\n\nThe application requires a frontend (a static website) and backend (based on [Function as a Service (FaaS)](https://en.wikipedia.org/wiki/Function_as_a_service) offerings). The frontend needs to be served using a [Content Delivery Network (CDN)](https://www.cloudflare.com/learning/cdn/what-is-a-cdn/) to improve stability and page speeds. The FaaS function of the backend should sit behind an [API Gateway](https://www.redhat.com/en/topics/api/what-does-an-api-gateway-do).\n\n### Amazon Web Services\n\n![The AWS architecture](.github/images/aws.png)\n\n### Azure\n\n![The AZ architecture](.github/images/az.png)\n\n#### Caveats\n\n- Functions can be called directly, bypassing the API Gateway\n- Terraform currently only supports one origin per API Gateway\n- Functions don't support ES6-style JavaScript modules (https://github.com/Azure/azure-functions-nodejs-worker/issues/104). However, this feature is in preview https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-node#ecmascript-modules\n\n\n### Google Cloud Platform\n\n![The GCP architecture](.github/images/gcp.png)\n\n#### Caveats\n\n- Google requires a load balancer in front of the CDN, which can get expensive\n- There is no Google-provided domain/certificate for the CDN, so an IPv4 has to be provisioned\n- The Google API Gateway only supports OpenAPI v2, not v3. Therefore the [api-spec-converter](https://github.com/LucyBot-Inc/api-spec-converter) has te be used to convert the OpenAPI definition (using `API-spec-converter --from=openapi_3 --to=swagger_2 --syntax=yaml openapi.yaml`).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichidk%2Fserverless-webapp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichidk%2Fserverless-webapp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichidk%2Fserverless-webapp/lists"}