Strata - Data without the overhead

Strata

Data, without the overhead.

Strata isn’t the data system with the most features. It’s the one that asks the least of you to get a great one.


You describe your player data once. Strata loads each player’s session, keeps it saved, replicates changes to the client, and types every field for you. It’s built on ProfileStore, so you get session locking and safe saving without writing any of it.

Documentation · Package · Wally

  • In case the package is down, instead download the latest rbxm file and insert it in to studio, going from there as you usually would.

Why I made it

Most data setups make you build the plumbing before you can build the game: PlayerAdded and PlayerRemoving handlers, remotes for the client, string keys with no autocomplete, and a hand-written copy of your data’s shape in three places.

Strata removes the plumbing.

  • No session code. Sessions start when a player joins and end when they leave.
  • No remotes. The client mirrors whatever the server holds.
  • No duplicated schemas. Your template is the schema. Autocomplete comes from it.
  • No save calls. Data saves on its own. Save is there when you want it sooner.

What it looks like

Describe your data once, in a shared module:

-- ReplicatedStorage/Data
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Strata = require(ReplicatedStorage.Strata)

local Template = {
	Coins = 0,
	Stats = { Level = 1, Xp = 0 },
	Inventory = {} :: { string },
}

return Strata:Init({
	StoreName = "Players",
	Template = Template,
	Leaderstats = { Coins = true },
})
  • Note: More configuration options are available in the configuration docs, however StoreName and Template are the only two required.

Use it on the server:

local Data = require(game.ReplicatedStorage.Data).Server

Players.PlayerAdded:Connect(function(Player)
	local S = Data:LoadVault(Player) -- yields for the data
	if not S then
		return
	end

	S.Coins.Update(function(Coins)
		return Coins + 100
	end)
	S.Inventory.Push("Wooden Sword")
end)

And on the client. Same shape, but read-only:

local Data = require(game.ReplicatedStorage.Data).Client

local C = Data:LoadVault()
if C then
	C.Observe("Coins")(function(Coins)
		CoinLabel.Text = tostring(Coins)
	end)
end

Observe fires once with the current value, then again on every change. The path autocompletes from your template and the value is typed to match.

What you get

  • Typed everything. Every node has Get, Set and Update. Tables add Mutate and Snapshot. Arrays add Push, Pop, InsertAt and RemoveAt. Maps add Has, Keys, Values, Insert and Remove. It’s all dot syntax, so it’s S.Coins.Get() and never S.Coins:Get().
  • Built-in replication. Changes are batched into small patches. Sequence tracking detects missing updates and automatically requests a fresh snapshot.
  • A read-only client. Writing from the client throws, so UI code can’t quietly desync from the server.
  • Leaderstats from one line. Name the top-level fields and Strata keeps the leaderboard in sync.
  • Schema migrations. Set a SchemaVersion and a Migrate function. New template fields are filled in for existing players automatically.
  • Hooks. OnSessionStart, OnSessionEnd, BeforeMutate and AfterMutate.
  • Mock mode. Mock = true uses ProfileStore’s in-memory storage, so nothing is saved while you test.

Install

Strata is on Wally:

[dependencies]
Strata = "soggybird0/strata-service@1.0.0"

Important: Previous Strata Wally package names are deprecated. Use soggybird0/strata-service for the current, latest release.

ProfileStore and Signal come along as dependencies, so there’s nothing else to add.

Good to know

  • Autocomplete needs the new Luau type solver. Turn on Workspace.UseNewLuauTypeSolver in Studio, or the matching setting in Luau LSP. Your code runs the same without it. You only lose the types.
  • It’s player data, not global state. Leaderboards and cross-server data belong in OrderedDataStore or MessagingService. ProfileStore is explicit about the same limit.

Credits

Feedback

I’d love to hear what’s missing, what’s confusing, and what broke. Bug reports and feature requests are welcome here or on GitHub.

If you try it, tell me how much code it saved you.


Released under the MIT license.

Happy scripting!

1 Like

Strata v1.0.1 :partying_face:

Highlights

Strata v1.0.1 introduces three major additions:

  • Observe and Changed on every path. Subscribe to changes on individual fields, nested tables, or the entire vault. Listener values are fully typed, including the previous value when available.
  • Lifecycle and mutation signals. Server-side signals include OnSessionStart, OnSessionEnd, OnSave, BeforeMutate, and AfterMutate. The client also gets OnReplica, which fires whenever a full snapshot or patch is applied.
  • Private and Transient fields. Private keeps fields out of client replication, even when nested. Transient keeps root-level fields in memory without saving them. Both are configured directly through your template’s field structure.

Install

Strata is available on Wally,

[dependencies]
Strata = "soggybird0/strata@1.0.1"

Or by the latest release file.

Make sure you’re using v1.0.1 to access the features introduced in this release.


Links


Credits

  • ProfileStore by loleris (MAD STUDIO).
  • Wire by IAMNOTULTRA3. Seriously, an incredibly underrated developer — go check out his modules.

Bug reports and feature requests are welcome in the DevForum post or the GitHub issues section.

Happy scripting!

Note: Lots of new syntax. For example;
Push → AddNext
Pop → RemoveLast

Also lots of new features:
Introducing…

Private and Transient fields!

What are they?

  • A private field is a field non-replicating to the client, despite nesting depth.
  • A transient fields keep only root-level fields in memory without saving.

Both of which are accessible through the Options<T> field in Strata.Init:
image

--[=[
	@type PrivateFields<T> { [string]: boolean | PrivateFields<T> }
	@within Strata

	Fields that are never sent to the client. Mirrors your template at any
	depth: `Secret = true` hides a root field, `Stats = { AntiCheat = true }`
	hides one field inside a table, and `Stats = true` hides the whole table.
	Missing keys default to `false`.
]=]
export type PrivateFields<T> = { [string]: boolean | PrivateFields<T> }
--[=[
	@type TransientFields<T> { [string]: boolean }
	@within Strata

	Root fields that live in memory only and are never saved. Each session
	starts them from the template. Missing keys default to `false`.
]=]
export type TransientFields<T> = { [string]: boolean }

Happy scripting devs!

Found a small bug with Changed signals.

The replacment of Signal by sleitnick with Wire by IAMNOTULTRA3 introduces new syntax.
This is known as: Wire.fireAsync(id, ...)
I was unaware of this at the time of code, meaning now every Changed signal yields for the previous in a chain.

This bug will be fixed by next release, along with any others.

Strata v1.1.0 :high_voltage::dashing_away:

Key Highlights

Version 1.1.0 focuses on safer sessions, typed migrations, and stricter writes.

This mainly includes a new Incognito mode, which generates random HTTP GUID's for keys, which can be useful for testing data or updates without spamming mock.

  • Session options on LoadVault / GetVault

    • { Incognito = true } — unique throwaway key, never saves (manual, auto, or on end)
    • { Key = "..." } — load/save under a fixed key
    • { KeyPrefix = "..." } — override the prefix for that load only
    • { Incognito = true, Key = "..." } — load a specific profile into memory and never write it back
  • Server:BindToMigrate — schema migrations move off Init so data stays fully typed. Set SchemaVersion in config, then bind the callback on the server.

  • Runtime type checks on writes — Set / Update error when the value’s type doesn’t match the template leaf (e.g. string into a number field), instead of silently storing bad data.


Breaking change

Migrate is no longer an Init option.

Before (1.1.0)

Strata.Init({
	Template = Template,
	StoreName = "Players",
	SchemaVersion = 2,
	Migrate = function(data, from, to) -- data was often `unknown`
	end,
})

After (1.1.0)

Strata.Init({
	Template = Template,
	StoreName = "Players",
	SchemaVersion = 2,
})

-- Server
Data.Server:BindToMigrate(function(data, fromVersion, toVersion)
	-- data is typed as your template
end)

Install

Wally

[dependencies]
Strata = "soggybird0/strata@1.1.0" -- or "^1.0.0" for auto minor-patch versions

Or grab the latest release file

Make sure you’re on v1.1.0 for session options, BindToMigrate, and write type checks.


Quick Example

-- Never persists
local Ghost = Data.Server:LoadVault(Player, { Incognito = true })

-- Fixed key
local QA = Data.Server:LoadVault(Player, { Key = "QA_Profile_01" })

-- Preview a save without writing back
local Preview = Data.Server:LoadVault(Player, {
	Incognito = true,
	Key = "Template_Starter",
})

-- Wrong type → error
S.Coins.Set("50")
-- Strata: type mismatch at Coins — expected number, got string

Grab the new files!

Rbxm | Model | Wally

And Visit the docs!


Happy scripting!

Are you trying to take over my niche with Transient Fields buddy.

1 Like

Obviously not, just came up with them after getting a request XD

1 Like