How modiimedia/arri works
Based on our analysis, this project is a monorepo for Arri RPC – a code-first RPC framework that automatically generates type-safe clients from your server code. It supports multiple programming languages for both server implementations and client generators and even bundles tooling (like a CLI, code-generation utilities, JSON schema converters, and type definitions) together with extensive testing and documentation.
Main Components
• Arri CLI & Tooling: At the heart of the system, the Arri CLI (located in the tooling/cli directory) orchestrates the entire workflow, running code generators and managing dependencies.
• Server Implementations: Under the “languages” folder you have separate sub-projects for different server implementations (e.g., Typescript, Go) that generate an “Arri App Definition” (which is essentially a snapshot of your procedures and types).
• Client Generators: Also in the “languages” folder (e.g., ts-codegen, dart-codegen, rust-codegen, kotlin-codegen, swift-codegen), these generators convert the app definition into language-specific client code.
• Code Generation Utilities & Schema Tools: The project contains several directories (e.g., tooling/codegen-utils, tooling/json-schema-to-atd, languages/ts/ts-schema) that help build and validate the schema, ensuring consistency across definitions.
• App Definition: This is the central contract that represents the procedures, parameters, and responses. It is either created automatically by the server implementations or manually by the user (as described in the README). It plays a pivotal role by being the artifact that is passed from the server side to the CLI, and then onward to the client generators.
• Tests and Specifications: The tests directory (covering clients and servers) and the specifications directory (with documents like arri_app_definition.md) provide validation and a detailed outline of expected behavior.
Relationships and Data Flow
• The process starts with the server code (which lives in folders such as languages/ts/ts-server, languages/go/go-server, etc.) that defines procedures and types.
• Client generators (in languages/*/codegen projects) use the App Definition to generate type-safe client libraries.
• Additional utilities (such as schema validation from @arrirpc/schema) interact with both server code and code generators. Represent them as supportive utilities interfacing with both the server-side and generator components.
Architectural Patterns and Design Principles
• Modular Design & Pluggable Components: Each language-specific implementation is isolated within its own directory. This promotes a clear separation of concerns.
• Code-first API Definition: The framework relies on generating the API definition directly from server code, minimizing manual client coding.
• Automated Workflows: The CLI (along with scripts and tooling) automates server building, client generation, and hot-reloading (for development).
• Monorepo Organization: All components (server implementations, client generators, tooling, and tests) are co-located in one repository, allowing tight integration and easy cross-module reference.
Additional Elements to Capture
• Continuous Integration/Deployment (CI/CD): Given the presence of GitHub workflows and configurations, consider a small section showing how tests are run automatically.
• Build scripts and Developer Tooling: Note the various scripts in the “internal/scripts” directory which aid in tasks like testing, version synchronization, and scaffolding.