Frontend Setup
Pulling the contract and initializing the runtime.
Axiom Core eliminates the need for manual data classes, serialization logic, and network boilerplate in your Flutter app.
1. Pull the Contract
The pull command fetches the contract and generates a Thin SDK Layer.
If your project is linked and you are logged in, simply run:
axiom pullThe Trust Model: Axiom pulls the .axiom contract and a trust-axiom.json file. This file contains the cryptographic signature and public key used by the Rust runtime to ensure the API has not been tampered with.
Useful for quick testing against a local backend:
axiom pull --path ../backend-repo/.axiomIf the source .axiom file was built locally (unsigned), the Flutter logs will show a warning: Running with an unsigned contract. Verification is bypassed in this mode.
2. Implementation in Flutter
Axiom generates code in lib/axiom_generated/. It includes the SDK and the typed models.
import 'package:my_app/axiom_generated/axiom_sdk.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
final dbDir = await getApplicationSupportDirectory();
final sdk = await AxiomSdk.create(
baseUrl: "BASE_URL",
dbPath: dbDir.path,
);
runApp(MyApp(sdk: sdk));
}3. Benefits of the Axiom SDK
Unlike traditional code generators that produce "Fat" boilerplate (thousands of lines of Dart), Axiom produces a Thin Layer:
- Low Maintenance: You don't maintain the generated code; it is a direct reflection of the backend contract.
- Performance: All heavy lifting (Retry logic, Caching, JSON Validation) happens in the pre-compiled Rust runtime.
- Deterministic: The behavior is enforced by the
.axiomfile. If the contract says "Retry 3 times," the runtime will do exactly that, regardless of platform.
Pro Tip: Run axiom watch in your frontend project. It will automatically re-pull the contract and update your Dart models whenever the backend team publishes a new build to the Hub.