Using a Config File
Create a configuration file and pass it with the--config flag:
Configuration Format
Create a JSON file with your app configuration:config.json
Configuration Options
Required Options
The name of your applicationExample:
"my-search-app"The InstantSearch template to useOptions:
"InstantSearch.js", "React InstantSearch", "Vue InstantSearch", etc.See Templates for full listLibrary Configuration
Specific version of the InstantSearch libraryExample:
"4.0.0"If omitted, you’ll be prompted to select a versionAlgolia Connection
Your Algolia application IDDefault:
"latency" (demo app)Your Algolia search API key (public, search-only)Default:
"6be0576ff61c053d5f9a3225e2a90f76" (demo key)The name of your Algolia indexDefault:
"instant_search"Search UI Configuration
Placeholder text for the search boxDefault:
"Search"Array of attribute names to show in search resultsExample:
["name", "description", "price"]Attribute name containing image URLs for result thumbnailsExample:
"image_url"Array of attributes to use as filtersExample:
["brand", "category", "color"]Use "ais.dynamicWidgets" to enable dynamic widgets (auto-generated filters)Advanced Options
Enable Algolia Insights for event trackingDefault:
falseRequires InstantSearch.js >= 4.55, React InstantSearch >= 7.0, or Vue InstantSearch >= 4.9.0Type of search input to useOptions:
"autocomplete" or "searchbox"Only available for InstantSearch.js >= 4.52Index name for Query Suggestions (required when using autocomplete)Example:
"products_query_suggestions"Version of Autocomplete.js to use (when searchInputType is “autocomplete”)Example:
"1.11.0"Configuration Examples
React App with Insights
Vue App with Dynamic Widgets
InstantSearch.js with Autocomplete
Widget Development
Programmatic API
You can also usecreate-instantsearch-app programmatically:
Best Practices
Use version control
Store configuration files in your repository to ensure consistent app generation across teams
Separate configs for environments
Create different config files for development, staging, and production
Start with demo credentials
Use Algolia’s demo app (
latency) to test templates before connecting your own indexUse semantic versioning
Pin library versions in config files to ensure reproducible builds
Troubleshooting
Config file not found
Config file not found
Ensure the path to your config file is correct. Use absolute paths or paths relative to your current directory.
Invalid JSON format
Invalid JSON format
Validate your JSON using a linter or online validator. Common issues:
- Trailing commas
- Missing quotes around strings
- Invalid escape characters
Unsupported template version
Unsupported template version
Check the supported version range for your chosen template in the Templates documentation.