Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Droniu/zodiakara

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zodiakara - Daily Horoscope API

A serverless API that generates daily horoscopes using OpenAI's 4o-mini model. Built with AWS Lambda and DynamoDB, supporting both English and Polish languages.

Features

  • Daily horoscope generation for all zodiac signs
  • Support for English and Polish languages
  • Serverless architecture using AWS Lambda
  • DynamoDB for data storage
  • OpenAI integration
  • CORS enabled
  • TypeScript for type safety

Prerequisites

  • Node.js (v18 or higher)
  • AWS Account
  • AWS CLI configured
  • OpenAI API key
  • Serverless Framework CLI

Setup

  1. Clone the repository:
git clone <repository-url>
cd zodiakara
  1. Install dependencies:
npm install
  1. Configure AWS credentials:
aws configure
  1. Set up environment variables:
export OPENAI_API_KEY="your-api-key-here"

Development

To build the project:

npm run build

Deployment

To deploy to AWS Lambda:

  1. Deploy to development stage:
npm run deploy
  1. Deploy to production stage:
npm run deploy:prod

The deployment will create:

  • DynamoDB table
  • Two Lambda functions
  • API Gateway endpoints
  • Required IAM roles and permissions

API Endpoints

Get All Horoscopes

GET /horoscopes/all?lang=en|pl

Returns all horoscopes for the current day in the specified language (defaults to English if not specified).

Get Horoscope by Sign

GET /horoscopes/{sign}?lang=en|pl

Returns the horoscope for a specific zodiac sign in the specified language (defaults to English if not specified).

Available signs:

  • aries
  • taurus
  • gemini
  • cancer
  • leo
  • virgo
  • libra
  • scorpio
  • sagittarius
  • capricorn
  • aquarius
  • pisces

Language Support

The API supports two languages:

  • English (en) - default
  • Polish (pl)

To get horoscopes in Polish, add ?lang=pl to the URL. For English, either omit the parameter or use ?lang=en.

Cost Analysis

This setup can be completely free within AWS Free Tier limits:

  1. Lambda:

    • 1 million free requests/month
    • 400,000 GB-seconds of compute time/month
    • More than enough for this use case
  2. DynamoDB:

    • 25 GB storage
    • 25 Write Capacity Units (WCUs)
    • 25 Read Capacity Units (RCUs)
    • Sufficient for storing daily horoscopes
  3. API Gateway:

    • 1 million free requests/month
    • More than enough for this use case

The only cost you'll incur is from OpenAI API usage.

Monitoring

You can monitor your Lambda functions and DynamoDB usage through the AWS Console:

  • Lambda: CloudWatch Logs and Metrics
  • DynamoDB: CloudWatch Metrics
  • API Gateway: CloudWatch Logs

License

ISC

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published