Skip to content
pubscout

bones_api

1.35.2, released 5 days ago by an unverified publisher

A powerful API backend framework for Dart with HTTP server, routing, SQL translator, and DB adapters.

WASM-ready
$ flutter pub add bones_api
Source repository

What it does

Bones_API provides a comprehensive backend framework for Dart featuring an integrated HTTP server, modular route handling, entity handlers, a built-in SQL translator, and database adapters. It also includes cron job scheduling, static file hosting with virtual aliases, and a command-line interface.

AI-written summary of version 1.34.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • Building a backend API server in Dart
  • Needing built-in routing, entity management, and SQL/database adapters
  • Requiring scheduled background cron tasks and static file serving with aliases

Skip it when

  • Building frontend UI applications (it's a backend framework)
  • Looking for a minimalist routing-only package like shelf without extra framework layers

Strengths

  • Comprehensive all-in-one framework including HTTP server, routing, and DB adapters
  • Built-in cron scheduler with IANA time zones and retries
  • Advanced static file server features with `.aliases` path mapping

Weaknesses

  • Large dependency footprint due to covering server, database, and utilities
  • Less modular for developers who want to pick and choose individual micro-packages

Setup

Kind
Pure Dart
Effort
Medium
Code generation
No
Direct dependencies
45

Activate the CLI globally using 'dart pub global activate bones_api' and configure your API routes and server modules in code.

import 'package:bones_api/bones_api_server.dart';

class MyBTCModule extends APIModule {
  MyBTCModule(APIRoot apiRoot) : super(apiRoot, 'btc');

  @override
  void configure() {
    routes.get('time', (request) => APIResponse.ok(DateTime.now()));
  }
}

class MyAPI extends APIRoot {
  MyAPI() : super('example', '1.0');
  @override
  Set<APIModule> loadModules() => {MyBTCModule(this)};
}

void main() async {
  var api = MyAPI();
  var serverPort = await startAPIServer(api);
  print('Server started on port $serverPort');
}

Alternatives

Packages that do the same job and could replace bones_api.

Works with

Packages commonly used together with bones_api: ones it builds on, ones built on it, and its own family.