archery 1.2.2 copy "archery: ^1.2.2" to clipboard
archery: ^1.2.2 copied to clipboard

A full-stack web development framework for Dart lang.


Archery - A Full-Stack Web Framework for Dart #

Laravel-inspired developer flow. Dart-native performance.
A readable, minimal, batteries-included backend framework for Dart 3.


Why Archery #

Archery reimagines backend development in Dart with a small set of predictable building blocks:

  • Predictable – explicit, type‑safe APIs. No hidden magic.
  • Minimal – keep the surface area tiny; build only what’s needed.
  • Composable – IoC container + providers let features snap together.
  • Fast – built directly on dart:io for zero overhead

Features #

  • IoC Container - simple, predictable dependency resolution
  • HTTP Kernel & Router - controllers, middleware, groups, typed params
  • HTML Templating Engine - Blade-style includes & layouts
  • ORM (JSON + SQLite) - migrations, models, CRUD helpers
  • Auth System - login, register, sessions, middleware
  • Static File Server - safe MIME mapping, caching, SPA fallback
  • Config Loader - JSON configs with dot-notation access
  • Example App - routes, controllers, auth views, blog, todos

Archery aims to stay small, explicit, and easy to read—without sacrificing the comforts of a real framework.


Project Structure #

lib/
    archery/                            # Framework core
        core/
            application.dart            # App lifecycle & provider registry
            container.dart              # ServiceContainer (DI)
            config.dart                 # JSON config loader
            kernel.dart                 # HTTP kernel
            provider.dart               # Provider base class
            template_engine.dart        # HTML templating engine
            static_files_server.dart
    
            http/
              router.dart               # Routes, groups, params, middleware
              body_parser.dart          # Form-data, URL-encoded, JSON, file uploads
              extensions.dart           # request.view(), request.json(), redirects

            orm/
              model.dart                # Base Model API
              json_file_model.dart
              sqlite_model.dart
              hasher.dart

            auth/
              auth_session.dart         # Sessions, login/logout, auth middleware
              
    src/                                # project source code
        config/                         # app.json, server.json
        database/                       # User model + migrations
        http/
            routes/                     # web.dart, api.dart
            controllers/
            views/                      # HTML templates
            public/                     # css/js/img
        apps/
            todos.dart                  # Todo model + routes

Getting Started #

1. Install dependencies #

git clone https://github.com/webarchery/archery
cd archery
dart pub get

2. Run the server #

dart run bin/server.dart

Default server config lives in lib/src/config/server.json:

{
  "domain": "localhost",
  "port": 5501,
  "compress": true
}

Visit your app at:

http://localhost:5501

3. (Optional) Enable live reload #

Install dartmon_cli for reloading server

dart pub global activate dartmon_cli

dartmon run bin/server.dart

BrowserSync watches HTML/CSS/JS/Dart files.

npm install
npm run start

Core Concepts #

App & Container #

App bootstraps the framework and exposes a DI container:

final app = App();
await app.boot();

The container supports:

  • bind (transient)
  • singleton
  • bindInstance
  • scoped containers
  • disposal callbacks

Routing #

  • GET/POST/PUT/PATCH/DELETE
  • Route groups and middleware
  • Typed params: {id:int}, {slug:string}
  • RouteParams.get<T>() for safe access
router.get('/blog/{slug:string}', BlogPagesController.show);

Templates #

Blade-style templates in lib/src/http/views:

@include('includes._main-header')
<h1>{{ title }}</h1>
@include('includes._main-footer')

Render in controllers:

return request.view('welcome', {'title': 'Hello'});

Request Helpers #

  • request.input('field')
  • request.file('avatar')
  • request.files()
  • request.json(data)
  • request.view(template, data)
  • request.redirectToLogin() / redirectBack()

Handles:

  • JSON
  • URL-encoded forms
  • Multipart forms + file uploads (UploadedFile)

ORM #

Two backends:

  • JsonFileModel — fast prototyping
  • SQLiteModel — SQLite persistence (via sqflite_common_ffi)

Models implement:

static fromJson(Map json)
toJson(),    // for public api fields
toMetaJson() // for private db fields
Map<String, String> columnDefinitions

Migrations are plain Dart functions (lib/src/database/migrations.dart).

Auth #

Located in archery/auth/auth_session.dart:

  • Cookie-based sessions

  • 1-hour expiration

  • Auth.user(request) returns User?

  • Auth.check(request) returns bool

  • Auth.middleware / Guest.middleware

  • Auth routes + views included:

    • /login
    • /register
    • /logout
    • /user/profile
    • /user/dashboard

Example Features Included #

  • Blog demo (/blog)
  • Todos demo (/todos) with full CRUD
  • Auth pages and dashboard
  • Welcome screen
  • Asset pipeline via public/

These examples double as documentation for how to structure your own app.


Roadmap #

  • CLI: archery new <app>
  • View macros & control structures
  • ORM relations
  • Mailer
  • Queue workers
  • Testing utilities

License #

BSD-3-Clause See LICENSE file for details.

1
likes
145
points
38
downloads

Publisher

verified publisherwebarchery.dev

Weekly Downloads

A full-stack web development framework for Dart lang.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

collection, crypto, ffi, http, intl, mime, path, sqflite_common_ffi, uuid

More

Packages that depend on archery