Next.js + Tigris Storage Starter
A minimal starter template for file storage with Tigris Storage SDK and Next.js. Upload, list, download, and delete files using Tigris Storage SDK.
Features
- File uploads — Files are uploaded with
privateaccess by default - Presigned URL downloads — Secure, time-limited download links via Tigris
- Multipart uploads — Large files are uploaded in parallel chunks
- Pagination — Browse files with pagination
Getting Started
-
Create a new project
npx create-next-app my-app --example "https://github.com/tigrisdata/tigris-nextjs-starter" cd my-appOr clone directly:
git clone https://github.com/tigrisdata/tigris-nextjs-starter.git my-app cd my-app -
Set up environment variables
cp .env.example .env.localFill in your Tigris credentials. You can get these from the Tigris Dashboard.
-
Install dependencies
npm install -
Run the development server
npm run devOpen http://localhost:3000 to start uploading files.
Project Structure
| Path | Description |
|---|---|
src/app/layout.tsx | Root layout with metadata and header |
src/app/page.tsx | Main page — owns file state and data fetching |
src/app/api/files/route.ts | List files and handle client uploads |
src/app/api/files/[id]/route.ts | Get presigned download URL and delete files |
src/components/file-upload.tsx | Upload widget using @tigrisdata/react |
src/components/file-list.tsx | Presentational file list with actions |
src/lib/format.ts | File size and date formatting utilities |
API Routes
| Method | Path | Description |
|---|---|---|
GET | /api/files | List files with optional pagination |
POST | /api/files | Handle client upload handshake |
GET | /api/files/[id] | Get a presigned download URL |
DELETE | /api/files/[id] | Delete a file |
Environment Variables
| Variable | Description |
|---|---|
TIGRIS_STORAGE_ACCESS_KEY_ID | Your Tigris access key ID |
TIGRIS_STORAGE_SECRET_ACCESS_KEY | Your Tigris secret access key |
TIGRIS_STORAGE_BUCKET | The name of your Tigris storage bucket |