API Maker
The backend engine for the AI era
Case study 02 · Automatic indexing
KartWise runs a marketplace for 6,000 home and kitchen sellers. Its orders collection had grown to 48 million documents, and every big sale slowed the seller dashboard to a crawl. Nobody had the time to find which queries needed an index. With the automatic mode of Index Maker, API Maker found them, created them and shipped them to every environment by itself.
The challenge
KartWise moved its seller APIs to API Maker in 2024, for the generated APIs and the caching. The backend held up well. The database did not. Each new feature of the seller dashboard brought a new filter: by status and date, by pincode, by return reason, by payout batch. Each filter was a new query shape, on a collection that grew by 90,000 orders a day.
Before the Diwali sale of 2025 the team spent two days reading slow query logs and added six indexes by hand. On the first night of the sale the dashboard still froze. The query that hurt most filtered returns by seller and reason. Nobody had looked at it: an intern had written it three weeks before, for a report.
The lesson was clear. The question was not which index to add. It was who keeps watching the queries, every week, forever.
The solution
KartWise was already on API Maker, so Index Maker was one setting away. It records the queries of the APIs, grouped by the shape of their condition, and asks MongoDB with explain whether each one uses an index. The team switched on the automatic mode in November 2025, two weeks before the year-end sale.
A scanning period starts every six hours and records for thirty minutes. Nothing is added to the requests: the recording runs beside them.
Index MakerWhen a period ends, each query shape runs through explain with a recorded sample: full index, part of one, or none.
An index is made only for slow or frequent shapes on tables over 100,000 rows, and never past 12 indexes on one collection. Every decision is kept with its reason.
Each index goes into the migration script am_index_maker. Staging and production run it on their next deploy, so every environment has the same indexes.
Database MigrationsWhen a developer adds a new filter, the next period sees its shape. The index often exists before the feature reaches production.
Git DeploymentThe numbers
Measured by the API logs of API Maker, one week before and one week after.
The year-end sale had 18% more orders than Diwali.
The results
We used to spend two days before every sale hunting slow queries. Now I open Index Maker, read what it decided and why, and go back to building features.
What comes next. KartWise is turning on Index Maker for its PostgreSQL database of seller payouts, where the automatic mode builds indexes concurrently, without locking the table.
Try API Maker on your own computer for free, or tell us about your project.