Data Storage

To ensure efficient data management, we will configure Cloudflare D1 for database management and Cloudflare R2 for object storage.

D1 SQL Database

Navigate to your Cloudflare Account and create a new D1 database:

  • Log in to your Cloudflare account.
  • Under Storage & Databases, select D1 SQL Database.
  • Click to create a new database.
  • Name the database example.
  • For optimal performance, set the location to Eastern North America to minimize latency.

✨ Great job! The D1 database is now ready.

R2 Object Storage

Navigate to your Cloudflare Account and create a new R2 storage:

  • Log in to your Cloudflare account.
  • Select R2 Object Storage.
  • Click to create a new storage bucket.
  • Click to create a new database.
  • Name the database example.
  • For optimal performance, set the location to Eastern North America under Automatic to minimize latency.

Configuring R2 Storage for CDN and CORS Support:

  • Go to your example R2 object storage.
  • Under Settings, add and connect the domain cdn.example.com. This will serve as the CDN URL for this storage.
  • Click on Edit CORS Policy and set AllowedOrigins to * to allow all origins to access the storage.

✨ Well done! The R2 Storage is now ready.