LogoRevali

Installation

Learn how to install Revali Client and its dependencies

Welcome to Revali Client! This guide will help you set up everything you need to generate type-safe client code for your Revali Server.

Quick Start#

The fastest way to get started is to add both required dependencies at once:

# Add runtime dependency
dart pub add revali_client

# Add code generator
dart pub add revali_client_gen --dev

# Get all dependencies
dart pub get

That's it! You're ready to generate your client code.

Understanding the Dependencies#

Revali Client consists of two main packages that work together to generate and run your client code:

📦 Revali Client (Runtime)#

The runtime package that your generated client code depends on.

dart pub add revali_client

What it provides:

  • RevaliClient - The underlying HTTP client
  • Storage - Cookie and session storage interfaces
  • HttpInterceptor - Request/response interception
  • ServerException - Standardized error handling
  • HttpRequest / HttpResponse - HTTP primitives

Why it's needed: This package contains the core runtime classes that the generated client uses to make HTTP requests, handle responses, and manage state.

⚙️ Revali Client Gen (Code Generator)#

The code generator that creates your client implementation during the build process.

dart pub add revali_client_gen --dev

What it provides:

  • Analyzes your Revali Server routes
  • Generates type-safe data source interfaces
  • Creates concrete HTTP client implementations
  • Handles serialization and deserialization
  • Manages the generated package structure

Why it's needed: This is a build-time dependency that runs during revali dev or revali build to generate the actual client code from your server definitions.

Manual Installation#

If you prefer to add dependencies manually, update your pubspec.yaml file:

pubspec.yaml
dependencies:
  revali_client: ^<latest-version> # Runtime package

dev_dependencies:
  revali_client_gen: ^<latest-version> # Code generator

Configuration#

After installation, you need to enable Revali Client in your revali.yaml configuration file:

revali.yaml
constructs:
  - name: revali_client
    options:
      package_name: client # Optional: customize package name
      server_name: Server # Optional: customize server class name

Directory Structure#

Once installed and configured, Revali Client will generate code in the following structure:

your_project/
├── .revali/
│   └── revali_client/          # Generated client package
│       ├── lib/
│       │   ├── client.dart
│       │   ├── interfaces.dart
│       │   └── src/
│       └── pubspec.yaml
├── lib/
├── routes/                     # Your server routes
└── pubspec.yaml

The generated client in .revali/revali_client/ is a complete Dart package that you can import and use in your application.

Common Issues#

Generated Code Not Updating#

If the client isn't regenerating:

  1. Ensure revali_client_gen is in dev_dependencies
  2. Check that revali.yaml has the client construct enabled
  3. Try running revali build or revali dev again

What's Next?#

Now that you have Revali Client installed, you're ready to:

  1. Configure - Set up client generation options
  2. Generate Client Code - Understand the generated structure
  3. Use HTTP Interceptors - Add request/response handling
  4. Set Up Storage - Manage cookies and sessions

Ready to configure your client? Let's move on to configuration!