Forest Logo
search
package_2

datakit

By @moxxum

Roblox

Mirrored

datakit

Thin wrapper around ProfileStore: session-locked player profiles, Version-field ordered migrations, dot-path accessors, automatic session end on leave/shutdown. ProfileStore itself is vendored at a pinned commit (45c9847, Apache-2.0 — see LICENSE-ProfileStore); datakit does not reimplement any of its internals.

Server realm: DataKit = "moxxum/datakit@0.1.0" under [server-dependencies].

API

DataKit.Configure(config)      -- once, before any Load
DataKit.Load(player)           -- yields → Profile? (nil = session unavailable; kicks by default)
DataKit.Get(player)            -- non-yielding → Profile? (already-loaded only)
DataKit.Release(player)        -- ends the session (also automatic on leave/shutdown)
DataKit._RunMigrations(...)    -- internal, exposed for tests

profile.Data                   -- raw data table
profile.Raw                    -- underlying ProfileStore profile
profile:Get(path)              -- "Stats.Wins" dot paths; errors on broken parent chain
profile:Set(path, value)
profile:IsActive()
profile:EndSession()

Config: Template (required, must contain Version: number), StoreName (default "PlayerData"), Migrations ([2] = fn upgrades v1→v2, run in order), UseMock (default: auto-mock in Studio without DataStore access), KickOnLoadFail (default true).

Example

local DataKit = require(ServerScriptService.ServerPackages.DataKit)

DataKit.Configure({
	Template = { Version = 2, Coins = 0, Stats = { Wins = 0 } },
	Migrations = {
		[2] = function(data) -- v1 profiles gain Stats
			data.Stats = { Wins = 0 }
		end,
	},
})

Players.PlayerAdded:Connect(function(player)
	local profile = DataKit.Load(player)
	if profile then
		profile:Set("Coins", profile:Get("Coins") + 10)
	end
end)

Bumping Template.Version without providing every intermediate migration makes Load fail closed (kick) rather than corrupt data.

Test

rojo build test.project.json -o test.rbxl, open in Studio, Play Solo, expect [datakit-test] ALL PASS in Output. Uses the mock store; no DataStore access needed.

Package Details

Install command (Click to copy)


Version

0.1.0

License

MIT

check_circle

Safe for commercial use

Automated license review — not legal advice.