dartway_serverpod_core_server 0.1.0
dartway_serverpod_core_server: ^0.1.0 copied to clipboard
Server side of the DartWay core, a Serverpod module: model-driven CRUD with realtime, declarative access and validation configs, phone auth, cloud storage and Telegram alerts.
dartway_serverpod_core_server #
The server side of the DartWay core — a Serverpod module that turns model definitions into a production-ready backend:
- Generic model-driven CRUD —
getOne/getList/save/delete/ realtimesubscribefor any model, no hand-written endpoints. OneDwCrudConfig<T>per model declares the whole behavior:allowSave→validateSave, thenbeforeSaveTransaction→ write →afterSaveTransactioninside one transaction, thenafterSaveTransformandafterSaveSideEffectsoutside it; access filters for reads, ordering, includes. (Guards run before the transaction opens — a check that must not race belongs inbeforeSaveTransaction.) - Secure by design — reads go through explicit
accessFilters, writes throughallowSave/validateSave; a model without a config is not exposed. - Phone auth — passwordless flow (phone + one-time code) built on the
app's own user model: the framework never owns your
UserProfile. - Cloud storage — S3/MinIO-compatible file storage helpers.
- Alerts — error reports to Telegram with structured context (see
dartway_serverpod_core_shared).
Installing the module #
The package is a Serverpod module (nickname dartway_serverpod_core).
In your server package:
- Add the dependency:
dependencies:
dartway_serverpod_core_server: ^0.1.0
- Register the module in your
config/generator.yaml:
modules:
dartway_serverpod_core:
nickname: dartway
-
Run
serverpod generate— the module's models and endpoints join your protocol. Module migrations ship with the package and are applied by the regular--apply-migrationsflow. -
Configure your models' CRUD in one place:
final newsPostCrudConfig = DwCrudConfig<NewsPost>(
table: NewsPost.t,
getListConfig: DwGetModelListConfig(
accessFilter: (session) async => null, // public read — explicit
defaultOrderByList: [Order(column: NewsPost.t.createdAt, orderDescending: true)],
),
saveConfig: DwSaveConfig<NewsPost>(
// `isStaffMember` is a one-line extension on Session in *your* app: the
// framework ships `session.currentUserProfileId` and `session.isUser(id)`,
// and never owns your roles.
allowSave: (session, ctx) async => await session.isStaffMember,
validateSave: (session, ctx) async =>
ctx.currentModel.title.trim().isEmpty ? 'Title is required' : null,
),
);
The DartWay stack #
| Package | Role |
|---|---|
dartway_serverpod_core_server |
this package — the Serverpod module |
dartway_serverpod_core_client |
generated protocol client |
dartway_serverpod_core_flutter |
Flutter data layer (watchModelList, sessions, alerts) |
dartway_serverpod_core_shared |
pure-Dart shared layer |
dartway_flutter |
Flutter app shell: bootstrap, guarded actions, notifications |
See the canonical example app in the
DartWay monorepo (example/) — a full
fitness-club product built on this stack.