Static Hosting

MongoDB Realm Hosting allows you to host, manage, and serve your application's static media and document files. You can use Hosting to store individual pieces of content or to upload and serve your entire client application.

To get started, enable hosting for your application then start uploading content.

A file is static if you can serve it directly to clients without requiring additional processing or logic to generate it. Static content includes document files, such as HTML, JavaScript, and CSS, as well as media files like images, audio, and videos.

MongoDB Realm hosts your application's content behind a unique domain name. By default, MongoDB Realm uses domains of the following form:

<Your App ID>
Info With Circle IconCreated with Sketch.Note

You can configure MongoDB Realm to host content at a custom domain name that you own in addition to the default hosting domain.

A resource path is a string that uniquely identifies an uploaded file based on its position in the file tree. You can access a hosted file through a unique URL that consists of your application's hosting domain followed by the file's resource path.

For example, a PNG image of a company's logo hosted in a directory named images would have the resource path /images/logo.png. You could access this image at a URL similar to the following:

MongoDB Realm enforces constraints on static hosting across several dimensions for each Realm app. The following constraints apply to all static content hosted by MongoDB Realm:

Maximum File Size25 megabytes
Maximum Total Storage1 gigabyte
Maximum Total Files20,000 files
Maximum CDN Flushes25 flushes per hour
Maximum Bandwidth100 gigabytes
Enable HostingLearn how to enable static file hosting for your Realm app.
Upload Content to RealmLearn how to add and update files in Realm Hosting.
Configure File MetadataLearn how to add descriptive metadata attributes to a file.
Flush the CDN CacheLearn how to force CDN servers to refresh their cached copies of your application's hosted files.
Host a Single-Page ApplicationLearn how to redirect all external requests to a single hosted page. This can be useful for some applications created using modern web frameworks such as React, Vue, and Angular.
Use a Custom Domain NameLearn how to serve hosted content from a domain name that you own.
Use a Custom 404 PageLearn how to show a custom 404 page when users request a resource that does not exist.
Give Feedback