Tigris offers an integrated full-text search solution that allows you to create powerful search experiences within your application. Utilizing Typesense technology, this embedded search engine eliminates the need for an additional search system, providing a smooth and scalable experience for your database.
This application is built with Next.js and Tigris and provides a full-stack solution. Products are stored and retrieved from a Tigris database to be displayed to customers. To improve accessibility, I integrated a real-time search feature with Tigris allowing users to quickly search for their desired products.
To deploy this app to your Vercel and Netlify accounts, you will need a Github, Vercel, Netlify and Tigris account. Once you have all the accounts, simply click on the "Deploy" buttons and follow the instructions to deploy the app to your accounts.
- Sign up on the Tigris console
- Node.js 14.6.0 or newer
- MacOS, Windows, and Linux are supported
- Clone this repo on your computer
git clone https://github.com/tigrisdata-community/realtime-search
- Install dependencies
cd realtime-search
npm install
- Run the Next.js server
npm run dev
Note: For the application to work, you must first create a project on the Tigris console and then copy the generated credentials to the
.env
file. For instructions on how to do this, please refer to the accompanying tutorial..
🎉 All done. You should be able to use app on localhost:3000
in browser. Feel free to play
around or do a code walk-through next 🎉
📂 File structure
├── package.json
├── lib
│ ├── tigris.ts
├── db
│ └── models
│ └── store.ts
└── pages
├── index.tsx
└── api
└── store
├── index.ts
└── search.ts
🪢 Tigris schema definition
db/models/store.ts - The app has a single collection
products
that stores the products in the store. This Collection gets automatically created/updated by the
setup script.
❇️ API routes to access data in Tigris collection
All the Next.js API routes are defined under pages/api/
. We have three files exposing endpoints:
GET /api/store
to get an array of products as ArrayGET /api/items/search?q=query
to find and return products matching the given query
Feel free to add more functionalities or customize App for your use-case and learn more about Tigris data platform
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue. Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request