/lovable-integrations

Lovable and Time Doctor integration: Step-by-Step Guide 2025

Learn how to seamlessly integrate Lovable with Time Doctor. Our step-by-step guide simplifies time tracking and boosts productivity for your team.

Matt Graham, CEO of Rapid Developers

Book a call with an Expert

Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.

Book a free No-Code consultation

How to integrate Lovable with Time Doctor?

 

Integrating Time Doctor in Your Lovable Project - Overview

 

This guide will walk you through integrating Time Doctor functionality into your Lovable project using TypeScript. Follow each step carefully and insert or create the indicated files and code snippets exactly as shown.

 

Step: Adding Axios Dependency via Code Injection

 

Since Lovable does not have a terminal to install dependencies, we will load Axios from a CDN. Open your main HTML file (usually named index.html) in your project and add the following script tag before your main application script:




 

Step: Creating the Time Doctor Integration File

 

Within your project’s file explorer, create a new folder named "integrations". Inside this folder, create a new file called timeDoctor.ts. Copy and paste the following code snippet into that file. This code defines functions to start and stop timers via the Time Doctor API:


// File: integrations/timeDoctor.ts

// We are assuming axios is available as a global variable since it was added via a CDN in index.html.
// If not available globally, you may need to adjust your configuration to support module imports.

const APIKEY: string = 'YOURTIMEDOCTORAPIKEY';  // Replace with your actual Time Doctor API key.
const API_ENDPOINT: string = 'https://webapi.timedoctor.com/v2.0/';  // Replace or adjust endpoint as needed.

export async function startTimer(taskId: string): Promise {
  try {
    const response = await axios.post(${API_ENDPOINT}start, {
      taskId: taskId,
      apiKey: API_KEY
    });
    return response.data;
  } catch (error) {
    console.error('Error starting timer:', error);
    throw error;
  }
}

export async function stopTimer(timerId: string): Promise {
  try {
    const response = await axios.post(${API_ENDPOINT}stop, {
      timerId: timerId,
      apiKey: API_KEY
    });
    return response.data;
  } catch (error) {
    console.error('Error stopping timer:', error);
    throw error;
  }
}

 

Step: Integrating Time Doctor Methods in the Main Application Code

 

Open the main TypeScript file of your Lovable project (for example, app.ts or main.ts). At the top of this file, import the functions you defined in timeDoctor.ts. Then, use these functions in appropriate event handlers where you want to start or stop the Time Doctor timer (for instance, when a task starts or stops). Insert the following code snippet into your main application file:


// In your main application file, e.g., app.ts or main.ts

import { startTimer, stopTimer } from './integrations/timeDoctor';

// Example function to be called when a task starts.
function onTaskStart(taskId: string) {
  startTimer(taskId)
    .then(data => {
      console.log('Timer started successfully:', data);
    })
    .catch(err => {
      console.error('Failed to start timer:', err);
    });
}

// Example function to be called when a task stops.
function onTaskStop(timerId: string) {
  stopTimer(timerId)
    .then(data => {
      console.log('Timer stopped successfully:', data);
    })
    .catch(err => {
      console.error('Failed to stop timer:', err);
    });
}

// These function calls should be integrated with your Lovable project logic where tasks are started and stopped.
// For example, you might call onTaskStart(taskId) when a user begins a task, and onTaskStop(timerId) when the task ends.

 

Step: Testing and Verifying Integration

 

After adding the above code, follow these guidelines to test your integration:

  • Ensure you have replaced 'YOURTIMEDOCTORAPI_KEY' with your actual API key from Time Doctor.
  • Verify the API endpoints are correct according to your Time Doctor account documentation.
  • Trigger the onTaskStart and onTaskStop functions through your Lovable project’s user interface whenever a task is started or stopped.
  • Check your browser’s console for logs to confirm that the timer has been started or stopped without errors.

 

Step: Finalizing the Integration

 

Once you confirm that the timer functions are working as expected, ensure the following in your Lovable project:

  • All changes in index.html, integrations/timeDoctor.ts, and your main application file are saved.
  • Your project correctly references the CDN version of Axios.
  • You handle any errors or exceptions appropriately in your application logic.

 

By following these steps, you have successfully integrated Time Doctor into your Lovable project using TypeScript without the need for a separate terminal installation.

Want to explore opportunities to work with us?

Connect with our team to unlock the full potential of no-code solutions with a no-commitment consultation!

Book a Free Consultation

Client trust and success are our top priorities

When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.

Rapid Dev was an exceptional project management organization and the best development collaborators I've had the pleasure of working with. They do complex work on extremely fast timelines and effectively manage the testing and pre-launch process to deliver the best possible product. I'm extremely impressed with their execution ability.

CPO, Praction - Arkady Sokolov

May 2, 2023

Working with Matt was comparable to having another co-founder on the team, but without the commitment or cost. He has a strategic mindset and willing to change the scope of the project in real time based on the needs of the client. A true strategic thought partner!

Co-Founder, Arc - Donald Muir

Dec 27, 2022

Rapid Dev are 10/10, excellent communicators - the best I've ever encountered in the tech dev space. They always go the extra mile, they genuinely care, they respond quickly, they're flexible, adaptable and their enthusiasm is amazing.

Co-CEO, Grantify - Mat Westergreen-Thorne

Oct 15, 2022

Rapid Dev is an excellent developer for no-code and low-code solutions.
We’ve had great success since launching the platform in November 2023. In a few months, we’ve gained over 1,000 new active users. We’ve also secured several dozen bookings on the platform and seen about 70% new user month-over-month growth since the launch.

Co-Founder, Church Real Estate Marketplace - Emmanuel Brown

May 1, 2024 

Matt’s dedication to executing our vision and his commitment to the project deadline were impressive. 
This was such a specific project, and Matt really delivered. We worked with a really fast turnaround, and he always delivered. The site was a perfect prop for us!

Production Manager, Media Production Company - Samantha Fekete

Sep 23, 2022