๐ฝ๏ธ What's Cooking Now?
A time-based recipe web app that suggests the perfect recipe based on your current time of day โ built with Flask, HTML, CSS & JS, containerized with Docker, and deployed on Amazon Lightsail via GitHub Actions CI/CD.
๐ธ Preview
| Time of Day | Recipe Suggested |
|---|---|
| ๐ 6AM โ 11AM | Avocado Toast with Poached Eggs |
| โ๏ธ 11AM โ 1PM | Fluffy Banana Pancakes |
| ๐ 1PM โ 4PM | Grilled Chicken Caesar Wrap |
| ๐ 4PM โ 7PM | Honey Garlic Popcorn |
| ๐ 7PM โ 10PM | Creamy Tuscan Garlic Pasta |
| ๐ 10PM โ 6AM | Midnight Nutella Mug Cake |
๐ Project Structure
whats-cooking-now/
โโโ app.py # Flask backend โ API routes & recipe logic
โโโ Dockerfile # Docker container configuration
โโโ requirements.txt # Python dependencies
โโโ static/
โ โโโ index.html # Frontend HTML
โ โโโ style.css # Styling & animations
โ โโโ script.js # Frontend logic & API calls
โโโ .github/
โโโ workflows/
โโโ deploy.yml # GitHub Actions CI/CD pipeline
๐ ๏ธ Tech Stack
| Technology | Purpose |
|---|---|
| Python 3.11 | Backend language |
| Flask 3.0.3 | Web framework & REST API |
| HTML5 | Frontend structure |
| CSS3 | Styling, animations, responsive design |
| JavaScript (Vanilla) | Live clock, API calls, countdown timer |
| Docker | Containerization |
| Amazon Lightsail | Cloud hosting (container service) |
| GitHub Actions | CI/CD pipeline โ auto deploy on push |
| AWS IAM | Secure access management for deployment |
๐ Quick Start โ Run Locally
Prerequisites
- Python 3.11+
- pip
- Docker (optional, for container testing)
- Git
Option 1 โ Run with Python directly
# 1. Clone the repository
git clone https://github.com/YOUR_USERNAME/whats-cooking-now.git
cd whats-cooking-now
# 2. Install dependencies
pip install flask
# 3. Start Flask
python app.py
# 4. Open in browser
# โ http://localhost:5000
Option 2 โ Run with Docker
# 1. Build the Docker image
docker build -t whats-cooking-now .
# 2. Run the container
docker run -p 5000:5000 whats-cooking-now
# 3. Open in browser
# โ http://localhost:5000
๐ API Endpoints
| Method | Endpoint | Description |
|---|---|---|
| GET | / |
Serves the frontend app |
| GET | /api/recipe |
Returns recipe based on current time |
| GET | /api/recipe/breakfast |
Returns breakfast recipe |
| GET | /api/recipe/brunch |
Returns brunch recipe |
| GET | /api/recipe/lunch |
Returns lunch recipe |
| GET | /api/recipe/snack |
Returns snack recipe |
| GET | /api/recipe/dinner |
Returns dinner recipe |
| GET | /api/recipe/midnight |
Returns midnight recipe |
Sample Response
{
"meal_time": "dinner",
"current_hour": 20,
"recipe": {
"emoji": "๐",
"meal": "Creamy Tuscan Garlic Pasta ๐๐ง",
"time_range": "7 PM โ 10 PM",
"ingredients": [
"300g fettuccine pasta",
"3 cloves garlic",
"1 cup heavy cream",
"ยฝ cup sun-dried tomatoes",
"2 cups spinach",
"Parmesan cheese",
"Olive oil, salt, pepper"
],
"steps": [
"Cook pasta according to package instructions.",
"Sautรฉ garlic in olive oil for 2 minutes.",
"..."
],
"fun_fact": "Italy has over 350 different pasta shapes! ๐ฎ๐น"
}
}
โ๏ธ AWS Services Used
1. ๐ Amazon Lightsail โ Container Service
What it is: Amazon Lightsail is AWS's simplified cloud platform designed for developers who need to deploy apps quickly without managing complex infrastructure. It bundles compute, networking, and storage into simple, predictable monthly pricing.
What we used:
- Lightsail Container Service โ a fully managed environment to run Docker containers
- Power:
nano(512MB RAM, 0.25 vCPU) โ perfect for small apps - Scale: 1 node
- Auto-generated HTTPS public endpoint URL
How it works in this project:
GitHub push โ GitHub Actions builds Docker image
โ Pushes image to Lightsail
โ Creates deployment
โ App is live at HTTPS URL
Lightsail Container Service URL format:
https://<service-name>.<random-id>.<region>.cs.amazonlightsail.com
Pricing:
- Nano plan: ~$7/month
- Billed hourly โ delete when not in use to avoid charges
- Console: https://lightsail.aws.amazon.com/ls/webapp/home/containers
2. ๐ AWS IAM โ Identity and Access Management
What it is: AWS IAM lets you securely control who can access your AWS resources and what actions they can perform. It follows the principle of least privilege โ give only the permissions needed, nothing more.
What we used:
- Created a dedicated IAM user specifically for GitHub Actions
- Attached the
AmazonLightsailFullAccesspolicy - Generated Access Key ID and Secret Access Key for programmatic access
Why not use root account keys?
โ Root account has unlimited access to everything in your AWS account. If leaked, an attacker can delete all your resources, rack up huge bills, or steal data. Always use IAM users with limited permissions.
IAM User Setup Steps:
- Go to IAM Console โ Users โ Create User
- Username:
github-actions-lightsail - Select: "Attach policies directly"
- Attach:
AmazonLightsailFullAccess - Go to user โ Security credentials โ Create access key
- Select: "Application running outside AWS"
- Save the Access Key ID and Secret Access Key โ shown only once!
Console: https://console.aws.amazon.com/iam/home#/users
3. ๐ GitHub Actions โ CI/CD Pipeline
What it is: GitHub Actions is a CI/CD (Continuous Integration / Continuous Deployment) platform built into GitHub. It automatically runs workflows when you push code โ in our case, it builds and deploys the app to Lightsail on every push to main.
What we used:
- Workflow file:
.github/workflows/deploy.yml - Trigger: Push to
mainbranch - Jobs: Build Docker image โ Push to Lightsail โ Deploy โ Print URL
Workflow Steps Explained:
| Step | What it does |
|---|---|
actions/checkout@v4 |
Pulls your code into the runner |
aws-actions/configure-aws-credentials@v4 |
Authenticates with AWS using your secrets |
Install lightsailctl |
Installs the Lightsail CLI plugin for pushing images |
docker build |
Builds your Docker image locally on the runner |
create-container-service |
Creates Lightsail service if it doesn't exist yet |
| Wait loop | Polls until service state is READY or RUNNING |
push-container-image |
Uploads Docker image to Lightsail |
create-container-service-deployment |
Deploys the new image live |
| Print URL | Outputs the live app URL in the logs |
GitHub Secrets Required:
| Secret Name | Description |
|---|---|
AWS_ACCESS_KEY_ID |
IAM user access key |
AWS_SECRET_ACCESS_KEY |
IAM user secret key |
AWS_REGION |
AWS region e.g. us-east-1 |
LIGHTSAIL_SERVICE_NAME |
Your service name e.g. whats-cooking-now |
How to add secrets: GitHub Repo โ Settings โ Secrets and variables โ Actions โ New repository secret
4. ๐ณ Docker โ Containerization
What it is: Docker packages your application and all its dependencies into a container โ a lightweight, portable unit that runs the same way everywhere: your laptop, a teammate's machine, or AWS.
Our Dockerfile explained:
FROM python:3.11-slim # Use lightweight Python 3.11 base image
WORKDIR /app # Set working directory inside container
COPY requirements.txt . # Copy dependencies file first (layer caching)
RUN pip install --no-cache-dir -r requirements.txt # Install dependencies
COPY . . # Copy all project files
EXPOSE 5000 # Tell Docker the app runs on port 5000
CMD ["python", "app.py"] # Command to start the Flask app
Useful Docker commands:
# Build image
docker build -t whats-cooking-now .
# Run container
docker run -p 5000:5000 whats-cooking-now
# Run in background
docker run -d -p 5000:5000 whats-cooking-now
# List running containers
docker ps
# Stop container
docker stop <container-id>
# Remove image
docker rmi whats-cooking-now
๐ง Full Deployment Setup Guide
Step 1 โ Create IAM User
- Open IAM Console
- Create user:
github-actions-lightsail - Attach policy:
AmazonLightsailFullAccess - Create access key โ save both keys
Step 2 โ Add GitHub Secrets
- Go to your GitHub repo โ Settings โ Secrets and variables โ Actions
- Add these 4 secrets:
AWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEYAWS_REGION(e.g.us-east-1)LIGHTSAIL_SERVICE_NAME(e.g.whats-cooking-now)
Step 3 โ Push to GitHub
git init
git add .
git commit -m "Initial commit โ What's Cooking Now"
git branch -M main
git remote add origin https://github.com/Santhosh-p653/aws-lightsail.git
git push -u origin main
Step 4 โ Watch GitHub Actions Deploy
- Go to your repo โ Actions tab
- Watch the workflow run in real time
- When complete, click the last step "Get App URL"
- Copy your live HTTPS URL ๐
Step 5 โ Open Your Live App
https://whats-cooking-now.xxxxxxxx.<region>.cs.amazonlightsail.com
๐งช Testing the API Locally
# Current time recipe
curl http://localhost:5000/api/recipe
# Specific meal
curl http://localhost:5000/api/recipe/dinner
# Pretty print
curl http://localhost:5000/api/recipe | python -m json.tool
# Test invalid (should return 404)
curl -i http://localhost:5000/api/recipe/pizza
๐งน Cleanup Guide
Disable (Pause โ keeps data, stops compute charges)
aws lightsail update-container-service \
--service-name whats-cooking-now \
--is-disabled
Full Delete (Permanent โ cannot be undone)
aws lightsail delete-container-service \
--service-name whats-cooking-now
Or via Console: Lightsail Console โ Click service โ Three dots menu โ Delete
Full Cleanup Checklist
- โ Delete Lightsail container service
- โ
Delete IAM user (
github-actions-lightsail) - โ Remove GitHub repository secrets
- โ Delete any unused Lightsail Static IPs
- โ Delete any Lightsail snapshots
โ ๏ธ Static IPs are billed even when unattached โ always check Lightsail Networking.
๐ Troubleshooting
| Problem | Fix |
|---|---|
| CSS/JS not loading | Make sure paths are /static/style.css and /static/script.js |
404 on /api/recipe |
Flask is not running โ check python app.py |
| Docker build fails | Check requirements.txt exists in root folder |
| GitHub Actions fails at AWS step | Verify all 4 GitHub Secrets are set correctly |
| Lightsail service stuck in PENDING | Wait 2โ3 minutes, it's provisioning for the first time |
| App URL returns 503 | Service is disabled โ re-enable from Lightsail console |
๐ License
MIT License โ free to use, modify, and distribute.
๐ Built With
- Flask โ Python web framework
- Docker โ Containerization
- Amazon Lightsail โ Cloud hosting
- GitHub Actions โ CI/CD automation
- AWS IAM โ Secure access management
๐ก Tip: Star โญ this repo if you found it helpful!
Built With
- css
- dockerfile
- html
- javascript
- python
Log in or sign up for Devpost to join the conversation.