{"id":26572893,"url":"https://github.com/roshanrajcmd/aws-web-app","last_synced_at":"2026-05-15T20:31:51.059Z","repository":{"id":279059701,"uuid":"937605745","full_name":"RoshanRajcmd/aws-web-app","owner":"RoshanRajcmd","description":"A Ride Sharing Web application hosted in AWS Amplify and other services.","archived":false,"fork":false,"pushed_at":"2025-02-24T03:50:54.000Z","size":9672,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-13T22:26:46.218Z","etag":null,"topics":["angular","aws","aws-ec2","aws-lambda","aws-s3"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RoshanRajcmd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2025-02-23T13:31:23.000Z","updated_at":"2025-02-24T03:50:57.000Z","dependencies_parsed_at":"2025-07-13T22:28:32.695Z","dependency_job_id":null,"html_url":"https://github.com/RoshanRajcmd/aws-web-app","commit_stats":null,"previous_names":["roshanrajcmd/aws-web-app"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/RoshanRajcmd/aws-web-app","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RoshanRajcmd%2Faws-web-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RoshanRajcmd%2Faws-web-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RoshanRajcmd%2Faws-web-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RoshanRajcmd%2Faws-web-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RoshanRajcmd","download_url":"https://codeload.github.com/RoshanRajcmd/aws-web-app/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RoshanRajcmd%2Faws-web-app/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33078898,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-15T20:25:35.270Z","status":"ssl_error","status_checked_at":"2026-05-15T20:25:34.732Z","response_time":103,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["angular","aws","aws-ec2","aws-lambda","aws-s3"],"created_at":"2025-03-23T00:36:00.952Z","updated_at":"2026-05-15T20:31:51.036Z","avatar_url":"https://github.com/RoshanRajcmd.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SnapRides\n\nA Web Application for ride-sharing service where you can book a ride around your area using AWS services available on free tier. \nThis project is refered from the original [Amazon workshop](https://aws.amazon.com/serverless-workshops). \n\n## ⚙️ Source Code\n\nFrontEnd and others: [aws-web-app](https://github.com/RoshanRajcmd/aws-web-app)\n\n## 📚 Architecture\n\n* Angular\n* AWS\n  * Lambda\n  * DynamoDB\n  * Amplify\n  * API Gateway\n  * Cognito\n  * IAM\n\n\u003cimg width=\"1306\" alt=\"Screenshot 2025-02-23 at 7 12 06 PM\" src=\"https://github.com/user-attachments/assets/81419f94-470e-4026-aff5-12c601a3011b\" /\u003e\n\n\n## 🎛️ Features\n\n1. Incorporated into a CI/CD pipeline with Amplify.\n2. Account creation and log in. \n3. Map is powered by ArcGIS. \n\n## Cost\nAll services used are eligible for the [AWS Free Tier](https://aws.amazon.com/free/).  Outside of the Free Tier, there may be small charges associated with building the app (less than $1 USD), but charges will continue to incur if you leave the app running.  Please see the end of the YouTube video for instructions on how to delete all resources used in the video.\n\n## 📸 Screenshots\n\n## 🧑‍💻 Developer setup\n\n*AWS* \n\nBuild a general VPC structure with Public and Private subnets, Route table and Internet gateway for you setup based on the above architecture diagram.\n\n*Amplify Setup*\n\nGo to AWS Amplify and Click Create new APP.\nChoose the code base repository and brach from your GitHub Account.\nIf needed add in your build compand and build location. And click Deploy to deploy the application.\nNote: Amplify have a automated pipeline for CI/CD by default when a app is created and that will detect and deploy any new changes pushed into the selected branch.\n\n\n### The Lambda Function Code\nHere is the code for the Lambda function, originally taken from the [AWS workshop](https://aws.amazon.com/getting-started/hands-on/build-serverless-web-app-lambda-apigateway-s3-dynamodb-cognito/module-3/ ), and updated for Node 20.x:\n\n```node\nimport { randomBytes } from 'crypto';\nimport { DynamoDBClient } from '@aws-sdk/client-dynamodb';\nimport { DynamoDBDocumentClient, PutCommand } from '@aws-sdk/lib-dynamodb';\n\nconst client = new DynamoDBClient({});\nconst ddb = DynamoDBDocumentClient.from(client);\n\nconst fleet = [\n    { Name: 'Angel', Color: 'White', Gender: 'Female' },\n    { Name: 'Gil', Color: 'White', Gender: 'Male' },\n    { Name: 'Rocinante', Color: 'Yellow', Gender: 'Female' },\n];\n\nexport const handler = async (event, context) =\u003e {\n    if (!event.requestContext.authorizer) {\n        return errorResponse('Authorization not configured', context.awsRequestId);\n    }\n\n    const rideId = toUrlString(randomBytes(16));\n    console.log('Received event (', rideId, '): ', event);\n\n    const username = event.requestContext.authorizer.claims['cognito:username'];\n    const requestBody = JSON.parse(event.body);\n    const pickupLocation = requestBody.PickupLocation;\n\n    const unicorn = findUnicorn(pickupLocation);\n\n    try {\n        await recordRide(rideId, username, unicorn);\n        return {\n            statusCode: 201,\n            body: JSON.stringify({\n                RideId: rideId,\n                Unicorn: unicorn,\n                Eta: '30 seconds',\n                Rider: username,\n            }),\n            headers: {\n                'Access-Control-Allow-Origin': '*',\n            },\n        };\n    } catch (err) {\n        console.error(err);\n        return errorResponse(err.message, context.awsRequestId);\n    }\n};\n\nfunction findUnicorn(pickupLocation) {\n    console.log('Finding unicorn for ', pickupLocation.Latitude, ', ', pickupLocation.Longitude);\n    return fleet[Math.floor(Math.random() * fleet.length)];\n}\n\nasync function recordRide(rideId, username, unicorn) {\n    const params = {\n        TableName: 'Rides',\n        Item: {\n            RideId: rideId,\n            User: username,\n            Unicorn: unicorn,\n            RequestTime: new Date().toISOString(),\n        },\n    };\n    await ddb.send(new PutCommand(params));\n}\n\nfunction toUrlString(buffer) {\n    return buffer.toString('base64')\n        .replace(/\\+/g, '-')\n        .replace(/\\//g, '_')\n        .replace(/=/g, '');\n}\n\nfunction errorResponse(errorMessage, awsRequestId) {\n    return {\n        statusCode: 500,\n        body: JSON.stringify({\n            Error: errorMessage,\n            Reference: awsRequestId,\n        }),\n        headers: {\n            'Access-Control-Allow-Origin': '*',\n        },\n    };\n}\n```\n\n### The Lambda Function Test Function\nHere is the code used to test the Lambda function:\n\n```json\n{\n    \"path\": \"/ride\",\n    \"httpMethod\": \"POST\",\n    \"headers\": {\n        \"Accept\": \"*/*\",\n        \"Authorization\": \"eyJraWQiOiJLTzRVMWZs\",\n        \"content-type\": \"application/json; charset=UTF-8\"\n    },\n    \"queryStringParameters\": null,\n    \"pathParameters\": null,\n    \"requestContext\": {\n        \"authorizer\": {\n            \"claims\": {\n                \"cognito:username\": \"the_username\"\n            }\n        }\n    },\n    \"body\": \"{\\\"PickupLocation\\\":{\\\"Latitude\\\":47.6174755835663,\\\"Longitude\\\":-122.28837066650185}}\"\n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froshanrajcmd%2Faws-web-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froshanrajcmd%2Faws-web-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froshanrajcmd%2Faws-web-app/lists"}