Skip to content

moshe19909090/typesense-search-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

You've got a great start on your README! Here's a revised version that incorporates standard README best practices for clarity, structure, and engagement.

# 🛍️ Typesense Product Search App

This is a full-stack product search application built with **React** for the frontend and **Typesense** powering the backend search capabilities. It offers a robust and instant search experience for products.

---

## ✨ Features

* **Full-Text Search:** Instantly search through your product catalog.
* **Faceted Filters:** Refine search results by product **tags** and **collections**.
* **Pagination:** Navigate through large result sets with ease.
* **Instant Results with Debounce:** Get real-time search suggestions with a 200ms debounce to optimize performance.
* **Live-Updating Filters:** Facets dynamically update based on the current search query, providing relevant filtering options.

---

## 🚀 Getting Started

To get this application up and running, ensure you have the following prerequisites installed:

* **Node.js**: Version 16+ is recommended.
* **npm**: Node package manager, typically installed with Node.js.
* **Docker**: Required to run the Typesense search engine.

---

## 🧠 Project Structure

```bash
.
├── backend/
│   ├── src/
│   │   ├── index.js           # Express server with /search endpoint
│   │   ├── index-catalog.ts # Script for indexing
│   │   ├── catalog.fixed.jsonl # Product data for indexing
│   ├── package.json
│   └── ...
├── frontend/
│   ├── src/
│   │   └── App.tsx            # Main React App
│   ├── public/
│   ├── package.json
│   └── ...
├── .gitignore
├── README.md
└── ...

⚙️ Setup Instructions

Follow these steps to set up and run the application locally:

  1. Clone the repository:

    git clone [https://github.com/moshe19909090/typesense-search-app.git](https://github.com/moshe19909090/typesense-search-app.git)
    cd typesense-search-app
  2. Start Typesense using Docker: Navigate into the backend directory and run the Docker command. This will start a Typesense instance accessible on port 8108.

    cd backend
    docker run -p 8108:8108 -v$(pwd)/typesense-data:/data typesense/typesense:0.25.1 \
      --data-dir /data --api-key=xyz --listen-port 8108 --enable-cors
  3. Install backend dependencies:

    npm install
  4. Index product data: Run the indexing script to upload the sample catalog.fixed.jsonl data into your running Typesense instance. You should see logs confirming successful indexing.

    npm run index
  5. Run the backend server:

    npm run dev

    This will start the Express server, which provides the /search endpoint for the frontend.


💻 Running the Frontend

Once the backend and Typesense are running, you can start the React frontend:

  1. Open a new terminal and navigate to the frontend directory:

    cd frontend
  2. Install frontend dependencies:

    npm install
  3. Run the React application:

    npm start

    The application will open in your browser at http://localhost:3000.


🔍 Search Behavior

  • Typing in the search box triggers a 200ms debounce for live, instant search results.
  • Tags and Collections facets dynamically update based on the current search query, ensuring only relevant filters are displayed.
  • You can click on filter chips to apply filters and use the "Clear Filters" option to reset your search.

📦 Dependencies

Frontend

  • React: A JavaScript library for building user interfaces.
  • Axios: A promise-based HTTP client for making API requests.

Backend

  • Express: A fast, unopinionated, minimalist web framework for Node.js.
  • Typesense: A fast, open source, typo-tolerant search engine.
  • dotenv (optional): For loading environment variables from a .env file.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors