Nestory is a persistent in-memory object graph for Go. Your structs are the
database: the complete dataset lives in RAM, relations are ordinary *T
pointers, and committed changes are recovered from a write-ahead log.
Warning
Nestory is alpha software. Its API and on-disk format may change. Use it for experiments and replaceable data, not as the only copy of production data.
type Profile struct {
Id int
Theme string
}
func (profile Profile) GetId() int { return profile.Id }
type User struct {
Id int
Name string
Profile *Profile `rel:"own,Id"`
}
func (user User) GetId() int { return user.Id }
nestory.DataDir = "./data"
if err := nestory.Register[Profile](); err != nil {
log.Fatal(err)
}
if err := nestory.Register[User](); err != nil {
log.Fatal(err)
}
nestory.Open[Profile]()
users := nestory.Open[User]()
user := &User{Name: "Ada", Profile: &Profile{Theme: "dark"}}
if err := users.Create(user); err != nil {
log.Fatal(err)
}
err := users.View(user.Id, func(user *User) error {
fmt.Println(user.Profile.Theme) // already wired; no query or join
return nil
})- Normal Go structs and pointers, without generated models, proxies, or setters.
- Stable pointers in a chunked arena; inserts do not move existing objects.
- Detached branches and optimistic transactions for safe edits.
- Zero-copy callback reads with
View,ViewMany,ViewRange, and indexed delta cursors. - Durable unique and ordered composite indexes.
- A value-lifetime model that derives cascade delete, borrow vetoes, optional references, and computed inverse views from explicit ownership roles.
- WAL-backed commits, including one crash-atomic frame for transactions that touch multiple entity types.
- An explicitly unsafe live-pointer API for exclusive, allocation-sensitive workloads.
Nestory deliberately keeps the whole dataset in memory. It is a good fit for small, hot object graphs and embedded services; it is not a replacement for a large disk-first database.
go get github.com/DorianDevp/nestoryNestory currently requires Go 1.24.
- Documentation index
- Getting started
- Transactions and data access
- Relations and lifecycle rules
- Indexes and batch operations
- Unsafe live pointers
- How it works
- Contributing
- Benchmarks and methodology
The core read, transactional, relation, indexing, and recovery paths are race-tested, but the project is still an alpha. Important current limitations include an in-memory working set, integer primary keys, process-global registration, no schema migration system, and no stable on-disk compatibility promise. See How it works for the full list.
Nestory is licensed under the Mozilla Public License 2.0. See LICENSE.