How I created the JigsawStack Optimizer tool

September 4, 2024

TL;DR

Alt text for the image

JigsawStack is a unified API platform that simplifies API management for developers. It provides a single interface to interact with multiple APIs, reducing the complexity of integrating various services into your projects. With JigsawStack, you can streamline your API calls, manage authentication, and handle data transformation all in one place.

While exploring the platform, I noticed a gap in the onboarding process related to identifying APIs in a codebase. I realized this could be an opportunity to help developers better understand how the platform fits into their projects and how JigsawStack could save them money. This led me to create my new tool: the JigsawStack Optimizer.

The JigsawStack Optimizer is a Python-based tool that analyzes a single GitHub repository and generates a report on potential JigsawStack integrations. It examines a specified GitHub repo, identifies existing API calls in the codebase, and produces a detailed report of integration possibilities.

The core of the Optimizer lies in its API call identification process. It uses Python's abstract syntax tree (AST) module to parse the code in each file of the repository. This approach allows for a more robust analysis compared to simple regex matching.

When parsing the AST, the tool looks for function calls that match common API request patterns. It specifically targets functions like get(), post(), and similar methods commonly used for API requests. The tool also searches for URL strings within the code that match known API endpoint patterns.

I built this tool using Python 3.8+, leveraging the requests library for GitHub API interaction, the ast module for Python code parsing, and argparse for the command-line interface. Python was ideal for this project due to its rich ecosystem for code analysis and API integration, readability, and cross-platform compatibility.

The JigsawStack Optimizer is open-source and available on GitHub. Here's how to get started:

  1. Clone the repository
  2. Install the required dependencies
  3. Run the tool on your chosen GitHub repository
  4. Review the generated report for potential API integrations

Alt text for the image

JigsawStack Optimizer on GitHub

This tool aims to show you potential areas for API integration in your projects. Give it a try with one of your repos and see what insights you get.

Let me know what you think of this tool in the comments. I appreciate your feedback.

Initially published on Bea's Hashnode blog