[DEPRECATED] Quartz | Quick Networking Library

:high_voltage: Quartz Simple & Safe Networking for Roblox

Clean API | Rate Limiting | Validation | Zero Config:

This project now is deprecated

:high_voltage::rocket::shield:

— Hey everyone! :waving_hand: Ever get tired of writing the same networking boilerplate in every project?

-- The struggle is real:
local remote = Instance.new("RemoteEvent")
remote.OnServerEvent:Connect(function(player, data)
    if not player or not player:IsA("Player") then return end
    if typeof(data) ~= "string" then return end
    if #data > 100 then return end
    -- Wait, did I forget rate limiting again?
    -- 20 lines later... FINALLY my actual game logic
end)

Yeah, me too. So I built Quartz - networking that just works.

:thinking: Why Quartz?

Quartz is crystal clear networking - simple, reliable, and beautiful to work with.

Just like quartz crystals are known for their clarity and structure, Quartz gives you:

  • Crystal clear API that’s intuitive and easy to use
  • Solid foundation with built-in security and validation
  • Beautiful developer experience that just makes sense
  • High Perfomance

:rocket: Tests

Quartz + safe mode 890703 calls/sec 484kb memory usage
Quartz + unsafe mode 1293272 calls/sec 535kb memory usage
Packet 1690920 calls/sec 622kb memory_usage

:rocket: Quick Start

Get from Creator Marketplace and you’re ready in 60 seconds:

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

local my_event = Server.Event("my_event", Quartz.RELIABLE, Quartz.SAFE, Quartz.auto)
          .WithRateLimit(3, 1, function(player: Player)
              print(`player {player.Name}, exceeded rate limit`)
          end)
         .OnFire(function(player: Player, data: any)
             if data then
                 print(`{player.Name}: {data}`)
             end
         end)

That’s it. No complex configuration, no dependencies - just clean, secure networking.

:gem_stone: Why Quartz Stands Out

Crystal Clear API

Chain methods that actually make sense:

Quartz.Server().Event("Move")
 .Expects(Quartz.string, Quartz.string)
 -- Type validation .WithRateLimit(20, 1)
 -- .OnFire(function(player, x, y) -- Your game logic moveCharacter(player, x, y) end)

Built-in Security

Production-ready protection from day one:

Zero Configuration

Works out of the box - no complex setup needed:

local Quartz = require(game.ReplicatedStorage.Quartz)
 -- Ready to use! No config files, no settings to tweak

:shield: Features That Matter

🎯 Clean Fluent API - click to expand

lua

local Quartz = require(path.to.Quartz)
local Network = Quartz.Server()

local my_event = Network.Event("MyEvent")
         .Expects(Quartz.string, Quartz.number)
         .WithRateLimit(3, 2, function(player: Player, message: string)
                print("Player limit exceeded for player ".. player.Name)
          end)
        .OnFire(function(player: Player, message)
              print("player ".. player.Name .. "send message: ".. message)
        end)
       -- clean, simple and fast
🛡️ Built-in Rate Limiting - click to expand

lua

-- Basic protection .WithRateLimit(10, 1) -- 10 requests per second -- With custom violation handler .

--.WithRateLimit(5, 1, function(player, message) warn(`🚫 ${player.Name} is spamming chat!`) end)


✅ Simple Validation - click to expand

lua

-- Basic types .Expects(Quartz.number)
 -- Number ranges .Expects(Quartz.range(1, 10))
 -- Custom validation .Expects( function(x) return x > 0 end, 

Quartz gives you 100% of what you need, 0% of what you don’t.

:bullseye: Who Is Quartz For?

  • :white_check_mark: Indie Developers who want security without complexity
  • :white_check_mark: Game Jam Participants who need networking that works NOW
  • :white_check_mark: Learning Developers who want clean, understandable code
  • :white_check_mark: Small Teams who need consistent networking across projects

:crystal_ball: Coming Soon

  • Advanced metrics and monitoring
  • Enhanced compression for large data

What features would you like to see? Let me know in the replies!


:package: Installation

  1. Get from Marketplace : Quartz on Creator Marketplace
  2. Drop into ReplicatedStorage
  3. Start coding - that’s it!

:white_check_mark: Zero dependencies:white_check_mark: MIT License:white_check_mark: Open source


:speech_balloon: Feedback & Support

Found a bug? Want a feature? Have suggestions?
Reply on this post and I will see

Would you use Quartz?
  • Yes! Downloading now
  • Maybe for my next project
  • Looks interesting, will check it out
  • Prefer my current solution
  • Too simple for my needs
0 voters

Made by @super_sonic

If Quartz saves you time, drop a :heart: to help others find it!

Happy coding! :rocket:

3 Likes

V0.11

Small bug fixes and Unreliable remote event system

Get Quartz : Quartz on Creator Marketplace

example code:

   local quartz = require(path.to.quartz)
   local network = quartz.Server() -- server mode
   
   local new_unreliable_remote_event = network.Event("my_event", quartz.UNRELIABLE) -- NEW: 2 argument, is_unreliable

V 0.12

Unreliable event bug fix and Improved rate limit system

Get Quartz : Quartz on Creator Marketplace

example code:

local Quartz = require(path.to.quartz)
local server = Quartz.Server()

local testEvent
testEvent = server.Event("Test", Quartz.RELIABLE, Quartz.SAFE)
	.Expects(Quartz.string)
	.OnFire(function(player: Player, data: string)
		print(`player tokens! {testEvent.GetRemainingTokens(player)}`) -- new function
                -- new function: GetRemainingTokens -> Returns the number of messages that can be sent from a player per second.
               test.Event.ResetRateLimit(player) 
               -- -> resets amount of tokens 
	end)
	.WithRateLimit(3, 1, function(player)
		print(testEvent.GetRemainingTokens(player)) -- 0 tokens left
		player:Kick("U bad boy!")
	end)
	

Im curious about just how is this module compared to other alternatives such as Packet and Bytenet, so it’d be good if you could provide some benchmarks or some data for reference, or some features that the alternatives doesnt provide

I ran performance tests on Packet and Quartz, here are my results, if you find an error in the script, please reply me

Quartz script:

-- stress test, client -> server

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Quartz = require(ReplicatedStorage.Quartz)
local Client = Quartz.Client()


task.wait(2)

local startTime = os.clock()

print(" Starting Quartz Stress Test...")

local test_event = Client.Event("StressTestEvent")
	.Expects("string")

local totalCalls = 0
local successfulCalls = 0
local failedCalls = 0

print("\n TEST 1: Bulk Fire (500 calls)")
local bulkStart = os.clock()

for k = 1, 500 do
	local success = pcall(function()
		test_event.Fire("data_" .. k)
		successfulCalls += 1
	end)

	if not success then
		failedCalls += 1
	end
	totalCalls += 1
end

local bulkTime = os.clock() - bulkStart
print(`    {successfulCalls} successful,  {failedCalls} failed`)
print(`     Time: {bulkTime}s`)
print(`    Speed: {(500/bulkTime)} calls/sec`)
print(`    Average: {(bulkTime/500)*1000}ms per call`)

print("\n TEST 2: Distributed Load (5 cycles)")
successfulCalls = 0
failedCalls = 0
totalCalls = 0

for i = 1, 5 do
	local cycleStart = os.clock()
	local cycleSuccessful = 0
	local cycleFailed = 0

	for k = 1, 500 do
		local success = pcall(function()
			test_event.Fire(`cycle_{i}_data_{k}`)
			cycleSuccessful += 1
		end)

		if not success then
			cycleFailed += 1
		end
	end

	local cycleTime = os.clock() - cycleStart
	successfulCalls += cycleSuccessful
	failedCalls += cycleFailed
	totalCalls += 500

	print(`   Cycle {i}: {cycleSuccessful} OK, {cycleFailed} FAIL, {cycleTime}s`)

	if i < 5 then
		task.wait(1) 
	end
end

local endTime = os.clock()
local totalTime = endTime - startTime

print(" STRESS TEST RESULTS")
print(`  Total Time: {totalTime} seconds`)
print(` Total Calls: {totalCalls}`)
print(` Successful: {successfulCalls}`)
print(` Failed: {failedCalls}`)
print(` Success Rate: {(successfulCalls/totalCalls)*100}%`)
print(` Overall Speed: {(totalCalls/totalTime)} calls/sec`)
print(`Average Latency: {(totalTime/totalCalls)*1000}ms per call`)

local memoryUsage = gcinfo()
print(` Memory Usage: {memoryUsage} kb`)

print("completed")

Packet script:

-- similar to Quartz

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Packet = require(ReplicatedStorage.Packet)


task.wait(2)

local startTime = os.clock()

print(" Starting Packet Stress Test...")

local test_event = Packet("StressEvent", Packet.String)

local totalCalls = 0
local successfulCalls = 0
local failedCalls = 0

print("\n TEST 1: Bulk Fire (500 calls)")
local bulkStart = os.clock()

for k = 1, 500 do
	local success = pcall(function()
		test_event:Fire("data_".. k)
		successfulCalls += 1
	end)

	if not success then
		failedCalls += 1
	end
	totalCalls += 1
end

local bulkTime = os.clock() - bulkStart
print(`    {successfulCalls} successful,  {failedCalls} failed`)
print(`     Time: {bulkTime}s`)
print(`    Speed: {(500/bulkTime)} calls/sec`)
print(`    Average: {(bulkTime/500)*1000}ms per call`)

print("\n TEST 2: Distributed Load (5 cycles)")
successfulCalls = 0
failedCalls = 0
totalCalls = 0

for i = 1, 5 do
	local cycleStart = os.clock()
	local cycleSuccessful = 0
	local cycleFailed = 0

	for k = 1, 500 do
		local success = pcall(function()
			test_event:Fire(`cycle_{i}_data_{k}`)
			cycleSuccessful += 1
		end)

		if not success then
			cycleFailed += 1
		end
	end

	local cycleTime = os.clock() - cycleStart
	successfulCalls += cycleSuccessful
	failedCalls += cycleFailed
	totalCalls += 500

	print(`   Cycle {i}: {cycleSuccessful} OK, {cycleFailed} FAIL, {cycleTime}s`)

	if i < 5 then
		task.wait(1) 
	end
end

local endTime = os.clock()
local totalTime = endTime - startTime

print(" STRESS TEST RESULTS")
print(`  Total Time: {totalTime} seconds`)
print(` Total Calls: {totalCalls}`)
print(` Successful: {successfulCalls}`)
print(` Failed: {failedCalls}`)
print(` Success Rate: {(successfulCalls/totalCalls)*100}%`)
print(` Overall Speed: {(totalCalls/totalTime)} calls/sec`)
print(`Average Latency: {(totalTime/totalCalls)*1000}ms per call`)

local memoryUsage = gcinfo()
print(` Memory Usage: {memoryUsage} kb`)

print("completed")

And screenshot result (real roblox servers):

my mp4 video wont load😭

I can see Quartz uses less memory compared to Packet. Also, here are some suggestions to the module:

  • for typechecking, allow us to input expected types directly in .Event() AND give auto types such as Quartz.string (this refer to string type)
  • not to the module itself but can you please write a full documentation there are so many things :sob:

thank for feedback, np ima already adding docs and i will add types directly in .Event()

V 0.13

Direct types and improved documentation

Get Quartz : Quartz on Creator Marketplace

new example code:

local Quartz = require(path.to.quartz)
local server = Quartz.Server()

local Players = game:GetService("Players")

local event = server.Event("event_name", Quartz.RELIABLE, Quartz.SAFE, Quartz.string, Quartz.string, Quartz.number)
	--.Expects(Quartz.string, Quartz.string) or you can use new method
	.OnFire(function(player, str, str2, number)
		print(player, str, str2, number)
	end)

Players.PlayerAdded:Connect(function(player)
	event.Fire(player, "Hello", player.Name, 1)
end)

V 0.14

Minor update

Get Quartz : Quartz on Creator Marketplace

new example code:

local Quartz = require(path.to.quartz)
local server = Quartz.Server()

local Players = game:GetService("Players")

local event = server.Event("event_name", Quartz.RELIABLE, Quartz.string, Quartz.auto, Quartz.auto)
	-- added auto type
	.OnFire(function(player, str, auto, auto2)
		print(player, auto, auto2)
	end)

Players.PlayerAdded:Connect(function(player)
	event.Fire(player, "Hello", player.Name, 1)
end)
1 Like

V 0.15

Unsafe Mode

Get Quartz : Quartz on Creator Marketplace

Finally a major update🥳

Added unsafe(perfomance) mode for events

In unsafe mode many features are disabled for performance reasons.

example:

local quartz = require(path.to.quartz)
local network = quartz.Server() -- unsafe mode works only in server mode!

local event = network.Event("my_event", Quartz.RELIABLE, Quartz.UNSAFE)
         -- .Expects() <- "error: .Expects not avaliable in unsafe mode" 
        --  .WithRateLimit() <- "error: .WithRateLimit not avaliable in unsafe mode"
       -- .Fire(player, data), .OnFire() <- only this features enabled in unsafe mode

Control tests (500 calls):

500 Calls SERVER->CLIENT SERVER->CLIENT
Quartz + safe mode 890703 calls/sec 484kb memory usage
Quartz + unsafe mode 1293272 calls/sec 535kb memory usage
Packet 1690920 calls/sec 622kb memory_usage

V 0.16

Get Quartz : Quartz on Creator Marketplace

Minor update

Fixed unreliable + unsafe mode bug which crashes Server

thats not how to benchmark a networking library.
you are benchmarking how fast the API process the calls such like insertion, this is totally not right on benchmarking network.

Okay, Ill do some real tests because I took that guy messages as API speed

i can give u the template, if u want.

No, no need Ive already made a prototype Ima just going on a short trip for about 10-12 hours.

Okay, I ran the tests and the results are bad. I can’t provide a screenshot right now, but please take my word for it.

  • Quartz: 10,254 packets per second
  • Packet 1,329,787 packets per second 100X BETTER LOL

Yes, unfortunately, this is a fatal result, and Quartz doesnt stand a chance.

The problem is that Quartz was designed as a DX (Developer Experience) library, and while developing it, I completely forgot about performance and optimization. Most likely, Quartz will become deprecated and will undergo a complete refactoring.