Skip to content

amanoxsolutions/serverless-coffeetracker

Repository files navigation

Serverless Coffee Tracker

A modern, serverless solution to transparently track and analyze coffee consumption in your team, fully integrated with Microsoft Teams and built on AWS using Infrastructure as Code (Terraform).


🚀 Overview

This project demonstrates how everyday challenges—like monitoring caffeine intake—can be solved with cloud-native technologies. The Coffee Tracker leverages AWS Lambda, API Gateway, DynamoDB, and SNS to record, analyze, and notify about coffee consumption events, all triggered directly from Microsoft Teams.


🛠️ Architecture

  • API Gateway: Provides REST endpoints for tracking and retrieving coffee entries.
  • AWS Lambda (Python 3.13):
    • track_coffee.py: Validates and stores entries, triggers SNS notifications.
    • get_user_entries.py: Retrieves a user's coffee history.
    • notify_teams.py: Sends notifications as Adaptive Cards to Microsoft Teams.
    • logging_utils.py: Structured logging for CloudWatch.
  • DynamoDB:
    • Stores coffee entries.
    • Deduplication table for Teams notifications.
  • SNS: Event-driven notifications between components.
  • IAM & CloudWatch: Secure, monitor, and log all activities.
  • Terraform: Declarative, automated provisioning of all resources.

⚙️ Getting Started

1. Clone the Repository

git clone <your-repo-url>
cd coffee-tracker

2. Initialize and Apply Terraform

terraform init
terraform apply

Terraform will provision all AWS resources in your account.

3. Use the API Endpoint

After deployment, Terraform will output your API endpoint. You can now:

  • Track coffee entries directly from Microsoft Teams (or via curl for testing).
  • Retrieve user consumption history.

4. Receive Notifications

When the defined caffeine limit is exceeded, a notification is automatically sent to Microsoft Teams via SNS and Lambda.


📦 Example DynamoDB Entry

{
  "userId": "employee1",
  "timestamp": "2025-09-12T10:15:00Z",
  "type": "espresso",
  "amount": 2
}

📝 Extensibility

  • Add authentication and rate limiting for production use.
  • Integrate with dashboards (e.g., AWS QuickSight).
  • Extend notification logic or add new integrations.

⚠️ Disclaimer

This project is for demonstration purposes only.

To keep the solution simple, important security aspects such as authentication, authorization, and API rate limiting are not implemented. If you plan to use this in production, ensure you protect your API Gateways and all components according to AWS security best practices.
For a non-binding demo or individual consultation, feel free to contact us.


📄 License

This project is licensed under the MIT License.

About

A serverless coffee tracker based on AWS with Microsoft Teams integration

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published