shellstone 0.1.6

  • Installing
  • Versions
  • 6


Inspired by Shelf, Redstone and js frameworks like Sails, Shellstone is a server side framework to provide a form of ORM, routing and other various features

Build Status [![Join the chat at](](

Note: This is a currently a WIP. It is still a pre-release and its not possible to do relations currently


Currently it is possible to connect to a DB and access data via the model definitions and the query syntax. The next features to arrive will be the table creation and relations between models which will put the project to at least a usable version. In the current form there is an adapter for mysql and postgres.


Shellstone is driven by annotated definitions. Primarily the @Model and @Attr annotations which define a Model which translates to essentially a table or collection and the Attr which defines fields or columns.

To be able to use the annotations, Shellstone must run and scan in the metadata. It is started using the following example:

import 'package:shellstone/shellstone.dart';

main() async {
  await strapIn();


You can annotate a @Model as per the following simple example

import 'package:shellstone/shellstone.dart';

// Annotate this class as being a Model class with identity user
@Model(name: 'user', source: 'mysql')
class User {

  // Create the attributes. They usethe @Attr annotation
  @Attr(primaryKey: true) int id;
  @Attr(unique: true) String username;
  @Attr() String password;
  @Attr(column: 'firstName') String firstname;
  @Attr(column: 'lastName') String lastname;

The following attributes are possible for the @Model annotation

  • name - The name of the underlying table. Defaults to the name of the annotated class
  • source - The source database, e.g. postgres. Defaults to mysql
  • migration - The migration strategy to use for table / db construction during build. Defaults to safe


Defined with the @Attr annotation shown above, currently a field must be annotated for it to be included in a model. A later feature will change this. The possible values are

  • primaryKey - Indicates that the field is the primary key. Currently this is required for at least one field
  • type - _The type of the field in the database. By default this is inferred from the dart type declared. Current possible types are: string,integer,double,datetime* (Coming soon...)
  • column - The name of the field. By default the declaration is used but this can be use to override. The Postgres adapter, for example, sneakily changes these to lower case

There are more fields but they are not yet implemented so they will be added to the doc once complete.


You can use Hooks and Listeners to perform functions when an event occurs. A common case will be to setup the database connection parameters during the configure event. Note that the event would be triggered for each adapter in the below example and the would have a name == <adapter> there.

import 'package:shellstone/shellstone.dart';

setCredentials(event) {
  var adapter =;

  adapter.user = 'root';
  adapter.password = 'root'; = '';
  adapter.db = 'test';

There are also listeners which you can do something special with

doSomethingSpecial(event) {
  // Who knows what, log stuff?

A lot more events will be coming. With that, there may be changes to this so take that into consideration.

Data Access

There is a form of query chain that can be build up to interact with data. The query language structure looks like the following simple examples:

main() async {
  // Setup Shellstone
  await Shellstone.setup();

  // Get the first user where it matches the query
  User user = await Model.find(User).where('username').eq('1234').run();

  // Get user using filter (the filter is lazily executed on the streaming query results)
  user = await Model.find('User').filter((user) => user.lastName == 'Smith').run();

  // Find all users (String or Type are valid args)
  List<User> users = await Model.findAll('User').run();

  // Insert a user object
  List ids = await Model.insertFrom(user).run();

  // Insert some values to the user set
  List ids = await Model.insert(User,{
    'firstName': 'Bill',
    'lastName': 'Smith'

  // Update the given user
  int modified = await Model.updateFrom(user).run();

  // Remove the user
  modified = await Model.removeFrom(user).run();

  // Update a user by condition
  modified = await Model.update(User,{

The following actions are available:

  • find - Find the first entity matching some condition or filter
  • findAll - Find all the entities matching some condition or filter
  • insert - Insert some values into a defined model as a map of name / values or a list of maps
  • insertFrom - Insert from some constructed entity or list of entities
  • update - Update some values into a defined model as a map of name / values
  • updateFrom - Update some entities by their constructed instances
  • remove - Remove entities where they match some query chain
  • removeFrom - Remove entities by referencing a constructed instance or list of instances

In cases where entities are provided, the primaryKey is used as the lookup and so that is why it is required.

Take a look at the tests for even more examples


Check the issues for a clearer set of upcoming features. However know that the following are features that are in the immediate future

  • Relations between models
  • Richer query set including modifiers


I wanted to create this project because I think dart is a really great language. Instead of npm initializing another package, it seemed like a good idea to try and contribute to the Dart community instead.

I would be happy for any contributions so to try and make that as easy as possible I will be talking to myself in the issues about ideas and plans so that would also be a good place to look and know what is coming. Since the project is still far off being really usable I am breaking up ideas as features and working them into a milestone branch. Once a good base is there then will change the approach.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  shellstone: ^0.1.6

2. Install it

You can install packages from the command line:

with pub:

$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:shellstone/shellstone.dart';
Version Uploaded Documentation Archive
0.1.6 May 18, 2016 Go to the documentation of shellstone 0.1.6 Download shellstone 0.1.6 archive
0.1.5 May 14, 2016 Go to the documentation of shellstone 0.1.5 Download shellstone 0.1.5 archive
0.1.4 May 13, 2016 Go to the documentation of shellstone 0.1.4 Download shellstone 0.1.4 archive
0.1.3 May 9, 2016 Go to the documentation of shellstone 0.1.3 Download shellstone 0.1.3 archive
0.1.2 May 4, 2016 Go to the documentation of shellstone 0.1.2 Download shellstone 0.1.2 archive
0.1.1 May 4, 2016 Go to the documentation of shellstone 0.1.1 Download shellstone 0.1.1 archive
0.1.0 May 4, 2016 Go to the documentation of shellstone 0.1.0 Download shellstone 0.1.0 archive
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jul 20, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.69.0
  • pana: 0.11.7


Detected platforms: other

Primary library: package:shellstone/shellstone.dart with components: io, mirrors.

Issues and suggestions

Fix lib/src/datalayer/querylang/tokens/condition.dart.

Analysis of lib/src/datalayer/querylang/tokens/condition.dart failed with 8 errors, 2 hints, including:

line 23 col 7: Inconsistent declarations of 'and' are inherited from (dynamic) → dynamic, (dynamic) → SingleResultFilter.

line 23 col 7: Inconsistent declarations of 'or' are inherited from (dynamic) → dynamic, (dynamic) → SingleResultFilter.

line 23 col 17: Base class introduces an invalid override. The type of 'Selector.and' ('(dynamic) → dynamic') isn't a subtype of 'SingleResultSelector.and' ('(dynamic) → SingleResultFilter').

line 23 col 17: Base class introduces an invalid override. The type of 'Selector.or' ('(dynamic) → dynamic') isn't a subtype of 'SingleResultSelector.or' ('(dynamic) → SingleResultFilter').

line 28 col 3: Invalid override. The type of 'Condition.sort' ('(dynamic, dynamic) → dynamic') isn't a subtype of 'SingleResultModifier.sort' ('(dynamic, dynamic) → SingleResultModifier').

Fix lib/src/datalayer/querylang/tokens/modifier.dart.

Analysis of lib/src/datalayer/querylang/tokens/modifier.dart failed with 4 errors:

line 24 col 3: Invalid override. The type of 'Modifier.sort' ('(dynamic, dynamic) → dynamic') isn't a subtype of 'SingleResultModifier.sort' ('(dynamic, dynamic) → SingleResultModifier').

line 25 col 3: Invalid override. The type of 'Modifier.skip' ('(int) → dynamic') isn't a subtype of 'SingleResultModifier.skip' ('(int) → SingleResultModifier').

line 26 col 3: Invalid override. The type of 'Modifier.limit' ('(int) → dynamic') isn't a subtype of 'SingleResultModifier.limit' ('(int) → SingleResultModifier').

line 28 col 3: Invalid override. The type of '' ('() → dynamic') isn't a subtype of '' ('() → Future<dynamic>').

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see


Changelog entries help clients to follow the progress in your code.

Use constrained dependencies.

The pubspec.yaml contains 1 dependency without version constraints. Specify version ranges for the following dependencies: postgresql.

Package is too old.

The package was released more than two years ago.

Fix additional 30 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/src/datalayer/querylang/tokens/query.dart (3 errors)
  • lib/shellstone.dart (1 error)
  • lib/src/datalayer/adapters/mysql/mysql_adapter.dart (1 error, 2 hints)
  • lib/src/datalayer/adapters/postgres/postgres_adapter.dart (1 error, 2 hints)
  • lib/src/datalayer/querylang/tokens/update.dart (1 error, 2 hints)
  • lib/src/datalayer/querylang/query_runner.dart (1 error)
  • lib/src/datalayer/querylang/tokens/insertion.dart (1 error)
  • lib/src/datalayer/querylang/tokens/removal.dart (1 error)
  • lib/src/internal/globals.dart (1 error)
  • lib/src/datalayer/querylang/query_chain.dart (2 hints)
  • lib/src/metadata/metadata.dart (2 hints)
  • lib/src/datalayer/adapters/postgres/postgres_query_executor.dart (1 hint)
  • lib/src/datalayer/adapters/sql_adapter.dart (1 hint)
  • lib/src/datalayer/adapters/sql_builder.dart (Run dartfmt to format lib/src/datalayer/adapters/sql_builder.dart.)
  • lib/src/datalayer/adapters/sql_executor.dart (1 hint)
  • lib/src/datalayer/database_adapter.dart (1 hint)
  • lib/src/datalayer/querylang/query_action.dart (Run dartfmt to format lib/src/datalayer/querylang/query_action.dart.)
  • lib/src/datalayer/querylang/tokens/filter.dart (1 hint)
  • lib/src/datalayer/schema/schema.dart (Run dartfmt to format lib/src/datalayer/schema/schema.dart.)
  • lib/src/datalayer/schema/schema_relation.dart (Run dartfmt to format lib/src/datalayer/schema/schema_relation.dart.)
  • lib/src/entities/entity_builder.dart (Run dartfmt to format lib/src/entities/entity_builder.dart.)
  • lib/src/entities/entity_definition.dart (Run dartfmt to format lib/src/entities/entity_definition.dart.)
  • lib/src/entities/entity_wrapper.dart (1 hint)
  • lib/src/events/adapter_events.dart (Run dartfmt to format lib/src/events/adapter_events.dart.)
  • lib/src/events/event_dispatcher.dart (Run dartfmt to format lib/src/events/event_dispatcher.dart.)
  • lib/src/events/event_registration.dart (Run dartfmt to format lib/src/events/event_registration.dart.)
  • lib/src/events/events.dart (Run dartfmt to format lib/src/events/events.dart.)
  • lib/src/metadata/annotations.dart (1 hint)
  • lib/src/metadata/metadata_scanner.dart (1 hint)
  • lib/src/models/models.dart (Run dartfmt to format lib/src/models/models.dart.)

Package is pre-v1 release.

While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction of the API.

Maintain an example.

None of the files in your example/ directory matches a known example patterns. Common file name patterns include: main.dart, example.dart or you could also use shellstone.dart.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.8.0 <2.0.0
collection >=1.5.1 <2.0.0 1.14.11
meta >=0.12.1 <0.13.0 0.12.1 1.1.6
postgresql 0.3.3
quiver >=0.22.0 <0.23.0 0.22.0 2.0.0+1
sqljocky >=0.14.1 <0.15.0 0.14.1
Transitive dependencies
charcode 1.1.2
convert 1.1.1 2.0.2
crypto 0.9.2+1 2.0.6
logging 0.11.3+2
options_file 0.11.0
path 1.6.2
stack_trace 1.9.3
typed_data 1.1.6
Dev dependencies
matcher 0.12.0+2 0.12.4
test ^0.12.0