Object Storage
Object Storage is a cloud-based file storage system that lets you save, retrieve, and manage access from your Replit App.
Replit Object Storage lets you store files like images, videos, and documents in cloud containers called buckets. Buckets are containers for storing objects such as files. They include access policies to limit what actions users or applications can perform on their contents.
The Replit Object Storage tool lets you seamlessly share data between your development and production environments or with other Replit Apps.
Features
Replit Object Storage is powered by Google Cloud Storage (GCS). This means you receive the benefits of industry-leading uptime, availability, and security.
Object Storage provides the following features for your Replit Apps:
- Cloud availability: Store files online and access them with any of your Replit Apps
- Scalability: Handle growing data needs without worrying about limits
- Share buckets across apps: Share access to buckets across Replit Apps
- Programmatic access: Upload, download, and manage files using intuitive APIs
Here are a few ways you can use Object Storage in your Replit Apps:
- Store media for a photo album or portfolio site
- Serve product demo videos on your landing page
- Create backups of your app log files
Usage
Your Replit App must authenticate with Google Cloud Storage to access a bucket and its objects. Use the official Replit Object Storage client libraries to automatically authenticate.
You can access the Object Storage tool directly in your Replit App workspace.
To associate a new object store with your Replit App, create a bucket.
The following sections explain the bucket and object management options in the Object Storage tool.
Select a bucket
To switch between your storage buckets, select the dropdown menu in the top left corner of the Object Storage tab.
The selected bucket displays a checkmark next to its name, as shown in the screenshot below:
Access the Bucket ID
To view the Bucket ID by selecting the Settings view from the dropdown at the top of the Object Storage tab. The Bucket ID uniquely identifies the bucket, which your code must reference to perform an operation.
If you have multiple buckets, select the correct one from the dropdown menu in the top left corner.
The following screenshot shows the Bucket ID for the “FileVault Bucket 1” bucket:
Upload or download objects
To upload an object to the selected bucket:
- Navigate to the Objects view in the Object Storage tab.
- Select
Upload files, or
Upload folder to upload all files from a folder. Then, select one or more files to upload from the file dialog. Alternatively, drag a file or folder into the area that lists the contents of the bucket.
To download an object from the selected bucket:
- Navigate to the Objects view in the Object Storage tab.
- Select the
download icon to the right of the file to download it.
Organize objects in folders
To create a folder in the selected bucket:
- Navigate to the Objects view in the Object Storage tab.
- Select
Create Folder in the Objects view.
- Enter a name for the folder.
To add objects to a folder in the Objects view, drag an object to the destination folder.
To move the object to a parent folder, drag it to the above the header to the name of the folder above the object list. The following animation shows moving the “product_demo.mov” file from the “videos” folder to the parent “Objects” folder:
Delete objects or buckets
The delete action is irreversible. Make sure to back up any essential data before proceeding.
To delete an object forever:
- Navigate to the Objects view in the Object Storage tab.
- Select the
trash icon next to the object you want to delete.
- Confirm the deletion in the confirmation dialog.
To delete a bucket and all the objects it contains:
- Navigate to the Settings view in the Object Storage tab.
- Make sure you select the bucket you want to delete in the top left bucket dropdown menu.
- Select
Delete Bucket.
- Confirm the deletion in the confirmation dialog.
Bucket access management
Replit connects all buckets you create to your account and makes them available to all your Replit Apps. The Replit App from which you create the bucket automatically receives access.
You can control which of your Replit Apps have access to a specific bucket, which lets you share data efficiently and securely.
To grant your Replit App access to a bucket from another app on your account:
- Select
Add an existing bucket from the bucket menu at the top left of the Object Storage tab.
- In the Choose a Bucket dialog, choose the bucket you want to add and select Add Bucket to Repl.
To revoke your Replit App’s access to a bucket:
- Navigate to the Settings view in the Object Storage tab.
- From the bucket dropdown in the top left of the tab, select the bucket name.
- Select Remove Bucket from Repl and confirm removal in the confirmation dialog.
Programmatic access to Object Storage
To access Object Storage from your Replit App, use one of the following libraries:
- Replit Object Storage SDK, available for JavaScript and Python
- Google Cloud Storage client library
For instructions on how to use the client libraries, see the following resources:
- JavaScript Object Storage tutorial: Learn how to use the Replit JavaScript Object Storage client
- Javacript Object Storage SDK: Client reference for the JavaScript SDK
- Python Object Storage tutorial: Learn how to use the Replit Python Object Storage client
- Python Object Storage SDK: Client reference for the JavaScript SDK
- Google Cloud Python SDK example app: Remix this app to manage objects using the Google Cloud Python SDK
Billing and resource usage
To monitor your Object Storage usage, navigate to the Usage page.
To learn more about Object Storage pricing, see Object Storage Billing.