Deploy a Dart application on onesubnet
Deploy a Dart backend (shelf / dart_frog): dependencies, run, port and environment variables.
Deploy a Dart application on onesubnet
onesubnet runs your Dart backends (shelf, dart_frog, custom servers). Deploy via Git.
1. Prepare the project
- A
pubspec.yamlat the root. - Listen on the port from the
PORTvariable:
final port = int.parse(Platform.environment['PORT'] ?? '8080');
final handler = (Request request) => Response.ok('Hello from Dart');
await serve(handler, InternetAddress.anyIPv4, port);
2. Deploy
- Connect your Git repository in the panel.
- Build command:
dart pub get - Start command:
dart run bin/server.dart(ordart_frog dev/dart_frog prod).
3. Environment variables
In Settings → Environment. Access via Platform.environment['...'].
4. Logs
Live console in the panel.
References
- Dart: https://dart.dev/guides
- shelf: https://pub.dev/packages/shelf