No description
Find a file
hhftechnologies c8f5379289 update
2024-11-25 23:16:17 +05:30
backend update 2024-11-25 23:16:17 +05:30
frontend update 2024-11-25 23:16:17 +05:30
static update 2024-11-25 23:16:17 +05:30
docker-compose.yaml update 2024-11-25 23:16:17 +05:30
Dockerfile update 2024-11-25 23:16:17 +05:30
LICENSE update 2024-11-25 23:16:17 +05:30
README.md Add README.md 2024-11-25 23:02:39 +05:30
requirements.txt update 2024-11-25 23:16:17 +05:30

TimeTracker App

The TimeTracker App is a simple web-based tool designed to help users track their working hours by clocking in and clocking out. It also allows users to view their hours worked over specific time periods (week, pay period, or month), and offers functionality for user creation and deletion. Its built with FastAPI for the backend and Alpine.js for the frontend, supporting dark mode and responsive design.

Demo Page

Demo Page

Features

  • User Creation: If a user does not exist, a modal prompts to create a new user.
  • Clock In/Out: Users can clock in and out with a simple button click, and their time entries are recorded.
  • View Time Data: Users can view their time data by week, pay period, or month.
  • Delete Entries: Users can delete today's clock-in and clock-out entry.
  • Dark Mode: Toggle dark mode for better readability in low light conditions.
  • Export Data: Users can export their time entries in CSV format.
  • Admin Panel: Admin functionality to manage users and view their time entries.

Technologies

  • Backend: FastAPI
  • Frontend: Alpine.js, HTML5, CSS3
  • Database: SQLite (via SQLAlchemy ORM)
  • Styling: Custom styles with support for dark mode
  • Deployment: Docker

Getting Started

Prerequisites

Make sure you have the following tools installed on your system:

  • Python 3.12+
  • FastAPI and its dependencies (SQLAlchemy, bcrypt, etc.)
  • Docker (for containerization, optional)

Installation

  1. Clone the repository:

    git clone https://git.hhf.technology/hhf/timetracker.git
    cd timetracker
    
  2. Install Python dependencies:

pip install -r requirements.txt
  1. Set up environment variables for the admin user: Create a .env file in the root of the project and define the following variables:
    ADMIN_USERNAME=admin
    ADMIN_PASSWORD=your_password_here
    

Running the Application

  1. Run the FastAPI server:

    uvicorn backend.main:app --reload --host 0.0.0.0 --port 8000
    

    The app will be accessible at http://localhost:8000.

  2. Open the frontend by navigating to http://localhost:8000 in your browser.

Using Docker (Optional)

You can also run the app in a Docker container. Follow these steps:

  1. Build the Docker image:
    docker build -t timetracker .
    
  2. Run the Docker container:
    docker run -p 8000:8000 timetracker
    

Endpoints

  • /: Main web interface.

  • /edit: Interface to Edit Times.

  • /docs: Docs page.

  • /user/create (POST): Create a new user.

  • /user/status/{user} (GET): Check the users current status (clocked in/out).

  • /time/{user}/in (POST): Clock in the user.

  • /time/{user}/out (POST): Clock out the user.

  • /time/{user}/recall/{period} (GET): Get time data for a specific period (week, pay period, or month).

  • /time/{user}/today (DELETE): Delete todays clock-in and clock-out times.

Frontend Functionality

  • Dark Mode Toggle: Click the Toggle Dark Mode button to switch between light and dark modes.
  • Clock In/Out: Click the Clock In or Clock Out button to record your time.
  • User Creation: If the user doesnt exist, youll be prompted with a modal to create a new user.
  • View Time Data: Use the Week, Payperiod, and Month buttons to fetch your time data.
  • Export Data: Export time entries to CSV by clicking the Export Data button.

Acknowledgements

  • Built using FastAPI for the backend.
  • Alpine.js for a lightweight frontend framework.