Learn how to deploy the Text Summarizer application using Cloudflare's command-line interface.
This guide shows you how to deploy the Text Summarizer application (App 1 from the main tutorial) using Cloudflare's Wrangler CLI instead of the dashboard approach.
Note: Wrangler is Cloudflare's command-line interface for developing and deploying Workers. Using Wrangler provides more flexibility for local development, version control, and CI/CD integration compared to the dashboard approach.
Before you begin, you'll need:
First, you need to install Wrangler globally on your system:
Verify the installation by checking the version:
Authenticate Wrangler with your Cloudflare account:
This will open a browser window where you can log in to your Cloudflare account and authorize Wrangler.
Create a new directory for your project and initialize it:
When prompted, select:
YyHello World Workern (optional, choose yes if you prefer TypeScript)YOpen the wrangler.toml file and add the AI binding configuration:
Replace the contents of src/index.js with the Text Summarizer application code (the same code from App 1).
Note: This is the same code that's used in the dashboard version, but deployed via Wrangler CLI instead.
Before deploying, you can test your application locally:
This will start a local development server, typically at http://localhost:8787. Open this URL in your browser to test your application.
Important: When testing locally, the AI binding may not work as expected since it requires access to Cloudflare's infrastructure. You might see errors related to the AI binding. This is normal during local development, but the application will work correctly when deployed to Cloudflare's network.
When you're ready to deploy your application to Cloudflare's global network:
After successful deployment, Wrangler will output the URL of your deployed Worker (typically https://text-summarizer.[your-subdomain].workers.dev).
To switch from Mistral to DeepSeek model, edit src/index.js and find this line:
Replace it with:
Then redeploy your application with wrangler deploy.