Tigris Starter
Type: Code
Framework: Next.js
CSS: CSS Modules
Database: Tigris
- Overview: A starter template for building a simple todo app using Next.js and Tigris, deployed on Vercel. Tigris offers a fully-managed data platform with serverless document databases and full-text search capabilities.
- Project Demo: View the live demo at https://tigris-nextjs-starter-kit.vercel.app/.
Deploying the App:
- Requires GitHub, Vercel, and Tigris accounts (Tigris offers free sign-up).
- Deploy the app to Vercel using the “Deploy” button and follow the instructions.
Running Locally:
- Prerequisites:
- Tigris CLI installed (macOS:
brew install tigrisdata/tigris/tigris-cli
, other OS: refer to Tigris installation guide). - Node.js version 16 or higher.
- Tigris CLI installed (macOS:
- Instructions:
- Clone the repository:
git clone https://github.com/tigrisdata/tigris-vercel-starter
. - Install dependencies:
cd tigris-vercel-starter && npm install
. - Start the Tigris local development environment:
tigris dev start
. - Run the Next.js server:
npm run dev
.
- Clone the repository:
Code Walkthrough:
- Structure:
db/models/todoItems.ts
: Defines thetodoItems
collection for storing todo items.lib/tigris.ts
: Configures the Tigris client using environment variables.- API routes under
pages/api/
handle CRUD operations for todo items.
- API Endpoints:
GET /api/items
: Fetches all todo items.POST /api/items
: Adds a new todo item.GET /api/items/search?q=query
: Searches for todo items matching a query.GET
,PUT
,DELETE
/api/item/{id}
: Fetches, updates, or deletes a specific todo item.
Next Steps:
- Encourages further customization and functionality enhancement of the app, exploring more about Tigris.
Contributing:
- Contributions are welcome via forking the repo and submitting pull requests or opening issues. Contributors are encouraged to star the project.