Node.js
In Node.js, the RPC datasource connects to a remote data source and exposes its data and operations in your back-office.Ruby (distributed back-ends)
In Ruby, the RPC datasource lets you distribute your Forest back-end across multiple microservices. Each service runs its own RPC back-end, and a main back-end aggregates them into a unified admin panel. Why use RPC?- Microservices architecture: your application is split into multiple services, each owning its data.
- Team isolation: each team manages their own Forest configuration.
- Independent deployment: update one service without redeploying the entire admin panel.
- Scalability: distribute load across multiple agents.

Main back-end
The main back-end aggregates multiple RPC back-ends into a single Forest interface. It behaves exactly like a classic back-end with multiple datasources: once connected, you can define relations across datasources transparently.The
auth_secret option is optional. If not specified, it defaults to your Forest project’s auth_secret. Override it to use a different shared secret for RPC communication.ReconciliateRpc plugin must be added in the main back-end. It relies on collection names matching across all back-ends, so if you rename collections in your RPC back-ends, keep all back-ends synchronized.
Introspection caching
By default, the main back-end introspects each RPC back-end at startup. Caching the introspection schema makes startup faster, lets the main back-end boot even if an RPC back-end is temporarily unavailable, and supports asynchronous deployments. RPC back-ends automatically generate a.forestadmin-rpc-schema.json file in development mode; pass it when adding a datasource:
RPC back-end
An RPC back-end exposes its collections to the main back-end via the RPC protocol.auth_secret from your main Forest project:
config/initializers/forest_admin_rpc_agent.rb, lib/forest_admin_rpc_agent/create_rpc_agent.rb, and mounts the RPC routes in config/routes.rb. The generated back-end looks like:
Cross-RPC relations
When an RPC back-end needs to reference collections from another RPC back-end, import them by adding an RPC datasource that references the other back-end, then usemark_collections_as_rpc: true to indicate those collections are provisioned elsewhere.
mark_collections_as_rpc manually:
add_many_to_one_relation, add_one_to_many_relation, add_one_to_one_relation, and add_many_to_many_relation.