gabrielbrieva / barber-appointment

Simple serverless web application to make an appointment with barber

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Barber Appointments

Simple web application to make an appointment with barber. This repo contain two projects:

  • backend: Nodejs application based on Serverless Framework to deploy lambda functions an related resources to AWS.
  • frontend: Single page application (SPA) created with Angular to provide a Web user interface to Create, Update, Delete and Review a Barber Appointment.

Backend

CI/CD

Nodejs project based on Serverless Framework.

Requirement

  • npm command
  • node 12 or higher
  • AWS CLI

Deployment

  1. Entry to "backend" folder path
cd backend
  1. Install node dependencies
npm install
  1. Configure AWS credentials
aws configure
  1. Deploy to AWS using Serverless
npm run deploy

API Testing

A Postman collection file was provided (resources/barber-appointment.postman_collection.json) to test Lambda functions.

CI/CD

The automatization of build and deploy is managed by GitHub Actions configured by main.yml file.

  • The backend-build Job is triggered by each push or pull request to main branch.
  • And backend-deploy Job (AWS deploy) is triggered by relase tags.

Variables:

  • AWS_DEPLOY_STAGE: AWS deploy stage (default as "dev")
  • AWS_DEPLOY_REGION: AWS deploy region (default as "us-east-1")

Secrets:

  • AWS_DEPLOY_ACCESS_KEY_ID: AIM User Access Key ID
  • AWS_DEPLOY_SECRET_ACCESS_KEY: AIM User Secret Access Key

Activity Diagram

A simple Activity Diagram was provided to understand all interactions between user and systems:

Activity Diagram

Frontend

SPA based on Angular project

Requirement

  • npm command
  • node 12 or higher

Run

To run the web application locally:

  1. Entry to "frontend" folder path
cd frontend
  1. Update src/environments/environment.ts file
const apiId = 'YOUR API ID FROM DEPLOYED AWS LAMBDA FUNCTIONS';
const region = 'YOUR AWS REGION WHERE IS DEPLOYED FRONTEND';
  1. (Optional) Update Auth0 configurations at src/environments/environment.ts file
auth0ClientId: 'YOUR Auth0 Client ID'
  1. Run npm script to build and start local server
npm run start
  1. Start your browser at http://localhost:4200

CI

The automatization of build and testing is managed by GitHub Actions configured by main.yml file. The frontend-build and frontend-test Job is triggered by each push or pull request to main branch.

How this work

Running

About

Simple serverless web application to make an appointment with barber


Languages

Language:TypeScript 78.5%Language:HTML 14.1%Language:SCSS 4.2%Language:JavaScript 3.2%