An open API service indexing awesome lists of open source software.

https://github.com/ahmedheikall/serverless-application

A fully serverless application built on AWS. Users can register for a raffle, view the number of participants, and the system randomly selects 3 winners using AWS Lambda and DynamoDB.
https://github.com/ahmedheikall/serverless-application

api-gateway aws-lambda cloud dynamodb s3 serverless

Last synced: 4 months ago
JSON representation

A fully serverless application built on AWS. Users can register for a raffle, view the number of participants, and the system randomly selects 3 winners using AWS Lambda and DynamoDB.

Awesome Lists containing this project

README

          

# AWS Serverless Raffle Application

![AWS](https://img.shields.io/badge/AWS-Serverless-orange?logo=amazon-aws&logoColor=white)
![Node.js](https://img.shields.io/badge/Node.js-18-green?logo=node.js&logoColor=white)

A fully **serverless application** built on **AWS**.
Users can register for a raffle, view the number of participants, and the system randomly selects **3 winners** using AWS Lambda and DynamoDB.

## Features

- **User Registration** (name, email, phone)
- **Count Participants** in real time
- **Random Winner Draw** (3 unique winners)
- **Scalable & Serverless** (no server management)
- **Custom Domain + SSL/TLS** via Route53 + ACM
- **Static Frontend** hosted on S3 + CloudFront

## Architecture Components

- **Amazon API Gateway** – Exposes REST endpoints for frontend → backend integration.
- **AWS Lambda** – Three main functions:
- `apply.js` → Registers participants in DynamoDB.
- `count.js` → Returns number of registered participants.
- `draw.js` → Randomly selects winners and marks them in DynamoDB.
- **Amazon DynamoDB** – Stores participants (email, phone, name, status).
- **Amazon S3 + CloudFront** – Hosts static HTML frontend for users.
- **Amazon Route 53 + ACM** – Custom domain with SSL/TLS certificate.
- **IAM Roles & Policies** – Secure least-privilege access for Lambda & API Gateway.
- **Amazon CloudWatch** – Centralized logging & monitoring for Lambda executions.

User (Browser)

CloudFront (CDN) + S3 (Frontend Hosting)

Route 53 (Custom Domain + SSL/ACM)

API Gateway (REST API)

AWS Lambda Functions

DynamoDB (Participants Table)

CloudWatch (Logs/Monitoring)

## How It Works

1. **User opens the frontend (S3 + CloudFront)** and submits name, email, and phone.
2. **API Gateway → Lambda (apply.js)** stores participant data in DynamoDB (`users_raffle` table).
3. **count.js** returns the number of registered participants.
4. **draw.js** randomly selects **3 winners**, updates their status (`won = yes`), and returns them.

## Achievement

This project demonstrates real-world AWS serverless architecture, combining scalability, cost efficiency, and automation with Lambda, API Gateway, DynamoDB, S3, CloudFront, Route53, IAM, ACM, and CloudWatch.