• Stars
    star
    266
  • Rank 154,103 (Top 4 %)
  • Language
    JavaScript
  • License
    Apache License 2.0
  • Created almost 7 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

JavaScript / TypeScript client for Typesense

typesense-js NPM version downloads

Javascript client library for accessing the Typesense HTTP API.

This library can be used both on the server-side and on the client-side. The library's source is in ES6 and during build time, we transpile it to ES5 and generate two artifacts - one that can be used on the server-side and another that uses Browserify and can be used on the client side.

Installation

Option 1: Install via npm

npm install --save typesense

Install peer dependencies:

npm install --save @babel/runtime

Note: @babel/runtime is very a common dependency among many JS libraries. So instead of each library adding it as a dependency independently (which will cause multiple instances of @babel/runtime to be installed increasing bundle size), Babel's recommendation is that the libraries ask users to install it once as a direct dependency, so there's only one copy of @babel/runtime for the entire project. In some cases, your JS framework might already include @babel/runtime as a dependency.

Option 2: Include the minified JS file for use in the browser directly

<script src="dist/typesense.min.js"></script>

or via jsDelivr

<script src="https://cdn.jsdelivr.net/npm/typesense@1/dist/typesense.min.js"></script>

Usage

Read the documentation here for detailed examples: https://typesense.org/docs/api/

Tests are also a good place to know how the library works internally: test

Note: When using this library in a browser, please be sure to use an API Key that only allows search operations instead of the master API key. See doc/examples/server/keys.js for an example of how to generate a search only API key.

See Configuration.ts for a list of all client configuration options.

Examples

Here are some examples with inline comments that walk you through how to use the client: doc/examples

To run the examples, from the repo root:

npm run typesenseServer
node doc/examples/server/bulkImport.js

GatsbyJS Integration

If you use GatsbyJS for a framework, we have a plugin (that uses typesense-js behind the scenes) to automatically push your site data to Typesense when you build your site. Learn more here.

Firebase Integration

If you use Firebase, we have a Firebase extension (that uses typesense-js behind the scenes) to automatically push your Firestore data to Typesense. Learn more here.

Building UI components

Checkout the Typesense-InstantSearch.js (which uses typesense-js) for UI components you can use to quickly build powerful instant search experiences.

Compatibility

This table refers to server=>client compatibility. Newer versions of the client library maintain backwards compatibility with older versions of the server library.

Typesense Server typesense-js
>= v0.25.0 >= v1.7.0
>= v0.24.0 >= v1.5.0
>= v0.23.0 >= v1.3.0
>= v0.21.0 >= v0.14.0
>= v0.20.0 >= v0.12.0
>= v0.19.0 >= v0.11.0
>= v0.18.0 >= v0.10.0
>= v0.17.0 >= v0.9.0
>= v0.16.0 >= v0.8.0
>= v0.15.0 >= v0.7.0
>= v0.12.1 >= v0.5.0
>= v0.12.0 >= v0.4.7
<= v0.11 <= v0.3.0

Development

After checking out the repo, run npm install to install dependencies. Then run npm test to run the linter and tests.

To release a new version, we use the np package:

$ npm install --global np
$ np

# Follow instructions that np shows you

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/typesense/typesense-js.

More Repositories

1

typesense

Open Source alternative to Algolia and an Easier-to-Use alternative to ElasticSearch ⚑ πŸ” ✨ Fast, typo tolerant, in-memory fuzzy Search Engine for building delightful search experiences
C++
12,770
star
2

showcase-recipe-search

Instantly search 2M cooking recipes using Typesense Search (an open source alternative to Algolia / ElasticSearch) ⚑ πŸ₯˜ πŸ”
JavaScript
437
star
3

typesense-instantsearch-adapter

A JS adapter library to build rich search interfaces with Typesense and InstantSearch.js
JavaScript
262
star
4

typesense-php

PHP client for Typesense: https://github.com/typesense/typesense
PHP
181
star
5

showcase-songs-search

A site to instantly search 32M songs from the MusicBrainz songs database, using Typesense Search (an open source alternative to Algolia / ElasticSearch) ⚑ 🎡 πŸ”
JavaScript
135
star
6

laravel-scout-typesense-driver

Laravel Scout Driver for Typesense
PHP
131
star
7

showcase-books-search

A site to instantly search 28M books from OpenLibrary using Typesense Search (an open source alternative to Algolia / ElasticSearch) ⚑ πŸ“š πŸ”
JavaScript
130
star
8

typesense-go

Go client for Typesense: https://github.com/typesense/typesense
Go
124
star
9

firestore-typesense-search

Firebase Extension to automatically push Firestore documents to Typesense for full-text search with typo tolerance, faceting, and more
JavaScript
122
star
10

typesense-python

Python client for Typesense: https://github.com/typesense/typesense
Python
104
star
11

typesense-docsearch-scraper

A fork of Algolia's awesome DocSearch Scraper, customized to index data in Typesense (an open source alternative to Algolia)
Python
70
star
12

typesense-dart

Dart client for Typesense
Dart
65
star
13

docusaurus-theme-search-typesense

A fork of the awesome @docusaurus/theme-search-algolia library customized to work with Typesense
TypeScript
48
star
14

typesense-ruby

Ruby client for Typesense: https://github.com/typesense/typesense
Ruby
43
star
15

typesense-instantsearch-demo

A demo app that shows how to use the Typesense InstantSearch adapter, to build rich search interfaces.
JavaScript
41
star
16

typesense-swift

Swift Client for Typesense βš‘οΈπŸ”Ž
Swift
40
star
17

typesense-website

Typesense website and documentation | An open source search engine alternative to Algolia, Elasticsearch and Pinecone
Vue
38
star
18

showcase-nextjs-typesense-ecommerce-store

An app showing how you can use Typesense & Next.js / React to build a full-fledged ecommerce browsing and searching experience
JavaScript
36
star
19

typesense-java

Java client for Typesense
Java
31
star
20

showcase-ecommerce-store

An app showing how you can use Typesense to build a full-fledged ecommerce browsing and searching experience
JavaScript
31
star
21

gatsby-plugin-typesense

A Gatsby plugin to automatically index content to Typesense post-build
JavaScript
30
star
22

showcase-linux-commits-search

Instantly search 1M Linux Kernel Commit Messages using Typesense Search (an open source alternative to Algolia / ElasticSearch) ⚑ πŸ’» πŸ”
JavaScript
29
star
23

typesense-kubernetes

Typesense Kubernetes
24
star
24

postman

Postman collection for Typesense
21
star
25

typesense-rust

Rust client for Typesense | Work In Progress & Help Wanted
Rust
21
star
26

typesense-mongodb

A Node.js CLI to sync documents from a MongoDB collection to Typesense.
TypeScript
21
star
27

showcase-hn-comments-semantic-search

Semantic Search + Keyword Search + Hybrid Search + Filtering + Faceting on 300K HN Comments
JavaScript
20
star
28

typesense-docsearch.js

A fork of Algolia's awesome DocSearch.js, customized to use data from Typesense.
TypeScript
20
star
29

typesense-api-spec

Contains the API specs for the Typesense HTTP API
14
star
30

typesense-autocomplete-demo

A demo app that shows you how to use Algolia's autocomplete.js library with Typesense
HTML
13
star
31

typesense-instantsearch-semantic-search-demo

A demo that shows how to build a semantic search experience with Typesense's vector search feature and Instantsearch.js
JavaScript
13
star
32

showcase-xkcd-search

Search & Browse xkcd by topic & keywords | Using Typesense, an open source Algolia alternative and an easier-to-use alternative to Elasticsearch
JavaScript
12
star
33

typesense-rails

Rails Integration for Typesense | Work in Progress | Help Needed
Ruby
10
star
34

showcase-spellcheck

Use Typesense to build a type-ahead spellchecker
JavaScript
8
star
35

typesense-instantsearch-demo-no-npm-yarn

A demo that shows how to use typesense-instantsearch-adapter without NPM or YARN
HTML
8
star
36

showcase-airbnb-geosearch

Browse & GeoSearch 1 Million AirBnB listings with Typesense βš‘πŸ” ️🌎
JavaScript
8
star
37

typesense-wordpress-plugin

Deprecated in favor of https://wordpress.org/plugins/search-with-typesense/
JavaScript
7
star
38

typesense-vue-instantsearch-demo

A demo app that shows you how to use Vue & the Typesense InstantSearch adapter, to build rich search interfaces.
Vue
6
star
39

homebrew-tap

Homebrew Formulae for Typesense
Ruby
4
star
40

user-admin-search-laravel-demo

A demo Laravel app that integrates with Typesense
PHP
4
star
41

showcase-federated-search

An app that showcases federated search in Typesense (Open source alternative to Algolia)
JavaScript
3
star
42

typesense-lando-plugin

A Lando plugin for Typesense
JavaScript
2
star
43

typesense-flutter-demo

1
star
44

.github

Org-wide shared github configs
1
star
45

solr-xml-to-jsonl

A CLI utility to convert a solr data file to a simple JSONL file
JavaScript
1
star