A Dart backend is a running process that receives requests, enforces rules and returns responses. It is separate from a Flutter UI and from this static tutorial website. Begin with one feature and a clear data flow before adopting a large framework.
Choose the amount of framework you need
Shelf provides composable handlers and middleware. Dart Frog adds a routing/application workflow. Serverpod offers a larger full-stack approach with generated client/server integration. Serverless Dart functions are another deployment architecture. Choose from the needed authentication, database, operational and team constraints; these options are not interchangeable packages to install together.
This course uses Shelf for the worked REST API so the request and response boundaries remain visible. The server-side Dart overview lists the current framework options. Package setup and service hosting are separate decisions.
Trace one request
HTTP request
-> transport validation and authenticated identity
-> application service / authorization rule
-> repository operation
-> typed result
-> JSON response and status
For example, creating a task first checks the media type and JSON shape. The service applies a title rule and ownership policy. A repository stores the approved task. The handler converts the result into a 201 response with a Location header.
The learning project combines a small service operation with the handler for readability. Its TaskStore owns in-memory data and is injected into the application factory. As the application grows, extract the domain service rather than putting database queries and widget logic into one file.
Keep the client boundary honest
The Flutter app calls a documented HTTP contract. It does not connect directly to a privileged PostgreSQL account or reuse a server’s credentials. A shared DTO package can reduce model duplication, but the server still validates input and authorizes each operation.
Know the teaching boundary
The downloadable API has ephemeral storage and no identity provider. It binds to loopback by default for local learning. Public use requires the authentication, durable storage, limits and operational work described later in this chapter. A passing CRUD test does not supply those missing production capabilities.
Exercise
Sketch the same flow for “mark my task complete.” Identify which layer parses the ID, verifies ownership, updates storage and selects the response. Then choose whether your next app needs a minimal handler stack or a more integrated framework and explain the trade-off.