/bolt.new-ai-integrations

Bolt.new AI and Clockify integration: Step-by-Step Guide 2025

Learn how to integrate Bolt.new AI with Clockify using our easy, step-by-step guide. Boost productivity by automating time tracking 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 Bolt.new AI with Clockify?

 

Creating the Clockify Configuration File

 
  • Create a new file in your Bolt.new AI project named clockifyConfig.ts. This file will store your Clockify API key and workspace ID. Since Bolt.new AI does not have a terminal, manually add this file using the file explorer in your project.
  • In clockifyConfig.ts, add the following code snippet. Replace the placeholders with your actual Clockify API key and workspace ID.

export const CLOCKIFYAPIKEY = "YOURCLOCKIFYAPI_KEY";
export const CLOCKIFYWORKSPACEID = "YOURWORKSPACEID";

 

Creating the Clockify Service Integration File

 
  • Create another new file called clockifyService.ts in your project. This file will handle the API interactions with Clockify.
  • Insert the following TypeScript code. It contains functions to get time entries and create a new time entry by calling Clockify’s API. Note that we use the built‐in fetch available in modern environments.

import { CLOCKIFYAPIKEY, CLOCKIFYWORKSPACEID } from "./clockifyConfig";

const BASE_URL = "https://api.clockify.me/api/v1";

const headers = {
  "Content-Type": "application/json",
  "X-Api-Key": CLOCKIFYAPIKEY
};

/**
- Fetch all time entries for a given user.
- Replace 'userId' with the actual Clockify user ID.
 */
export async function getTimeEntries(userId: string) {
  const url = ${BASE_URL}/workspaces/${CLOCKIFY_WORKSPACE_ID}/user/${userId}/time-entries;
  const response = await fetch(url, { headers });
  if (!response.ok) {
    throw new Error("Failed to fetch time entries: " + response.statusText);
  }
  return await response.json();
}

/**
- Create a new time entry.
- Adjust the payload as needed.
 */
export async function createTimeEntry(userId: string, data: any) {
  const url = ${BASE_URL}/workspaces/${CLOCKIFY_WORKSPACE_ID}/user/${userId}/time-entries;
  const response = await fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(data)
  });
  if (!response.ok) {
    throw new Error("Failed to create time entry: " + response.statusText);
  }
  return await response.json();
}

 

Integrating the Clockify Service into Your Bolt.new AI Project

 
  • Identify where in your project you want to initiate Clockify API calls. For example, if you have a main file like index.ts or a specific module handling business logic, open that file.
  • Import the functions from clockifyService.ts and call them when needed. Below is an example snippet that demonstrates calling getTimeEntries and logging the result. Insert this code block into the appropriate module in your project.

import { getTimeEntries, createTimeEntry } from "./clockifyService";

// Replace with the actual Clockify user ID.
const clockifyUserId = "YOURCLOCKIFYUSER_ID";

// Example: Fetch and log time entries for a user.
async function fetchAndLogTimeEntries() {
  try {
    const entries = await getTimeEntries(clockifyUserId);
    console.log("Time Entries:", entries);
  } catch (error) {
    console.error("Error fetching time entries:", error);
  }
}

fetchAndLogTimeEntries();

// Example: Create a new time entry.
// Prepare your payload according to Clockify API documentation.
// Adjust fields such as description, start, and end as required.
async function addTimeEntry() {
  const entryData = {
    description: "Meeting with client",
    start: new Date().toISOString(),
    // You may add an 'end' field if required.
    billable: true
  };

  try {
    const newEntry = await createTimeEntry(clockifyUserId, entryData);
    console.log("Created Time Entry:", newEntry);
  } catch (error) {
    console.error("Error creating time entry:", error);
  }
}

// Uncomment below to test creating a time entry.
// addTimeEntry();

 

Handling Dependencies Without a Terminal

 
  • Since Bolt.new AI does not offer a terminal for installing dependencies, ensure your project’s environment supports the fetch API and TypeScript. Modern browsers and Node environments (if using a bundler) usually include a global fetch implementation.
  • If you encounter issues with fetch in a Node.js environment, consider adding a polyfill by creating a file named polyfills.ts and inserting the following code. Then import it at the very top of your main file (for example, index.ts).

/ polyfills.ts /
import "whatwg-fetch";
  • Since Bolt.new AI cannot run terminal commands, manually add the whatwg-fetch library as an external dependency using your project’s dependency management interface (if available). If such interface isn’t available, verify that the environment already supports fetch.

 

Final Integration Steps

 
  • Review your project structure to ensure the new files (clockifyConfig.ts, clockifyService.ts, and optionally polyfills.ts) are correctly placed.
  • Test your application by triggering the functions you integrated. Use the Bolt.new AI built-in preview or run feature to view console logs.
  • Adjust configuration details like user IDs or payload formats as required by your Clockify account and API specifications.

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