Skip to content
/ timeoff Public

An intelligent web application that helps you maximize your time off by strategically planning annual leave around public holidays. Using AI, it generates optimized leave schedules tailored to your location and preferences.

License

Notifications You must be signed in to change notification settings

Zeb88/timeoff

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Jan 21, 2025
3b6578c Β· Jan 21, 2025

History

22 Commits
Jan 21, 2025
Dec 9, 2024
Dec 10, 2024
Dec 10, 2024
Dec 9, 2024
Jan 21, 2025
Jan 21, 2025
Dec 9, 2024
Dec 10, 2024
Dec 10, 2024
Dec 10, 2024

Repository files navigation

Leave Optimizer AI

An intelligent web application that helps you maximize your time off by strategically planning annual leave around public holidays. Using AI, it generates optimized leave schedules tailored to your location and preferences.

Features

  • 🌍 Support for multiple countries and regions
  • πŸ€– AI-powered leave optimization
  • πŸ“… Strategic holiday planning
  • πŸ–οΈ Vacation activity suggestions
  • ⚑ Fast response with caching
  • πŸ“± Mobile-friendly interface

Live Demo

Visit https://timeoffai.com/ to try the application.

Self-Hosting Guide

Prerequisites

  • Node.js (v18 or higher)
  • npm (Node Package Manager)
  • A Perplexity AI API key (Get one here)

Installation

  1. Clone the repository:
git clone https://github.com/Zeb88/timeoff.git
cd timeoff
  1. Install dependencies:
npm install
  1. Create a .env file in the root directory:
PERPLEXITY_API_KEY=your_api_key_here
  1. Start the server:
node server.js
  1. Access the application at http://localhost:3000

Docker Installation

# Using docker-compose (recommended)
docker-compose up -d

# Or using Docker directly
docker build -t timeoff .
docker run -p 3000:3000 -e PERPLEXITY_API_KEY=your_api_key_here timeoff

API Documentation

Optimize Leave Plan

POST /optimize-leave
Content-Type: application/json

{
    "country": "Australia",
    "state": "New South Wales",
    "year": 2024
}

Response

Returns a markdown-formatted string containing:

  • Summary of the optimization strategy
  • Detailed breakdown of leave periods
  • Public holiday information
  • Activity recommendations

Configuration

The application can be configured through environment variables:

Variable Default Description
PORT 3000 Server port
PERPLEXITY_API_KEY required Your Perplexity AI API key
RATE_LIMIT_WINDOW 3600000 Rate limit window in ms
RATE_LIMIT_MAX 1000 Max requests per window
CACHE_TTL 2629800000 Cache duration in ms

See .env.example for a template of all available configuration options.

Getting Started

  1. Copy .env.example to .env:
cp .env.example .env
  1. Edit .env and add your Perplexity AI API key:
PERPLEXITY_API_KEY=your_api_key_here
  1. Start the application using either Docker or Node.js as described in the installation sections above.

Technical Stack

  • Frontend: HTML, Alpine.js, Tailwind CSS
  • Backend: Node.js, Express
  • AI: Perplexity AI API
  • Caching: node-persist
  • Rate Limiting: express-rate-limit

Development

Project Structure

β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ index.html
β”‚   β”œβ”€β”€ script.js
β”‚   └── styles.css
β”œβ”€β”€ server.js
β”œβ”€β”€ package.json
└── README.md

Running Tests

npm test

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Security

  • Rate limiting prevents API abuse
  • Environment variables protect sensitive data
  • Regular dependency updates
  • Input validation and sanitization

Performance

  • Response caching improves speed
  • Optimized AI prompt generation
  • Efficient state management
  • Minimal dependencies

Support

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

An intelligent web application that helps you maximize your time off by strategically planning annual leave around public holidays. Using AI, it generates optimized leave schedules tailored to your location and preferences.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published