CastleDB
activeby Nicolas Cannasse · since 2012 · also known as Castle DB
Structured static database for game data: spreadsheet-style editor, typed sheets and diff-friendly JSON.
Overview
CastleDB, created by Nicolas Cannasse (author of Haxe and co-founder of Shiro Games), is a structured static database for data that people author rather than data an application writes at runtime: items, monsters, quests, dialogue and level layouts. Each sheet has a declared column model with types, unique identifiers and references to rows in other sheets, so the editor validates input much like a schema would. Everything is saved to a single JSON file formatted with newlines so it diffs and merges cleanly in Git or SVN, and a Haxe macro library turns that file into typed accessors at compile time. The original standalone editor is now legacy because editing moved into HIDE, the Heaps engine's editor, but the castle library itself is still actively developed.
Strengths & trade-offs
Strengths
- +Typed sheets with cross-sheet references catch data-entry mistakes before they reach the game
- +Single newline-formatted JSON file merges cleanly in Git
- +Haxe macros generate typed accessors, so a missing ID fails at compile time
- +Includes tile and level editing alongside tabular data
Trade-offs
- −Not a runtime database: no concurrent writes, query engine or transactions
- −Best supported from Haxe/Heaps; other languages must parse the JSON themselves
- −Standalone editor is legacy now that editing lives in HIDE
Great for
- +Game design data such as items, monsters and quests
- +Level and tile map authoring for Heaps games
- +Version-controlled reference data edited by non-programmers
Think twice for
- −Data written by the application at runtime
- −Large datasets
- −Concurrent multi-user editing without version control
Capabilities
Native or official first-party support · 2 of 25 tracked
Scale & consistency
- Comfortable data size
- Small · ≤ 100 GB
- Horizontal scaling
- None
- Multi-region
- No
- Transactions
- None
- Consistency
- Strong
- Schema
- Strict
- Architecture
- Embedded
- Query languages
- Haxe API
One JSON file loaded whole into memory; sized for hand-authored game data.
Deployment
Ecosystem
Alternatives to CastleDB
The in-process SQL engine that ships in every phone, browser and OS: one file, zero servers.
castledb vs sqlite →Pure-Python document store that keeps every table in one human-readable JSON file.
castledb vs tinydb →Tiny type-safe local JSON database for Node, Electron and the browser using plain JavaScript.
castledb vs lowdb →Dependency-free PHP library that stores schemaless documents as plain JSON files on disk.
castledb vs sleekdb →Serverless single-file NoSQL document database for .NET, in the spirit of SQLite.
castledb vs litedb →Embedded BSON document database for Rust with a MongoDB-like API and optional wire-protocol server.
castledb vs polodb →CastleDB FAQ
What is CastleDB?
CastleDB is a document database by Nicolas Cannasse, first released in 2012. CastleDB, created by Nicolas Cannasse (author of Haxe and co-founder of Shiro Games), is a structured static database for data that people author rather than data an application writes at runtime: items, monsters, quests, dialogue and level layouts. Each sheet has a declared column model with types, unique identifiers and references to rows in other sheets, so the editor validates input much like a schema would. Everything is saved to a single JSON file formatted with newlines so it diffs and merges cleanly in Git or SVN, and a Haxe macro library turns that file into typed accessors at compile time. The original standalone editor is now legacy because editing moved into HIDE, the Heaps engine's editor, but the castle library itself is still actively developed.
Is CastleDB open source?
Yes. CastleDB is open source. License: ISC License.
Does CastleDB support ACID transactions?
No. CastleDB does not provide ACID transactions; its consistency model is strong.
Does CastleDB scale horizontally?
CastleDB does not scale horizontally; it runs on a single node, so you scale it up rather than out. It is comfortable at small scale (≤ 100 GB).
How can I run CastleDB?
You can embed it in your application.
What is CastleDB best for?
CastleDB is a strong fit for game design data such as items, monsters and quests; level and tile map authoring for Heaps games; and version-controlled reference data edited by non-programmers. Think twice for data written by the application at runtime.
What are the best alternatives to CastleDB?
Common alternatives to CastleDB include SQLite, TinyDB, lowdb, SleekDB and LiteDB. The right choice depends on your workload, scale and hosting; WhichDB's smart match ranks them against your requirements.
How popular is CastleDB?
CastleDB ranks #480 of 844 databases on the WhichDB Score (2.3/100), and #42 among document databases. The score combines public adoption signals such as package downloads, GitHub activity, job posts and developer discussion.




