You could create server functions on the main app and call those instead of querying its tables directly.