cd /news/developer-tools/i-built-fast-api-but-for-flutter-dar… · home topics developer-tools article
[ARTICLE · art-137658] src=dev.to ↗ pub= topic=developer-tools verified=true sentiment=↑ positive

I Built Fast API, but for Flutter/Dart & AI

A developer has released fast_crud_api, an open-source Dart and Flutter package that provides a lightweight, customizable CRUD API server built on the shelf middleware library. The package exposes /create, /read, /update, and /delete endpoints, which the developer says can give AI agents a pathway to control specific app functionality, such as managing notes in a Flutter app. It also supports custom routes for developers who want to skip the built-in CRUD scaffolding.

by read4 min views1 publishedSep 23, 2026

One of my favorite Python Packages is fastapi. I love how you can build an API server very quickly with minimal code. Then, to top it off, you can use its built-in Swagger UI to test your API.

To my knowledge, Flutter/Dart has no package that does this...

I will build it myself...

You got me! It was really to connect AI Agents to my Flutter applications- why, of course!

I did not build this package from the ground up; I had some help!

Introducing shelf, a web-server middleware package for Dart.

I used shelf to create a Flutter package named fast_crud_api.

fast_crud_api is a lightweight, simple, and customizable CRUD API Server in Dart.

CRUD is an acronym for Create, Read, Update, and Delete, representing the four fundamental operations for managing persistent data in software applications and databases.

I built CRUD into the package because it creates a pathway for an AI Agent to control specific app functionality. With four endpoints (/create, /read, /update, and /delete).

For example, if I created a notes app in Flutter. With fast_crud_api, I could connect an AI Agent to create, read, update, and delete notes. Effectively giving the AI Agent a new skill that it can use.

Likewise, you could leave the CRUD out of it and create a custom API instead!

APIServer is the main implementation and has the following parameters:

class APIServer {
  final String? apiName;
  final Future<Response> Function(Request)? create;
  final Future<Response> Function(Request)? read;
  final Future<Response> Function(Request)? update;
  final Future<Response> Function(Request)? delete;
  final int? port;
  final int? version;
  final List<CustomRoute>? routes;
  final bool? noCRUD;
  final bool? logger;

  APIServer({
    this.create,
    this.read,
    this.update,
    this.delete,
    this.port,
    this.version,
    this.apiName,
    this.routes,
    this.noCRUD,
    this.logger,
  });
}

start() that creates and starts the API server. Now let's add fast_crud_api to your Flutter or Dart project.

fast_crud_api to your Flutter/Dart app: shelf to your pubspec.yaml file:

dependencies:
  shelf: any
  fast_crud_api:
    git:
      url: https://github.com/DylanScottMickelson/fast_crud_api.git

Now, run flutter pub get or dart pub get in your terminal/command prompt to install the package and its dependencies.

Add this example code inside your main.dart file:

import 'package:fast_crud_api/fast_crud_api.dart';
import 'package:shelf/shelf.dart';

void main() async {
  /// Define your create, read, update, and delete functions here...
  Future<Response> createFunction(Request request) async {
    return Response.ok("Created!");
  }

  Future<Response> readFunction(Request request) async {
    return Response.ok("Read!");
  }

  Future<Response> updateFunction(Request request) async {
    return Response.ok("Updated!");
  }

  Future<Response> deleteFunction(Request request) async {
    return Response.ok("Deleted!");
  }
  /// Create API Server Implementation
  final apiServer = APIServer(
    create: (request) => createFunction(request),
    read: (request) => readFunction(request),
    update: (request) => updateFunction(request),
    delete: (request) => deleteFunction(request),
    port: 6969,
    version: 1,
    apiName: "My API",
    noCRUD: false,
    logger: true,
  );
  ///Start API Server
  await apiServer.start();
}
import 'package:fast_crud_api/custom_route.dart';
import 'package:fast_crud_api/fast_crud_api.dart';
import 'package:shelf/shelf.dart';

void main() async {
  final handler = Response.notFound;

  /// Define your create, read, update, and delete functions here...
  Future<Response> createFunction(Request request) {
    return Response.ok("Created!");
  }

  Future<Response> readFunction(Request request) {
    return Response.ok("Read!");
  }

  Future<Response> updateFunction(Request request) {
    return Response.ok("Updated!");
  }

  Future<Response> deleteFunction(Request request) {
    return Response.ok("Deleted!");
  }

  /// Define your custom endpoints here...
  final customRoute1 = CustomRoute(
    endpoint: "users",
    method: "GET",
    handler: (request) => Response.ok("Users Read!"),
  );

  final apiServer = APIServer(
    create: (request) => createFunction(request),
    read: (request) => readFunction(request),
    update: (request) => updateFunction(request),
    delete: (request) => deleteFunction(request),
    port: 6969,
    version: 1,
    apiName: "My API",
    noCRUD: false,
    logger: true,
    routes: [customRoute1],
  );

  await apiServer.start();
}
import 'dart:convert';

import 'package:fast_crud_api/custom_route.dart';
import 'package:fast_crud_api/fast_crud_api.dart';
import 'package:shelf/shelf.dart';

void main() async {
  /// Define your custom endpoints here...
  final customRoute1 = CustomRoute(
    endpoint: "users",
    method: "GET",
    handler: (request) => Response.ok(jsonEncode({"users": []})),
  );

  final apiServer = APIServer(
    port: 6969,
    version: 1,
    apiName: "My API",
    noCRUD: true,
    logger: true,
    routes: [customRoute1],
  );

  await apiServer.start();
}

Production:

Go to http://ip_address:chosen_port/api/docs/

Test:

Go to http://127.0.0.1:6969/api/docs/

Production:

Test:

Building an efficient backend layer for a modern application can often feel like solving multiple puzzles at once. But with fast_crud_api, that process is streamlined significantly.

By leveraging Dart's power and the shelf package, fast_crud_api provides developers with a lightweight, and customizable API server.

The key takeaway isn't just how to set up an API server in Flutter/Dart, but what you can do with it. Namely, giving AI Agents standardized, reliable endpoints (Create, Read, Update, Delete) that allow them to interact with your application data seamlessly.

I hope this walkthrough was helpful! Comment and let me know what you think, or dive into the code in the GitHub repo.

Happy coding! 🧑💻

── more in #developer-tools 4 stories · sorted by recency
── more on @fast_crud_api 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/i-built-fast-api-but…] indexed:0 read:4min 2026-09-23 ·