How jagi/meteor-astronomy works
Project type and purpose
• This is an open‑source Meteor package (“jagi:astronomy”) that implements an Object‑Document Mapper (ODM) / Model Layer for Meteor/MongoDB.
• Its goal is to let developers define schemas, automatically validate, transform and persist Mongo documents, and extend them with behaviors, events, methods, indexes, validators, etc.
High‑level architecture
• Entry point: lib/main.js – registers the package with Meteor and loads the core.
• Core layer: lib/core
• class.js – class-definition engine
• module.js – module registry & loader
• config.js, ejson.js, reserved_keywords.js – global settings & EJSON integration
• Extension modules: lib/modules
• behaviors, events, fields, helpers, indexes, methods, storage, validators
• each module plugs into the class lifecycle via hooks and contributes static methods, instance methods, schemas, Meteor methods, etc.
• Data layer
• Meteor’s Mongo.Collection & DDP
• Storage module orchestrates inserts/updates/removes via Meteor methods or direct calls
• Tests & packaging: test/ and .npm/package – ensure correctness and NPM publication metadata
• Core registry & hook pipeline as the heart of the system
• Module’s role in the pipeline
• How data flows from application code through classes, modules, storage, and into MongoDB