2024-12-09-nile-cloudflare/cover.png
2024-12-09
1 min read
gwenshap profile pic
Gwen Shapira

Bringing Nile and Cloudflare together with Hyperdrive

We are excited to announce Nile's integration with Cloudflare Workers and Cloudflare Hyperdrive.

Cloudflare Workers enables you to deploy serverless functions or even entire application backends globally, drastically reducing latency between your application and users for a smoother experience. Meanwhile, Cloudflare Hyperdrive acts as a caching proxy, accelerating database access for Cloudflare Workers to deliver exceptional speed and performance.

With this integration, you can build B2B applications and effortlessly deploy them worldwide, ensuring top-notch performance and an outstanding user experience.

Why use Nile database with Cloudflare?

  • Global Scale
    Deploy your B2B applications worldwide using Cloudflare Workers, while Nile ensures tenant isolation, auth-scaling and tenant insights.

  • Accelerated Performance
    Leverage Cloudflare Hyperdrive to accelerate database queries, making interactions lightning-fast for your users.

  • Multi-Tenant Isolation
    Nile's tenant-aware architecture ensures that your customers' data is securely isolated, enabling you to build scalable and compliant apps effortlessly.

  • Simplified Deployment
    Combine Nile's serverless Postgres with Cloudflare's edge network to streamline the deployment of modern B2B applications with less operational overhead.

  • Optimized for AI Workloads
    Build AI-driven, multi-tenant applications with Nile and deploy them globally with Cloudflare. This architecture will minimize latency while easily scaling to millions of embeddings.

Using Nile and Cloudflare together

1. Create a database
Login to Nile, create a database, create the tables you need and grab a connection string with credentials.

2. Create or clone a serverless app
It is easy to start with an existing example:

git clone https://github.com/niledatabase/niledatabase
cd niledatabase/examples/integrations/cloudflare/

This example uses Hono, a lightweight web framework, and Drizzle, a lightweight ORM, to build a multi-tenant todo list app.

3. Create Hyperdrive configuration
Configure Cloudflare Hyperdrive with the connection string you got from Nile:

npx wrangler hyperdrive create your_config_name \
--connection-string="postgres://..."

Update wrangler.toml with the Hyperdrive ID that the command above returned.

4. Deploy
Use npm run dev to test the app locally or npm run deploy to run the app on Cloudflare workers.

Thats it! You now have a globally accelerated multi-tenant application.

Next steps

Create Nile and Cloudflare accounts and start shipping. You can read more about the integration in Cloudflare's documentation.