Using D1 outside worker?

Hi,

Is it possible to use Cloudflare D1 outside the Cloudflare workers ?

If not, then does CF terms allow exposing an API through Cloudflare workers for D1 and using that api for outer application for database related operations?
Has anyone tried this approach ?

P.S: Latency is not problem for me that is why i am thinking of exposing DB api through Cloudflare workers

2 Likes

I don’t believe in D1’s current state.

That is unknown at this point. However, other storage like KV, and R2 has been accessible outside of workers so maybe.

Hey! I was wondering, are there by any chance any updates regarding this? I’d love to see the option to use D1 outside of Cloudflare Workers like how it’s possible to use R2 outside of Workers.

1 Like

It looks like D1 has a http api you could use to query the database from outside of a worker:

What are the pros/cons of using the HTTP api over the D1 client API which gets exposed in the worker environment?