Skip to content

asyrafjamil/coincompanion

Repository files navigation

🚀 CoinCompanion

CoinCompanion is a serverless cryptocurrency API that delivers real-time prices, price history tracking, and email-based summaries. All powered by AWS Lambda, API Gateway, DynamoDB, and SES.


🏗️ System Architecture

CoinCompanion Architecture Diagram

  1. API Gateway: Exposes public and internal endpoints.
  2. Lambda Functions: Handle price querying, history recording, and email sending.
  3. DynamoDB: Stores per-user historical price queries.
  4. SES (Simple Email Service): Sends summary emails to users.

📡 API Endpoints

🔹 GET /price

Fetches real-time price of a cryptocurrency and triggers a summary email.

Endpoint URL: https://wqxzfk7834.execute-api.ap-southeast-2.amazonaws.com/prod/price

Query Parameters:

  • email (required): Your email address

  • coin (required): Coin ID (e.g., bitcoin, ethereum)

    Please refer to the list of supported coin IDs here.

Expected Outcome:

  • First-time Query:
    If there is not enough data (i.e., less than 2 data points for the queried coin), the email will indicate:
    "Not enough data to generate insights."

  • Subsequent Queries:
    After having more than 2 data points, the email will include analytics insights such as:

    • Up: If the coin's value has increased compared to the previous data point.
    • Down: If the coin's value has decreased compared to the previous data point.
    • No Change: If the coin's value has remained the same as the previous data point.

This way, you'll be able to receive insights once there's enough data to generate meaningful analysis.

Example:

curl "https://wqxzfk7834.execute-api.ap-southeast-2.amazonaws.com/prod/price?email=asyraf@example.com&coin=bitcoin"

✉️ Email Output

After calling /price, an email will be sent via SES with:

  • Queried coin and current price
  • Timestamp
  • Analytics insights based on your preferred coins, providing a detailed view of the coins' recent performance.
  • Friendly, branded layout

Please note that since SES is currently in sandbox mode, the email may end up in your spam folder. To ensure smooth delivery, please let me know your email address so I can configure it in SES to whitelist your account and ensure you receive the email properly.

Example Email Outputs:

🆕 First-Time Query:

Email Output Sample
Example of the email when the coin is queried for the first time. Analytics are not available yet due to insufficient data.


📈 When the Price is Going Up:

Email Output Sample
Example of the email when the price is increasing, showing a positive trend.


📉 When the Price is Dropping or Showing No Major Change:

Email Output Sample
Example of the email when the price is either dropping or there are no significant changes in the market.


🧪 Local Testing

You can test locally using AWS SAM CLI.

sam local invoke "GetCryptoPriceFunction" --event events/queryCryptoPriceSample.json

Place test events in the events/ folder.


🛠️ Tech Stack

  • Runtime: Node.js (AWS Lambda)
  • Infrastructure as Code: AWS SAM
  • Database: AWS DynamoDB
  • CI/CD: GitHub Actions
  • Email Service: AWS SES

🚀 What's Next: The Future of CoinCompanion

We're just getting started, and there's a lot more on the horizon! Here’s a sneak peek into the groundbreaking features we’re planning:

  • Automated Scheduler:
    CoinCompanion will soon include a scheduler that fetches cryptocurrency data automatically at dynamic intervals based on the CoinGecko API’s frequency. This ensures you stay updated with minimal effort, making your experience seamless and hands-off.

  • Enhanced API Security:
    To ensure your data remains safe and sound, we’re ramping up security for the API Gateway. Expect:

    • Rate Limiting: To prevent abuse and maintain system stability, we’ll be introducing rate limits on API calls.
    • Token-based Authentication: For internal API calls, we’ll require secure tokens, ensuring that only authorized requests can access sensitive data and features.
  • Smart Pagination for Scalability & Insight:
    I am also working on implementing pagination to support viewing the full crypto history.

    Initially, I wanted to deliver the entire history at once, but I quickly realized the scalability trade-offs that come with loading everything in bulk. Instead of compromising performance, I am designing a service that balances completeness with efficiency.

    This includes:

    • Organizing records intelligently (e.g. by email + timestamp)
    • Leveraging DynamoDB’s query flexibility
    • Making sure the UX feels infinite and responsive, no matter how large your portfolio grows

    You’ll be able to explore your entire history, one scroll at a time, without the system breaking a sweat.


🧠 Engineered by Asyraf

About

Your serverless crypto sidekick. Delivers real-time cryptocurrency prices via email and keeps track of your search history. Powered by AWS Lambda, CoinGecko, DynamoDB, and SES.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors