https://github.com/tigrisdata-archive/tigris-trpc-nextjs
An example of using Tigris Database and Search with tRPC and Next.js
https://github.com/tigrisdata-archive/tigris-trpc-nextjs
nextjs search serverless tigris-data tigris-database trpc
Last synced: about 1 year ago
JSON representation
An example of using Tigris Database and Search with tRPC and Next.js
- Host: GitHub
- URL: https://github.com/tigrisdata-archive/tigris-trpc-nextjs
- Owner: tigrisdata-archive
- License: mit
- Created: 2023-02-09T16:23:04.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-04-26T05:37:39.000Z (about 3 years ago)
- Last Synced: 2025-05-28T08:15:31.081Z (about 1 year ago)
- Topics: nextjs, search, serverless, tigris-data, tigris-database, trpc
- Language: TypeScript
- Homepage:
- Size: 796 KB
- Stars: 0
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Tigris Database and Search + tRPC + Next.js
An example demonstrating the following tech stack:
- [Tigris](https://www.tigrisdata.com) - database and search
- [Next.js](https://nextjs.org/) - React-based web framework
- [tRPC](https://trpc.io) - Remote Procedure Call library that enables Type inference across client and server
And the following Tigris products and features:
- [Database Inserts](https://www.tigrisdata.com/docs/sdkstools/typescript/database/insert/)
- [Database Querying](https://www.tigrisdata.com/docs/sdkstools/typescript/database/query/)
- [Database Query sorting](https://www.tigrisdata.com/docs/sdkstools/typescript/database/query/#sort)
- [Database Query pagination](https://www.tigrisdata.com/docs/sdkstools/typescript/database/query/#pagination)
- [Search](https://www.tigrisdata.com/docs/sdkstools/typescript/database/search/)
## Development
### Prerequisites
- A [Tigris Cloud](https://www.tigrisdata.com) account
- Install the [Tigris CLI](https://www.tigrisdata.com/docs/sdkstools/cli/installation/)
- [Node.js > 18.13.0](https://nodejs.org/en/download/) installed
### Get the code and install dependencies
```bash
git clone git@github.com:tigrisdata-community/tigris-trpc-nextjs.git
cd tigris-trpc-nextjs
npm install
```
### Create your Tigris Project
Create your Tigris project and Tigris application keys, and set environmental variables.
### Setup
1. Login to the [Tigris Console](https://console.preview.tigrisdata.cloud/)
2. Create a Project called `tigris_trpc_nextjs` (or some other name if you prefer)
3. Navigate to **Application Keys**
4. Click the eye icon next to the Key with the same name as your Project
5. Create a `.env.development.local` file and copy:
- **URL** to a variable named `TIGRIS_URI`
- **Name** to a variable named `TIGRIS_PROJECT`
- **Client ID** to a variable named `TIGRIS_CLIENT_ID`
- **Client Secret** to a variable named `TIGRIS_CLIENT_SECRET`
6. Finally, add another variable called `TIGRIS_DB_BRANCH` with a value of `develop`
An example `.env.development.local` is in the repo called `.env.development.local.example`.
### Preload some data
An app with no data is no fun!
Run the following script to add some users to the database. Separate each username with a space character:
```shell
npm run add-users -- {username1} {username2} ... {usernameX}
```
For example, the following command will add four users to the database with the corresponding usernames:
```shell
npm run add-users -- leggetter ovaistariq adilansari GarrenSmith
```
Now, add some mock posts by running the following command:
```shell
npm run load-mock-data
```
### Run the app
With users and posts loaded, we can run the app:
```shell
npm run dev
```
## Contribute 🙌
Please do get involved! Issues and Pull Requests are very much sought and appreciated.
## Code of Conduct
See the [Tigris Community Code of Conduct](https://www.tigrisdata.com/docs/community/code-of-conduct/).
## More info
- [Join the Tigris Community Discord](https://www.tigrisdata.com/discord)
- [Follow Tigris Data on Twitter](https://twitter.com/tigrisdata)
- [Dive into the Tigris Docs](https://www.tigrisdata.com/docs/)
- [Visit the Tigris Data website](https://www.tigrisdata.com)