All Projects → erezrokah → Serverless Monorepo App

erezrokah / Serverless Monorepo App

Licence: mit
Serverless Monorepo App

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Serverless Monorepo App

Daily Apps
Everything you see on Daily 👀
Stars: ✭ 141 (+3.68%)
Mutual labels:  monorepo, frontend
Airform
Functional HTML forms for Front-End Developers.
Stars: ✭ 307 (+125.74%)
Mutual labels:  serverless, sendgrid
Bit
A tool for component-driven application development.
Stars: ✭ 14,443 (+10519.85%)
Mutual labels:  frontend, monorepo
Redux Requests
Declarative AJAX requests and automatic network state management for single-page applications
Stars: ✭ 330 (+142.65%)
Mutual labels:  monorepo, frontend
Azure Functions Billing
Azure Functions v2 with .NET Core - billing in serverless architecture.
Stars: ✭ 49 (-63.97%)
Mutual labels:  serverless, sendgrid
Function Templates
Twilio Function templates for different Voice, SMS, Video, Chat, Sync, etc use cases
Stars: ✭ 120 (-11.76%)
Mutual labels:  serverless, sendgrid
Circleci Monorepo
An example of monorepo with CircleCI using conditional workflows and pipeline parameters.
Stars: ✭ 205 (+50.74%)
Mutual labels:  circleci, monorepo
Threatmapper
Identify vulnerabilities in running containers, images, hosts and repositories
Stars: ✭ 361 (+165.44%)
Mutual labels:  serverless, circleci
Hooks
FullStack | Zero Api | Using "React Hooks" to develop the back-end | Vite
Stars: ✭ 367 (+169.85%)
Mutual labels:  serverless, frontend
Blog
📚 专注Web与算法
Stars: ✭ 1,140 (+738.24%)
Mutual labels:  serverless, frontend
Monorepo
Showcase of how to manage building projects inside monorepo with Gradle as build tool and CircleCI, Bitbucket Pipelines, Travis CI or GitHub Actions as CI tool.
Stars: ✭ 129 (-5.15%)
Mutual labels:  circleci, monorepo
Gofn
Function process via docker provider (serverless minimalist)
Stars: ✭ 134 (-1.47%)
Mutual labels:  serverless
Nextjs Vercel Firebase
Next.js app using API routes to connect with Firestore.
Stars: ✭ 133 (-2.21%)
Mutual labels:  monorepo
Knix
Serverless computing platform combining container-based resource isolation and lightweight execution model with processes to significantly reduce function startup latency and improve resource efficiency. Works in Knative and bare metal/VM environments.
Stars: ✭ 133 (-2.21%)
Mutual labels:  serverless
Frontend
🌏 The front-end application code for https://buildkite.com
Stars: ✭ 132 (-2.94%)
Mutual labels:  frontend
Portfolio Generator
JS framework to dynamically generate a portfolio site from a JSON file
Stars: ✭ 135 (-0.74%)
Mutual labels:  frontend
Webapp.rs
A web application completely written in Rust. 🌍
Stars: ✭ 1,888 (+1288.24%)
Mutual labels:  frontend
Aws Codebuild Jenkins Plugin
AWS CodeBuild integration as a Jenkins build step.
Stars: ✭ 132 (-2.94%)
Mutual labels:  serverless
Mern Authentication
MERN stack authentication boilerplate: password reset, email verification, server sessions, redux, hooks and docker for dev and prod.
Stars: ✭ 129 (-5.15%)
Mutual labels:  frontend
Documents
收集的程序开发相关的书籍与文档,多数为 PDF 格式文件,欢迎 fork 和 star。
Stars: ✭ 130 (-4.41%)
Mutual labels:  frontend

Serverless Monorepo App

License: MIT CircleCI

This application is structured as a monorepo which means all the different packages sits under the same GitHub repository.

It makes it easier to have CI/CD and automate dependency management.

For example, under frontend sits the React application which consumes the services under services.

Since the endpoint urls for the services change between environments (dev/qa/prod) we need to setup the frontend app correctly.

Since all of our code sits in the same repository, we can update the frontend app environment based on the services deployment with ease.

This application uses Auth0 for authentication, Sendgrid for sending emails, CircleCI for deployment and AWS as a cloud provider.

Resources Used

Prerequisites

Nodejs (at least version 8)

Yarn

Amazon AWS account and awscli installed and configured: https://aws.amazon.com/getting-started/

CircleCI account

Serverless CLI

Auth0 account

Sendgrid account for the email service

Repository structure

This repository uses lerna and yarn workspaces to handle dependencies.

The React frontend app sits under frontend/.

The Serverless services sit under services/.

Shared services code is under services/common/ (e.g. both api-service and email-service use the same authentication handler).

Typescript is used across the repository.

Setup

Install Dependencies

yarn install

CI/CD is setup for 3 different environments: dev (for local development), qa (for integration tests) and prod (production).

Setup Environments

This part can be a bit tedious, but you only have to do it once.

Sendgrid

Open Sendgrid settings

For sending emails you'll need a Sendgrid API key for each environment you'll want to have (3 keys if you want dev,qa and prod).

Login into your Sendgrid account and create an API key (with email sending permissions) for each environment (you can name them Serverless App Dev, Serverless App QA, etc.).

Make sure to copy the API keys somewhere as you'll only see them once.

Auth0

Open Auth0 management dashboard

The way to create different environments in Auth0 is to use something called Tenants.

You should create a tenant for each environment you'd like to use (you do it by clicking the icon for your account and choosing Create tenant).

A common setup is to have tenants named mydomain-dev for development, mydomain-qa for QA and mydomain for production.

After creating the relevant tenants you'll need to create an application (you can name it Serverless Test App or something similar).

You'll need your application's Domain, Client ID, Audience and the public key of the signing certificate.

Domain and Client ID are under applications->${YOUR_APP_NAME}->settings.

Audience is usually https://YOUR_DOMAIN/userinfo and to get the certificate you'll need to scroll down, go to Show Advanced Settings->Certificates->DOWNLOAD CERTIFICATE.

You should save the certificate in PEM format.

Setup Dev Environments Files

Run the following command to create the dev config files (make sure to update your_certificate.pem)

cp frontend/.env.example.local frontend/.env.local
cp services/common/environment/config.example.json services/common/environment/config.dev.json
cp services/email-service/config.example.json services/email-service/config.dev.json
mv your_certificate.pem services/common/environment/public_key.dev.pem

Update frontend/.env.local, services/common/environment/config.dev.json and services/email-service/config.dev.json with the relevant values.

Setup CircleCI

You'll need to add your project in CircleCI. In order to do it you'll probably need to fork this repository.

After you've done that you should add your AWS credentials under Settings->AWS Permissions (you should create a separate IAM User for that)

The last part left is to setup qa and prod environment variables for your project.

Under Settings->Environment Variables add the following items (update the values):

PROD_AUTH0_AUDIENCE
PROD_AUTH0_CLIENT_ID
PROD_AUTH0_DOMAIM
PROD_AUTH0_PUBLIC_KEY # This value should be base64 encoded, run `base64 ${LOCATION_TO_PEM_FILE}` to get the value
PROD_REGION # You can use `us-east-1` at the moment
PROD_SENDGRID_API_KEY
QA_AUTH0_AUDIENCE
QA_AUTH0_CLIENT_ID
QA_AUTH0_DOMAIM
QA_AUTH0_PUBLIC_KEY # This value should be base64 encoded, run `base64 ${LOCATION_TO_PEM_FILE}` to get the value
QA_REGION # You can use `us-east-1` at the moment
QA_SENDGRID_API_KEY

Deployment

Development environment

yarn deploy:dev # deploys services and updates frontend configuration
yarn build:frontend # builds frontend application
yarn publish:frontend:dev # deploys frontend application

QA environment will be deployed automatically on each commit to master

Production environment will be deployed automatically on each version tag push, for example the following will trigger a production deployment:

git tag "v0.0.1"
git push --tags

Post Deployment Setup

After deploying there is one last step to get Auth0 to work.

Open Auth0 management dashboard and go to applications->${YOUR_APP_NAME}->settings.

Update Allowed Callback URLs with:

http://localhost:3000/callback,http://localhost:5000/callback,https://YOUR_CLOUDFRONT_DOMAIN/callback

Update Allowed Web Origins with:

http://localhost:3000,http://localhost:5000,https://YOUR_CLOUDFRONT_DOMAIN

You can get the domain value from here: https://console.aws.amazon.com/cloudfront/home

Run Tests

yarn test
yarn coverage
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].