diff --git a/src/GameCult.Networking/CultNetDatabase.cs b/src/GameCult.Networking/CultNetDatabase.cs
new file mode 100644
index 00000000..0e36467d
--- /dev/null
+++ b/src/GameCult.Networking/CultNetDatabase.cs
@@ -0,0 +1,551 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using GameCult.Caching;
+using R3;
+
+namespace GameCult.Networking
+{
+ ///
+ /// Describes the kind of domain change observed through a distributed CultCache surface.
+ ///
+ public enum CultNetDatabaseChangeKind
+ {
+ ///
+ /// A document was added.
+ ///
+ Added,
+ ///
+ /// A document was updated.
+ ///
+ Updated,
+ ///
+ /// A document was removed.
+ ///
+ Removed,
+ ///
+ /// A document was accepted through compatible schema migration.
+ ///
+ SchemaMigrated,
+ ///
+ /// A document change was rejected.
+ ///
+ Rejected
+ }
+
+ ///
+ /// Describes one shard owned or observed by a CultNet database surface.
+ ///
+ public sealed class CultNetShardDescriptor
+ {
+ ///
+ /// Creates a shard descriptor.
+ ///
+ public CultNetShardDescriptor(
+ string shardId,
+ string ownerRuntimeId,
+ long epoch,
+ bool isPrimary,
+ IEnumerable? schemaIds = null,
+ string? keyPrefix = null)
+ {
+ ShardId = RequireNonEmpty(shardId, nameof(shardId));
+ OwnerRuntimeId = RequireNonEmpty(ownerRuntimeId, nameof(ownerRuntimeId));
+ Epoch = epoch;
+ IsPrimary = isPrimary;
+ SchemaIds = schemaIds?.Where(value => !string.IsNullOrWhiteSpace(value)).Distinct(StringComparer.Ordinal).ToArray()
+ ?? Array.Empty();
+ KeyPrefix = keyPrefix;
+ }
+
+ ///
+ /// Gets the stable shard identifier.
+ ///
+ public string ShardId { get; }
+ ///
+ /// Gets the runtime that currently owns writes for this shard.
+ ///
+ public string OwnerRuntimeId { get; }
+ ///
+ /// Gets the monotonic shard authority epoch.
+ ///
+ public long Epoch { get; }
+ ///
+ /// Gets whether the local database instance is authoritative for writes to this shard.
+ ///
+ public bool IsPrimary { get; }
+ ///
+ /// Gets the schema ids governed by this shard. Empty means all schemas.
+ ///
+ public IReadOnlyList SchemaIds { get; }
+ ///
+ /// Gets the optional record-key prefix governed by this shard.
+ ///
+ public string? KeyPrefix { get; }
+
+ ///
+ /// Creates a primary shard that accepts every schema and key.
+ ///
+ public static CultNetShardDescriptor PrimaryAll(string ownerRuntimeId = "local", string shardId = "primary")
+ {
+ return new CultNetShardDescriptor(shardId, ownerRuntimeId, epoch: 1, isPrimary: true);
+ }
+
+ ///
+ /// Creates a read-only shard descriptor.
+ ///
+ public static CultNetShardDescriptor ReadOnly(
+ string shardId,
+ string ownerRuntimeId,
+ long epoch = 1,
+ IEnumerable? schemaIds = null,
+ string? keyPrefix = null)
+ {
+ return new CultNetShardDescriptor(shardId, ownerRuntimeId, epoch, isPrimary: false, schemaIds, keyPrefix);
+ }
+
+ internal bool Matches(string schemaId, CultRecordKey key)
+ {
+ var schemaMatches = SchemaIds.Count == 0 || SchemaIds.Contains(schemaId, StringComparer.Ordinal);
+ var keyMatches = string.IsNullOrEmpty(KeyPrefix) ||
+ key.Value.StartsWith(KeyPrefix!, StringComparison.Ordinal);
+ return schemaMatches && keyMatches;
+ }
+
+ private static string RequireNonEmpty(string value, string paramName)
+ {
+ if (string.IsNullOrWhiteSpace(value))
+ {
+ throw new ArgumentException("Value must be non-empty.", paramName);
+ }
+
+ return value;
+ }
+ }
+
+ ///
+ /// Options for creating a distributed CultCache database surface.
+ ///
+ public sealed class CultNetDatabaseOptions
+ {
+ ///
+ /// Gets or sets the local runtime id advertised as shard owner for default primary shards.
+ ///
+ public string RuntimeId { get; set; } = "local";
+ ///
+ /// Gets or sets explicit shard descriptors. When omitted, this instance owns one primary shard for all records.
+ ///
+ public IReadOnlyList? Shards { get; set; }
+ ///
+ /// Gets or sets the document registry used to create and apply raw CultNet document messages.
+ ///
+ public CultNetDocumentRegistry? DocumentRegistry { get; set; }
+ }
+
+ ///
+ /// A typed domain change emitted by a CultNet database surface.
+ ///
+ public sealed class CultNetDatabaseChange where T : class
+ {
+ ///
+ /// Creates a database change.
+ ///
+ public CultNetDatabaseChange(
+ CultNetDatabaseChangeKind kind,
+ CultRecordKey key,
+ string schemaId,
+ CultNetShardDescriptor shard,
+ T? document,
+ T? previousDocument,
+ string? message = null)
+ {
+ Kind = kind;
+ Key = key;
+ SchemaId = schemaId;
+ Shard = shard;
+ Document = document;
+ PreviousDocument = previousDocument;
+ Message = message;
+ }
+
+ ///
+ /// Gets the change kind.
+ ///
+ public CultNetDatabaseChangeKind Kind { get; }
+ ///
+ /// Gets the changed record key.
+ ///
+ public CultRecordKey Key { get; }
+ ///
+ /// Gets the schema id of the changed document.
+ ///
+ public string SchemaId { get; }
+ ///
+ /// Gets the shard that accepted or rejected the change.
+ ///
+ public CultNetShardDescriptor Shard { get; }
+ ///
+ /// Gets the current document for added and updated events.
+ ///
+ public T? Document { get; }
+ ///
+ /// Gets the previous document for updated and removed events.
+ ///
+ public T? PreviousDocument { get; }
+ ///
+ /// Gets an optional diagnostic message.
+ ///
+ public string? Message { get; }
+ }
+
+ ///
+ /// Raised when a database write targets a shard this node does not own.
+ ///
+ public sealed class CultNetShardAuthorityException : InvalidOperationException
+ {
+ ///
+ /// Creates a shard authority exception.
+ ///
+ public CultNetShardAuthorityException(CultNetShardDescriptor shard, string message) : base(message)
+ {
+ Shard = shard;
+ }
+
+ ///
+ /// Gets the shard that rejected the write.
+ ///
+ public CultNetShardDescriptor Shard { get; }
+ }
+
+ ///
+ /// Database-style CultNet facade over a CultCache shard set.
+ ///
+ public sealed class CultNetDatabase : IDisposable
+ {
+ private readonly CultCache _cache;
+ private readonly CultNetDocumentRegistry _documents;
+ private readonly List _shards;
+ private readonly Subject