Relayer
Project Structure
This document provides detailed information about each directory in the OpenZeppelin Relayer project.
Source Code Organization
src/ Directory
The main source code directory contains the core implementation files organized into several modules:
api/: Route and controllers logic- Manages HTTP routing and delegates incoming requests to controllers
bootstrap/: Service initialization- Bootstraps and initializes application services
config/: Configuration management- Handles system configuration and environment settings
constants/: Global constants- Provides static values used across the application
domain/: Business domain logic- Encapsulates core business rules and domain-specific functionality
jobs/: Asynchronous job processing- Manages background task queueing and execution
logging/: Logging and file rotation- Implements logging functionalities and log file management
metrics/: Metrics collection- Collects and reports application performance and usage metrics
models/: Core data models and types- Defines data structures and type definitions for the system
repositories/: Configuration storage- Provides interfaces for storing and retrieving configuration data
services/: Business service logic- Implements core business functionalities and service operations
utils/: Utility functions- Offers helper functions and common utilities for the application
Documentation
docs/ Directory
Project documentation:
- User guides
- API documentation
- Configuration examples
- Architecture diagrams
Configuration
config/ Directory
Houses system configuration file and keys:
config.jsonconfiguration file- keystore files referenced from config.json file
Tests
test/ Directory
Includes comprehensive testing suites to ensure system reliability:
- End-to-end tests that simulate real-world user scenarios
Scripts
scripts/ Directory
Utility scripts.
Examples
examples/ Directory
Provides practical examples and sample configurations to help users get started:
- Demonstrates typical service configurations for various environments
- Acts as a quick-start guide for customizing and deploying the relayer
- Serves as a reference for best practices in configuration and deployment
Development Tools
Pre-commit Hooks
Located in the project root:
- Code formatting checks
- Linting rules
- Commit message validation
Build Configuration
Core build files:
Cargo.toml: Project dependencies and metadatarustfmt.toml: Code formatting rulesrust-toolchain.toml: Rust version and components
Docker Support
The project includes Docker configurations for different environments:
Dockerfile.development: Development container setupDockerfile.production: Production-ready container
For detailed information about running the relayers in containers, see the Docker deployment section in the main documentation.