Skip to content

Logic Documention

alanpear edited this page Dec 18, 2025 · 6 revisions

Logic Documentation

A costumer visits the website by entering the domain of the load balancer into the search bar. They enter through the internet gateway and then make their way through the load balancer assuming they meet the requirements of the security groups and the in bound rules, the load balancer then checks which availability zone has less traffic and decides where to send the traffic, then they connect to our website via http (port 80). Cloud watch logs every connection through port 80 and the users actions all get logged into a dynamodb with timestamps.

LOGGING

Our application uses API Gateway and Lambda to handle logging completely serverlessly. Whenever a user visits a page, our frontend JavaScript (logger.js) sends a POST request to an API Gateway endpoint. This triggers our Lambda function, which logs the activity to CloudWatch Logs and stores a structured record in DynamoDB inside our UserActivityLogs table. This architecture is scalable, multi-AZ resilient, and separate from our EC2 instance which only serves the frontend. CloudWatch provides real-time insight into user actions, while DynamoDB acts as our permanent storage for activity logs.

OR

Whenever a user visits or interacts with a page, our frontend JavaScript sends a log message to AWS API Gateway. That triggers a Lambda function, which records the log into DynamoDB and also prints it to CloudWatch so we can monitor activity in real time. AI was used to create the code.

More Logic

They are started at the login page (index.html) where they can chose to sign up if they don't have an account.

If they chose to sign up they are sent to the sign up page (signup.html). Here they can register using an email and phone number to make their account. The account details that they register are sent to Cognito and DynamaDB.

DynamoDB holds the password hashes and Cognito handles our login information.

After they register they are redirected to the verification page (verify.html) where they input a code that was sent to their email by cognito. After successful verification they are redirected back to the login page (index.html) where they can now login. Once they login they are redirected to the MFA setup (setup-mfa.html) where they are asked to setup MFA using an authenticator app like duo or google auth. We required MFA through an authenticator app on Cognito so the user has to set it up using the QR code and then they are required to input an MFA code on every login after setting it up.

They are once again redirected to login page (index.html) after they login they are prompted for their MFA code from the authenticator app (verify-mfa.html).

After a successful login they are directed to the home page (home.html) where they can search for tires, go to the my vehicles tab or the tutorials tab. If they chose to input their car information or tire information, the information is logged and then sent to our api which retrieves the data and pricing. The information would show up on the home page. If they chose to go to the my vehicles tab (my-vehicles.html) they can view the car that they might have saved on the home page. If they chose the the tutorials (tutorials.html) page they can see some helpful tutorials on how to check tire measurements, change a tire, and fix a flat.

Clone this wiki locally