Netlify Blobs is actually a distributed object storage system that abstracts away the complexities of managing your own S3 bucket, making it easier to serve and store user-generated content or other static assets directly from your frontend application.

Let’s see it in action. Imagine you have a Netlify site and you want to let users upload profile pictures.

First, you’d install the Netlify Blobs client library:

npm install netlify-blobs
# or
yarn add netlify-blobs

Then, in your frontend code, you can initialize the client. You’ll need your Netlify site ID, which you can find in your site’s general settings.

import { createBlobsUploader } from "netlify-blobs";

const uploader = createBlobsUploader({
  siteId: "YOUR_NETLIFY_SITE_ID",
});

Now, let’s say you have a file input element in your HTML:

<input type="file" id="profilePicInput" />
<button onclick="uploadProfilePic()">Upload</button>

And your JavaScript function to handle the upload:

async function uploadProfilePic() {
  const fileInput = document.getElementById("profilePicInput");
  const file = fileInput.files[0];

  if (!file) {
    alert("Please select a file.");
    return;
  }

  try {
    const { key } = await uploader.upload(file, {
      // You can optionally specify a directory and filename
      // For example, to store it in a 'user-uploads/avatars/' directory
      // with a filename based on the user's ID:
      // directory: "user-uploads/avatars",
      // filename: `user-${userId}-${file.name}`,
    });
    console.log(`File uploaded successfully! Key: ${key}`);

    // You can then construct the URL to access the blob
    // The base URL is your Netlify site's domain
    const blobUrl = `https://your-netlify-site-name.netlify.app/${key}`;
    console.log(`Access URL: ${blobUrl}`);

    // You might then save this URL in your database associated with the user
  } catch (error) {
    console.error("Upload failed:", error);
    alert("File upload failed. Please try again.");
  }
}

When uploader.upload(file) is called, Netlify Blobs handles the multipart upload to its underlying object storage. The key returned is essentially the unique path to your file within the blob store. This key can be anything you define, allowing for organized storage using directories. The public URL is then constructed by simply prepending your site’s domain to this key.

The core problem Netlify Blobs solves is simplifying the integration of dynamic file storage into Jamstack applications. Traditionally, you’d need to set up and manage an S3 bucket, configure CORS policies, generate presigned URLs for uploads, and handle the direct interaction with the S3 API. Blobs abstracts all of this away. When you call uploader.upload(), Netlify’s backend receives the file, securely stores it in its managed object storage, and returns a stable, publicly accessible URL. This means your frontend code doesn’t need any direct AWS credentials or complex S3 SDK configurations.

The directory and filename options are powerful for organizing your blobs. If you omit them, the key will default to the file’s name. However, for any non-trivial application, you’ll want to structure your data. For instance, storing user avatars in user-uploads/avatars/${userId}/${filename} or temporary files in temp-uploads/${timestamp}/${filename} provides a clear logical structure. Netlify Blobs essentially maps these logical paths to physical locations in its object store.

What most people don’t realize is that while the default access pattern is public via your Netlify site’s domain, Netlify Blobs also offers private access. You can configure specific blobs or directories to be private, requiring an authenticated Netlify function to generate a temporary, signed URL for access. This is crucial for handling sensitive user data or assets that shouldn’t be directly exposed to the public internet, allowing you to build secure applications with user-specific content.

The next step after mastering basic uploads and downloads is exploring the more advanced features like setting metadata on blobs, implementing cache control headers, and managing large files efficiently.

Want structured learning?

Take the full Netlify course →