Popular Lesson
Set up a new backend server using Cloudflare Workers
Understand how an API enables the frontend and backend to communicate
Use the Wrangler CLI to initialize and manage your backend project files
Configure a cloud-based backend that can eventually be deployed publicly
Create a simple API endpoint for listing exercises
Centralize frontend-backend communication with a dedicated helper file
This lesson marks the transition from frontend development to building your application's backend. So far, your prototype has taken shape with interactive UI elements such as a calendar and meal selection. Now, you’ll establish a server that can handle requests and store information beyond a single browser session.
By introducing a backend API, you give your frontend the power to save and retrieve data—such as user-created workouts—even after a browser refresh. This is essential for any product that persists user data. You’ll begin by creating an API endpoint to serve exercise data, migrating it from the frontend to the backend for better data management and scalability.
You’ll use Cloudflare Workers, a modern approach to backend development that avoids the hassle of operating your own servers. This method is ideal for rapidly launching backend features, especially when you’re iterating quickly or scaling an early-stage product. The lesson is a helpful foundation for anyone building apps that require robust frontend-backend communication or plan to deploy projects to the web.
This lesson is designed for learners who are ready to move their projects beyond a static or browser-only state.
Setting up a backend is a standard step when your app needs to store data or handle user actions server-side. In this workflow, you shift from handling everything in the browser to having a persistent location for core information—like available exercises or saved workouts.
For example, after building an interactive workout planner UI, you now need to ensure users’ progress isn’t lost when they leave or refresh the page. By building your backend server, you enable the UI to request and update exercise data through clearly defined API endpoints. Later, the same structure will allow you to add database functionality and advanced features without breaking the front end.
This lesson is a foundation for all subsequent backend-driven capabilities.
Previously, you may have stored all information directly in the frontend or relied on static files. This only works until users expect persistent, user-specific data. Manually updating every change across the UI can introduce mistakes and inconsistencies.
Moving to a Cloudflare Workers backend gives you a clean API and standard way for your frontend to request or update information. The Wrangler CLI and server folder streamline your project organization, making deployments safer and development more predictable.
For instance, when you move the exercises data to the backend, any update there instantly syncs with every user interface—without manual updates. As your app grows, this architecture will save hours of debugging and let you scale or add features with much less friction.
To put this lesson into action, try centralizing UI communication and confirming connectivity:
This exercise will help reinforce the principle of separating data storage from your UI logic.
You’ve just taken the first major step into backend development by creating a working server and API for your project. Up to now, you focused on frontend features and design; now, your app is positioned for real data management.
In previous lessons, you set up interactivity and drafted your app’s core experience. Now, with an API in place, you’re set to make your application persistent and data-driven. Next, you’ll discover how to link your backend to a database, allowing users to truly store, retrieve, and manage their workouts through your app.
Ready to deepen your backend skills? Continue through the course for hands-on API and database integration techniques.