create-instantsearch-app
v7.5.16
Published
⚡️ Build InstantSearch apps at the speed of thought
Downloads
808
Readme
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, InstantSearch iOS and InstantSearch Android).
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
Important Selecting 'Y' when being prompted to ‘Enable user events’ activates the
insights
option for compatible templates, allowing Algolia to process your user Events. Events can unlock powerful features, enhancing your application's effectiveness and we encourage you to consider enabling this valuable functionality. Please review our API reference for more details about Events collection and settings.
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
--image-attribute <imageAttribute> The attribute of your index to use for image 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
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.
{
"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"],
"imageAttribute": "image",
"attributesForFaceting": ["brand", "location"],
"enableInsights": true
}
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'],
imageAttribute: 'image',
attributesForFaceting: ['keywords'],
enableInsights: true,
});
app.create().then(() => console.log('App generated!'));
Tutorials
Previews
You can use the web templates on CodeSandbox:
- InstantSearch.js
- React InstantSearch
- Vue InstantSearch
- Autocomplete.js
- JavaScript Client
- JavaScript Helper
Contributing
We welcome all contributors, from casual to regular 💙
- Bug report. Is something not working as expected? Send a bug report.
- Feature request. Would you like to add something to the library? Send a feature request.
- Development. If you don't know where to start, you can check the open issues that are tagged easy, the bugs or chores.
To start contributing to the code, you need to:
- Fork the project
- Clone the repository
- Install the dependencies:
yarn
Please read our contribution process to learn more.
License
Create InstantSearch App is MIT licensed.