# D1 Create managed, serverless databases with SQL semantics > Links below point directly to Markdown versions of each page. Any page can also be retrieved as Markdown by sending an `Accept: text/markdown` header to the page's URL without the `index.md` suffix (for example, `curl -H "Accept: text/markdown" https://docs.ahq.lat/d1/`). > > For other Cloudflare products, see the [Cloudflare documentation directory](https://docs.ahq.lat/llms.txt). ## Overview - [Cloudflare D1](https://docs.ahq.lat/d1/index.md): Build serverless SQL databases on Cloudflare's global network and query them from Workers and Pages projects. ## Getting started - [Getting started](https://docs.ahq.lat/d1/get-started/index.md): Create your first D1 database, define a schema, and query it from a Cloudflare Worker. ## Workers Binding API - [Workers Binding API](https://docs.ahq.lat/d1/worker-api/index.md): Query D1 databases from a Cloudflare Worker using the D1 Binding API for prepared statements, batching, and type-safe results. - [D1 Database](https://docs.ahq.lat/d1/worker-api/d1-database/index.md): Use the D1Database binding to prepare statements, execute queries, batch operations, and dump a D1 database from a Worker. - [Prepared statement methods](https://docs.ahq.lat/d1/worker-api/prepared-statements/index.md): Bind parameters and run D1 prepared statements using the run, all, first, and raw methods. - [Return objects](https://docs.ahq.lat/d1/worker-api/return-object/index.md): Understand the D1Result and D1ExecResult objects returned by D1 Worker Binding API query methods. ## Wrangler commands - [Wrangler commands](https://docs.ahq.lat/d1/wrangler-commands/index.md): Use Wrangler CLI commands to create, manage, and query D1 databases. ## REST API - [REST API](https://docs.ahq.lat/api/resources/d1/subresources/database/methods/create/index.md): Manage and query D1 databases programmatically using the Cloudflare REST API. ## Examples - [Examples](https://docs.ahq.lat/d1/examples/index.md): Browse code examples that demonstrate common D1 database operations and patterns. - [Query D1 from Hono](https://docs.ahq.lat/d1/examples/d1-and-hono/index.md): Query D1 from the Hono web framework - [Query D1 from Remix](https://docs.ahq.lat/d1/examples/d1-and-remix/index.md): Query your D1 database from a Remix application. - [Query D1 from SvelteKit](https://docs.ahq.lat/d1/examples/d1-and-sveltekit/index.md): Query a D1 database from a SvelteKit application. - [Export and save D1 database](https://docs.ahq.lat/workflows/examples/backup-d1/index.md): Export a D1 database and save the backup to R2 storage using Workflows. - [Query D1 from Python Workers](https://docs.ahq.lat/d1/examples/query-d1-from-python-workers/index.md): Learn how to query D1 from a Python Worker ## Tutorials - [Tutorials](https://docs.ahq.lat/d1/tutorials/index.md): Step-by-step D1 tutorials for building applications, importing data, and using read replication. - [Build a Comments API](https://docs.ahq.lat/d1/tutorials/build-a-comments-api/index.md): Use D1 to add comments to a static blog site. Create a D1 database and build a JSON API with Hono that allows the creation and retrieval of comments. - [Build a Staff Directory Application](https://docs.ahq.lat/d1/tutorials/build-a-staff-directory-app/index.md): Build a staff directory using D1. Users access employee info; admins add new employees within the app. - [Build an API to access D1 using a proxy Worker](https://docs.ahq.lat/d1/tutorials/build-an-api-to-access-d1/index.md): This tutorial shows how to create an API that allows you to securely run queries against a D1 database. The API can be used to customize access controls and/or limit what tables can be queried. - [Query D1 using Prisma ORM](https://docs.ahq.lat/d1/tutorials/d1-and-prisma-orm/index.md): This tutorial shows you how to set up and deploy a Cloudflare Worker that is accessing a D1 database from scratch. - [Bulk import to D1 using REST API](https://docs.ahq.lat/d1/tutorials/import-to-d1-with-rest-api/index.md): This tutorial uses the REST API to import a database into D1. - [Using D1 Read Replication for your e-commerce website](https://docs.ahq.lat/d1/tutorials/using-read-replication-for-e-com/index.md): D1 Read Replication is a feature that allows you to replicate your D1 database to multiple regions. This is useful for your e-commerce website, as it reduces read latencies and improves read throughput. ## Demos and architectures - [Demos and architectures](https://docs.ahq.lat/d1/demos/index.md): Explore demo applications and reference architectures that use D1 databases. ## best-practices - [Import and export data](https://docs.ahq.lat/d1/best-practices/import-export-data/index.md): Import existing SQLite tables into D1 or export a D1 database for local use. - [Local development](https://docs.ahq.lat/d1/best-practices/local-development/index.md): Run D1 locally with Wrangler to test your Worker and database before deploying to production. - [Query a database](https://docs.ahq.lat/d1/best-practices/query-d1/index.md): Query D1 using SQL statements through the Workers Binding API, REST API, or Wrangler commands. - [Global read replication](https://docs.ahq.lat/d1/best-practices/read-replication/index.md): Reduce read latency and scale throughput by replicating D1 databases across regions globally. - [Remote development](https://docs.ahq.lat/d1/best-practices/remote-development/index.md): Develop against a D1 database remotely using the Cloudflare dashboard playground. - [Retry queries](https://docs.ahq.lat/d1/best-practices/retry-queries/index.md): Handle transient D1 errors by retrying write queries with exponential backoff. - [Use D1 from Pages](https://docs.ahq.lat/pages/functions/bindings/#d1-databasesindex.md): Bind a D1 database to a Cloudflare Pages project using Pages Functions. - [Use indexes](https://docs.ahq.lat/d1/best-practices/use-indexes/index.md): Improve D1 query performance by creating indexes on frequently queried columns. ## configuration - [Data location](https://docs.ahq.lat/d1/configuration/data-location/index.md): Control where D1 stores your data by setting location hints or jurisdiction constraints. - [Environments](https://docs.ahq.lat/d1/configuration/environments/index.md): Configure separate D1 databases for staging and production Wrangler environments. ## observability - [Audit Logs](https://docs.ahq.lat/d1/observability/audit-logs/index.md): Review audit log entries for configuration changes made to your D1 databases. - [Billing](https://docs.ahq.lat/d1/observability/billing/index.md): Track D1 billing metrics including rows read, rows written, and storage usage across your account. - [Debug D1](https://docs.ahq.lat/d1/observability/debug-d1/index.md): Capture exceptions and log error messages returned from D1 database queries. - [Metrics and analytics](https://docs.ahq.lat/d1/observability/metrics-analytics/index.md): Inspect D1 query volume, latency, and storage size via the dashboard or GraphQL Analytics API. ## platform - [Alpha database migration guide](https://docs.ahq.lat/d1/platform/alpha-migration/index.md): Migrate D1 alpha databases to the production-ready storage backend. - [Limits](https://docs.ahq.lat/d1/platform/limits/index.md): D1 account and database limits for storage, queries, row sizes, and SQL statements. - [Pricing](https://docs.ahq.lat/d1/platform/pricing/index.md): D1 pricing based on rows read, rows written, and storage with scale-to-zero billing. - [Release notes](https://docs.ahq.lat/d1/platform/release-notes/index.md): Track D1 feature updates, bug fixes, and breaking changes over time. - [Choose a data or storage product](https://docs.ahq.lat/workers/platform/storage-options/index.md): Compare Cloudflare storage products including D1, KV, R2, and Durable Objects to find the right fit. ## reference - [Backups (Legacy)](https://docs.ahq.lat/d1/reference/backups/index.md): Create, list, download, and restore legacy snapshot-based backups for D1 alpha databases using Wrangler. - [Community projects](https://docs.ahq.lat/d1/reference/community-projects/index.md): Explore community-built ORMs, query builders, and tools that integrate with D1. - [Data security](https://docs.ahq.lat/d1/reference/data-security/index.md): D1 encrypts data at rest and in transit, and is covered by Cloudflare's SOC 2 and ISO 27001 compliance certifications. - [FAQs](https://docs.ahq.lat/d1/reference/faq/index.md): Frequently asked questions about D1 pricing, limits, and usage. - [Generated columns](https://docs.ahq.lat/d1/reference/generated-columns/index.md): Define virtual or stored generated columns in D1 to automatically compute values from other columns, SQL functions, or JSON data. - [Glossary](https://docs.ahq.lat/d1/reference/glossary/index.md): Definitions of key terms used throughout the D1 documentation. - [Migrations](https://docs.ahq.lat/d1/reference/migrations/index.md): Version your D1 database schema using SQL migration files that you create, list, and apply with Wrangler. - [Time Travel and backups](https://docs.ahq.lat/d1/reference/time-travel/index.md): Restore a D1 database to any minute within the last 30 days using Time Travel point-in-time recovery. ## sql-api - [Define foreign keys](https://docs.ahq.lat/d1/sql-api/foreign-keys/index.md): Enforce relational integrity across D1 tables by defining and deferring foreign key constraints. - [Query JSON](https://docs.ahq.lat/d1/sql-api/query-json/index.md): Extract, insert, and manipulate JSON data stored in D1 using built-in SQLite JSON functions. - [SQL statements](https://docs.ahq.lat/d1/sql-api/sql-statements/index.md): Supported SQL statements, PRAGMA commands, and SQLite extensions available in D1.