D1

1

Overview

How D1 works

D1 is Cloudflare's serverless SQL database, built on SQLite and natively integrated with Workers. Your application queries data without managing servers.

Think of it this way

It's like having a managed SQL library. You ask familiar SQLite questions and Cloudflare handles operation, recovery, and read distribution.

Features

  • SQLite semantics
  • Native binding
  • Prepared statements
  • Time Travel
1/9
WORKER APP💻🔍 Consultando o bancoMIGRATIONS🛠️🛠️ Atualiza a estruturaCLOUDFLARE D1D1 BINDINGDirect access from the environment, no connection string⚙️wrangler.jsonc→🔗env.DB→🗄️SQLiteCONSULTA SEGURA🔍"Buscar usuário pelo ID"🛡️ protegido contra injeçãoVÁRIAS EM 1 VIAGEM123→🗄️3 perguntas, uma resposta sótudo ou nada (atômico)SQLITE GERENCIADOTablesIndexJoinsTransaçõesRÉPLICAS DE LEITURA✍️Primary📖Replica SPreads closer to the userSESSÃO CONTÍNUA🔄conversa contínua com o bancoideal até 15 minRESULTADOS✅ 1 registro encontrado👤 Ana (id: 1)⚡ Retorno instantâneoTIME TRAVELAgora7 dias atrás↺ RestaurarLEGENDAFluxo ativo na etapaHover