| name | algolia-local-dev-loop |
| description | Configure Algolia local development with separate dev index, mocking, and testing.
Use when setting up a development environment, configuring test workflows,
or establishing a fast iteration cycle with Algolia.
Trigger: "algolia dev setup", "algolia local development", "algolia dev environment", "test algolia locally".
|
| allowed-tools | Read, Write, Edit, Bash(npm:*), Bash(pnpm:*), Bash(npx:*), Grep |
| version | 1.6.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","search","algolia"] |
| compatibility | Designed for Claude Code |
Algolia Local Dev Loop
Overview
Set up a fast, reproducible local development workflow for Algolia. Use separate dev indices, mock the client in tests, and iterate without touching production data.
Prerequisites
- Completed
algolia-install-auth setup
- Node.js 18+ with npm/pnpm
- Vitest or Jest for testing
Instructions
Step 1: Environment-Based Index Names
import { algoliasearch } from 'algoliasearch';
const ENV = process.env.NODE_ENV || 'development';
export function indexName(base: string): string {
if (ENV === 'production') return base;
return `${ENV}_${base}`;
}
export const client = algoliasearch(
process.env.ALGOLIA_APP_ID!,
process.env.ALGOLIA_ADMIN_KEY!
);
Step 2: Seed Script for Dev Data
import { client, indexName } from '../src/algolia/config';
const SEED_DATA = [
{ : , : , : , : },
{ : , : , : , : },
{ : , : , : , : },
];
() {
idx = ();
{ taskID } = client.({
: idx,
: ,
});
client.({ : idx, taskID });
client.({
: idx,
: {
: [, ],
: [, ],
: [],
},
});
.();
}
().(.);