This project is a Serverless service that deploys an AWS Lambda function to generate a random number daily and store it in a DynamoDB table. The Lambda function can be triggered via an HTTP API or scheduled to run every 24 hours. The project also includes a React Native frontend (check it out 👉 CapybaraBet) that calls the Lambda function to retrieve the random number and check if the user guessed the correct number.
- Overview
- Architecture
- Frontend - React Native
- Backend - AWS Lambda
- Installation
- Usage
- Contributing
- License
This project consists of two main components:
- Backend: A Lambda function that generates and stores a random number in a DynamoDB table named
sorted-number
. - Frontend: A React Native app that allows users to guess the random number and check if they win the bet.
- Lambda Function: Generates a random number and stores it in DynamoDB.
- DynamoDB Table: Stores the daily random number with a unique key.
- API Gateway: Provides an HTTP endpoint to trigger the Lambda function.
- CloudWatch Events: Schedules the Lambda function to run daily.
- React Native Frontend: Calls the Lambda function to get the random number and checks if the user guessed correctly.
The React Native app provides a simple user interface where users can:
- Enter their guess for the random number.
- Submit the guess to the backend (Lambda function) to check if it matches the stored random number.
- Display a message with an image indicating whether the guess was correct or not.
The Lambda function is responsible for generating the random number, storing it in DynamoDB, and responding to HTTP requests from the React Native app.
-
Clone the Repository:
git clone https://github.com/yourusername/capybara-bet-lambda.git cd capybara-bet-lambda
-
Install Dependencies:
npm install
Deploy the backend using the Serverless Framework:
serverless deploy
Make sure that your AWS credentials are properly configured in your local environment.
Contributions are welcome! Please open an issue or submit a pull request for any changes or enhancements.
This project is licensed under the MIT License - see the LICENSE file for details.