create-instantsearch-app
create-instantsearch-app copied to clipboard
⚡️ Build InstantSearch apps at the speed of thought
Create InstantSearch App
⚡️ Build InstantSearch apps at the speed of thought.
create-instantsearch-app
is a command line utility that helps you quick start your InstantSearch app using any Algolia InstantSearch flavor (InstantSearch.js, React InstantSearch, Vue InstantSearch, Angular InstantSearch, InstantSearch iOS and InstantSearch Android).
Contents
- Get started
- Usage
- API
- Tutorials
- Previews
- License
Get started
The tool requires Node ≥ 8.
npx create-instantsearch-app my-app
cd my-app
npm start
npx
is a tool introduced in[email protected]
that makes it possible to run CLI tools hosted on the npm registry.
Alternatively, you can use Yarn:
yarn create instantsearch-app my-app
cd my-app
yarn start
Usage
This package comes with the module createInstantSearchApp(path, options?)
and the command-line tool create-instantsearch-app
.
$ create-instantsearch-app --help
Usage: create-instantsearch-app <project-directory> [options]
Options:
-v, --version output the version number
--name <name> The name of the application
--app-id <appId> The application ID
--api-key <apiKey> The Algolia search API key
--index-name <indexName> The main index of your search
--attributes-to-display <attributesToDisplay> The attributes of your index to display
--attributes-for-faceting <attributesForFaceting> The attributes for faceting
--template <template> The InstantSearch template to use
--library-version <libraryVersion> The version of the library
--config <config> The configuration file to get the options from
--no-installation Ignore dependency installation
--no-interactive Do not ask any interactive questions
-h, --help output usage information
--template
Supported templates are:
-
InstantSearch.js
-
React InstantSearch
-
React InstantSearch Native
-
Vue InstantSearch
-
Angular InstantSearch
-
InstantSearch iOS
-
InstantSearch Android
create-instantsearch-app my-app --template "React InstantSearch"
You can also create your own template and specify its path.
--config
The config
flag is handy to automate app generations.
config.json
{
"name": "my-app",
"template": "InstantSearch.js",
"libraryVersion": "2.8.0",
"appId": "MY_APP_ID",
"apiKey": "MY_API_KEY",
"indexName": "MY_INDEX_NAME",
"searchPlaceholder": "Search",
"attributesToDisplay": ["name", "description"],
"attributesForFaceting": ["brand", "location"]
}
Create the app based on this configuration:
create-instantsearch-app my-app --config config.json
API
create-instantsearch-app
is based on the module createInstantSearchApp(path, options?)
. The same camel cased options as the CLI are available.
const createInstantSearchApp = require('create-instantsearch-app');
const app = createInstantSearchApp('~/lab/my-app', {
template: 'InstantSearch.js',
libraryVersion: '2.0.0',
attributesToDisplay: ['name', 'description'],
attributesForFaceting: ['keywords'],
});
app.create().then(() => console.log('App generated!'));
Tutorials
- Creating a custom template
- Deploying an InstantSearch App
Previews
You can use the web templates on CodeSandbox:
- InstantSearch.js 3
- InstantSearch.js 2
- React InstantSearch
- Vue InstantSearch
- Angular InstantSearch
- Autocomplete.js
- JavaScript Client
- JavaScript Helper
License
Create InstantSearch App is MIT licensed.