Domains/Namespaces

Namespacing of sorts is on the roadmap. Like you say, once your application grows managing a lot of schema definitely gross complex. And we definitely encourage you to put a lot of business logic into Fauna, given the power of FQL, permissions etc.

As a workaround, I wonder if this would work for you for now:

You can create a UDF which is a “constructor” of sorts.

// FSL
function User(id) {
  let doc = _user.byId(id)!

  {
    impersonate: (other) => User_impersonate(doc, other),
    doc: () => doc,
    update: (params) => doc.update(params),
    delete: () => doc.delete(),
  }
}

function Car(id) {
  let doc = _car.byId(id)!

  {
    sell: (user) => Car_sell(doc, user),
    doc: () => doc,
    update: (params) => doc.update(params),
    delete: () => doc.delete()
  }
}

@role(fnUser_impersonate)
function User_impersonate(user, other) { /* ... */ }

@role(fnCar_sell)
function Car_sell(car, user) { /* ... */ }

// If the above terms are how you want to interact with the data, then name the collections something different.
collection _user {}
collection _car {}

// define those roles as well

This may be a bit contrived, but I hope it illustrates how you encapsulate logic into objects.