Sign In Sign Up

Single-page UI for library discovery API

There is an OpenAPI spec in @libdb-backend-api.yaml describing an API for discovering libraries for various topics for multiple programming languages. The idea is that you select a topic, and then initiate a discovery. The discovery will find libraries, and add them to the topic, and also create new topics related to these libraries. For each library, some detailed information is going to be available. The newly created topics can be also discovered to find more libraries, and so on, building a large graph of topics and libraries. I want to have a simple user interface on top of this API, single HTML file with embedded JS, with no dependencies or build steps. Expose all information and actions the API provides on this UI. Assume that the API is deployed to localhost:9006

The user wants me to create a simple HTML file with embedded JavaScript to interact with the libdb-backend-api. Let me understand the API:

  1. GET /libdb-backend-api/libs - returns all libraries
  2. GET /libdb-backend-api/libs/{language}/{name} - gets details of a specific library
  3. GET /libdb-backend-api/topics - returns all topics
  4. GET /libdb-backend-api/topics/{name} - gets libraries for a specific topic
  5. POST /libdb-backend-api/topics/{name}/discover-libraries - discovers new libraries for a topic

The UI should:

  • Display all libraries
  • Display library details
  • Display all topics
  • Display libraries for a topic
  • Allow discovering new libraries for a topic
  • Be a single HTML file with embedded JS
  • No dependencies or build steps
  • API is at localhost:9006

I'll create a clean, functional UI with:

  • A header
  • Navigation between views (Libraries, Topics)
  • Ability to search/filter topics
  • Ability to trigger discovery
  • Display of results
  • Simple CSS styling

Let me create a comprehensive single HTML file.

Created a single-file HTML UI with embedded JavaScript that exposes all API functionality:

Features:

  • Libraries tab: Browse all libraries, search by name/language, view detailed information (description, repository, related topics)
  • Topics tab: Browse all topics, search, view libraries for each topic, trigger discovery
  • Discover tab: Search for a topic and initiate library discovery
  • Clean, modern interface with gradient styling and responsive design
  • No external dependencies or build steps
  • Auto-loads libraries on startup and reloads topics after discovery

Open /Users/vigoo/projects/golem/agent-examples-root/lib-db/index.html in your browser with the API running on localhost:9006.

Add a refresh button to both the Libraries and Topics page, so if new discoveries added new entities, we can easily refresh the list.

The user wants me to add refresh buttons to the Libraries and Topics pages so users can reload the lists without navigating away. This is a simple addition - I need to add buttons in the search boxes for both sections and also add functions to refresh those lists.

I'll add refresh buttons next to the search buttons for both sections.

Done. Added refresh buttons (🔄) to both Libraries and Topics tabs that reload the lists from the API and clear any active searches.

When I open a topic in the topic list, and click on one particular library, I want it to jump to the Libraries page (refresh the list if needed), focus on that library and open its details

The user wants to add functionality where when they click on a library from the topic view, it:

  1. Jumps to the Libraries page
  2. Refreshes the list if needed
  3. Focuses/scrolls to that library
  4. Opens its details

I need to:

  1. Modify the library rendering in topics to have clickable libraries that trigger a new function
  2. Create a function that navigates to libraries tab, loads/filters, scrolls to that library, and opens its details
  3. The current renderTopics shows libraries as topic tags in a details panel - I need to make those clickable

Let me look at where libraries are displayed in topics:

container.innerHTML = `
    <div class="details-panel">
        <h4>Libraries (${data.libraries.length})</h4>
        <div class="topics-list">
            ${data.libraries.map(lib => `
                <span class="topic-tag">${lib.name} <span class="badge">${lib.language}</span></span>
            `).join('')}
        </div>
    </div>
`;

I need to make these libraries clickable and add a function to jump to the library.

+1
-1
~1