It's Day 2 of primitive for Encore.go and Encore.ts.
This feature simplifies working with public-facing file storage directly in your application code and adds CDN support for optimal content delivery.
How Object Storage works in Encore
and Encore handles the rest.
Using Public Buckets for simple file sharing
Encore now supports creating public buckets where objects can be accessed directly via HTTP/HTTPS without authentication.
This is useful for serving static assets like images, videos, or other public files.
To create a public bucket, set Public: true in the BucketConfig.
Here's how to do it in Encore.go:
var PublicAssets = objects.NewBucket("public-assets", objects.BucketConfig{
Public: true,
})
Once configured as public, you can get the public URL for any object using the PublicURL method:
// Get the public URL for an object
url := PublicAssets.PublicURL("path/to/image.jpg")
// The URL can be used directly or shared publicly
fmt.Println(url) // e.g. https://assets.example.com/path/to/image.jpg
For manual cloud deployments, you just need to provide a provide a base url in the runtime configuration, and Encore handles the rest.
When deploying with for optimal content delivery, using:
when using AWS
With Public Buckets, Encore makes managing object storage and public file access simple, powerful, and fully type-safe.
Simple testing in the Development Dashboard
Encore's
Join the Live stream
SOCIAL SHARE CARD GENERATOR