-
Notifications
You must be signed in to change notification settings - Fork 5
feat: initial docs for tigris sdk #262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Summary
This PR introduces comprehensive documentation for a new Tigris Storage SDK, a simplified wrapper around the Tigris Data API designed specifically for JavaScript/Node.js developers. The changes add a new "Tigris Storage SDK" section to the documentation sidebar, positioned strategically between "Examples" and "AWS S3 SDKs" sections.
The new SDK provides a more developer-friendly alternative to the existing S3-compatible APIs by offering:
- A Promise-based TypeScript interface with full type definitions
- Simplified configuration with optional properties and sensible defaults
- Common storage operations (get, put, list, head, remove) wrapped in consistent
TigrisStorageResponseobjects for error handling - Multiple format support for retrieving objects (string, file, stream)
- Built-in pagination support for listing operations
The documentation includes three key components:
- Sidebar integration (
sidebars.js) - Adds the new SDK section following established patterns - Getting started guide (
docs/sdks/tigris/index.mdx) - Provides installation, configuration, and practical usage examples - API reference (
docs/sdks/tigris/api-reference.mdx) - Comprehensive TypeScript type definitions and function documentation
This addition fits into Tigris's broader strategy of offering multiple integration paths: maintaining S3 compatibility for existing workflows while providing a native SDK optimized for new applications that prefer a more opinionated, simplified interface.
Confidence score: 4/5
- This PR is safe to merge with only minor documentation inconsistencies that don't affect functionality
- Score reflects well-structured documentation with comprehensive coverage, but minor type inconsistencies in the API reference reduce confidence slightly
- Pay close attention to
docs/sdks/tigris/api-reference.mdxfor return type inconsistencies in head() and remove() functions
3 files reviewed, 5 comments
Xe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I committed some minor fixes. LGTM!
ovaistariq
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a good start. Needs some improvement.
docs/sdks/tigris/index.mdx
Outdated
| quickly and integrate Tigris into your application. It offers all the | ||
| functionality of the Tigris Data, but with a simpler interface. | ||
|
|
||
| Tigris Storage SDK is geared towards application developers who needs to store |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I read it this seems too much text. I want to immediately know how it is better. Show me what the functions look like and how they are better than AWS S3 sdk.
Signed-off-by: Xe Iaso <[email protected]>
Signed-off-by: Xe Iaso <[email protected]>
7ad5030 to
a3f1f5e
Compare
ovaistariq
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The structure of the documentation can be improved. See how the documentation is structured here: https://vercel.com/docs/vercel-blob/using-blob-sdk - documents all the main functions, only showing the relevant code for each functions
docs/sdks/tigris/index.mdx
Outdated
| import Tabs from "@theme/Tabs"; | ||
| import TabItem from "@theme/TabItem"; | ||
|
|
||
| Tigris Storage SDK is a simplified wrapper around Tigris Object Storage API. It |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tigris Storage SDK provides a simple interface and minimal configuration that lets you get started quickly and integrate Tigris into your application. It is built on top of Tigris Object Storage API and offers all the functionality of Tigris.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
docs/sdks/tigris/index.mdx
Outdated
| - Are larger and not practical to store in the database, such as images, videos, | ||
| documents, etc. | ||
| - That needs to be retrieved frequently across different regions | ||
| - break your wallet by paying egress fees |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| - `body`: (Required) A blob object as File or Blob | ||
| - `options`: (Optional) A JSON object with the following optional parameters: | ||
|
|
||
| | **Parameter** | **Required** | **Values** | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section confused me a little bit. I thought these were top level options as well. How can we make it more clear that these are part of the options object
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if (file) { | ||
| const formData = new FormData(); | ||
| formData.append("file", file); | ||
| fetch("/api/test", { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this be /api/upload
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, updated
docs/sdks/tigris/examples.mdx
Outdated
| setProgress(0); | ||
| if (file) { | ||
| const result = await upload(`${file.name}`, file, { | ||
| url: "/api/test", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where are we fetching the pre-signed url?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
upload method does it behind the scene for users. It calls the endpoint provided in url param that returns a presigned url. Client upload then use that url to upload the object
Xe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming these can be fixed, approved. Love to see this!
| <script> | ||
| function handleFileChange(event) { | ||
| const file = event.target.files[0]; | ||
| upload("file.txt", file, { | ||
| url: "/api/upload", | ||
| access: "private", | ||
| onUploadProgress: ({ loaded, total, percentage }) => { | ||
| console.log(`Uploaded ${loaded} of ${total} bytes (${percentage}%)`); | ||
| }, | ||
| }); | ||
| } | ||
| </script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this assume upload is in the globalThis scope?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not, it's not available on window or globalThis, it needs to be imported. I wanted to keep the example simpler but it would require es module like importing (that all the modern browsers support), it's a decision to not support UMD modules as it was requiring a lot of wiring and not bringing actual benefit
docs/sdks/tigris/examples.mdx
Outdated
| <TabItem value="server" label="Server" default> | ||
|
|
||
| ```ts | ||
| // app/api/avatar.ts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure that this is the right filename? I think it should be:
| // app/api/avatar.ts | |
| // app/api/avatar/route.ts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated, thanks for pointing 🙏
docs/sdks/tigris/examples.mdx
Outdated
| <TabItem value="server" label="Server" default> | ||
|
|
||
| ```ts | ||
| // app/api/upload.ts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // app/api/upload.ts | |
| // app/api/upload/route.ts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
docs/sdks/tigris/examples.mdx
Outdated
| Amongst all the other great features of Tigris, free egress fees is another | ||
| example of what makes us stand out from other providers. We care about the | ||
| bandwidth costs and we want to make it as cheap as possible for you to use | ||
| Tigris. That's why we've made it so that you can upload files directly to Tigris | ||
| from the client side. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Amongst all the other great features of Tigris, free egress fees is another | |
| example of what makes us stand out from other providers. We care about the | |
| bandwidth costs and we want to make it as cheap as possible for you to use | |
| Tigris. That's why we've made it so that you can upload files directly to Tigris | |
| from the client side. | |
| Tigris does not charge egress fees, but your hosting provider may charge them for | |
| user uploads to Tigris. We care about your bandwidth costs, so we made it easy to | |
| have the server and client work together to upload things. This lets you give a | |
| presigned URL to the client and then have the client upload to Tigris instead of | |
| your server needing to be in the middle. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated, thanks for suggestion
docs/sdks/tigris/examples.mdx
Outdated
| <TabItem value="server" label="Server" default> | ||
|
|
||
| ```ts | ||
| // app/api/signed.ts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // app/api/signed.ts | |
| // app/api/signed/route.ts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
docs/sdks/tigris/index.mdx
Outdated
| Tigris Storage SDK is a simplified wrapper around Tigris Object Storage API. It | ||
| provides a simpler interface and minimal configuration that lets you get started | ||
| quickly and integrate Tigris into your application. It offers all the | ||
| functionality of Tigris, but with a simpler interface. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Tigris Storage SDK is a simplified wrapper around Tigris Object Storage API. It | |
| provides a simpler interface and minimal configuration that lets you get started | |
| quickly and integrate Tigris into your application. It offers all the | |
| functionality of Tigris, but with a simpler interface. | |
| The Tigris Storage SDK provides a simple interface and minimal configuration | |
| that lets you get started quickly and integrate Tigris into your application. It | |
| is built on top of Tigris Object Storage API and offers all the functionality of | |
| Tigris. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ovaistariq made the suggestion about it too, so I've updated with what he suggestion, LMK if you have strong opinion about it
docs/sdks/tigris/index.mdx
Outdated
| - Are larger and not practical to store in the database, such as images, videos, | ||
| documents, etc. | ||
| - That needs to be retrieved frequently across different regions | ||
| - break your wallet by paying egress fees |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| - break your wallet by paying egress fees |
| ```bash | ||
| TIGRIS_STORAGE_ACCESS_KEY_ID=tid_access_key_id | ||
| TIGRIS_STORAGE_SECRET_ACCESS_KEY=tsec_secret_access_key | ||
| TIGRIS_STORAGE_BUCKET=bucket_name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not review-bearing, but TODO(Xe): standardize on this envvar name in the future
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Convert to webp with ffmpeg -i tigris-sdk.png tigris-sdk.webp.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to update this image any way, right now it's a blank grey image. I'll ask Jocelyn if she can come up with a quick icon for SDK.

Closes TIG-5879