How balderdashy/sails works
Sails is an MVC-oriented Node.js web and API framework with realtime capabilities. Its main lifecycle is to create a Sails app, load configuration and hooks, lift the app, route HTTP requests to actions, and return responses. The graph also preserves documented blueprint and realtime capabilities plus the request, response, and routing layers. Some domain integrations are documented in the README but their runtime wiring is not shown in the excerpts, so those links are marked as unverified or omitted.
Main entry points: router/index.js Router · Sails.js Sails app · hooks/index.js Hook lifecycle · app/index.js App factory
Components 23
App lifecycle
- Sails app
lib/app/Sails.js - App factory
lib/app/index.js - Configuration
lib/app/configuration/index.js - Config loading
lib/app/configuration/load.js - RC config
lib/app/configuration/rc.js
HTTP routing
- HTTP hook
lib/hooks/http/index.js - Router
lib/router/index.js - Route binding
lib/router/bind.js - Request helpers
lib/router/req.js - Response helpers
lib/router/res.js - View rendering
lib/hooks/views/render.js
Actions and APIs
- Action loading
lib/app/private/controller/load-action-modules.js - Blueprint routes
lib/hooks/blueprints/index.js - Blueprint actions
lib/hooks/blueprints/actions/create.js
Core hooks
- Hook lifecycle
lib/hooks/index.js - Hook loading
lib/app/private/loadHooks.js - Security hooks
lib/hooks/security/index.js - Sessions
lib/hooks/session/index.js
Realtime and data
- Pub/sub
lib/hooks/pubsub/index.js - Waterline ORM
- Socket.io
Other components
- App developer
- HTTP client
Connections 21
- App developer → App factory: creates app
- App factory → Sails app: instantiates
lib/app/index.js - Sails app → Configuration: configures
lib/app/Sails.js - Configuration → Config loading: loads config
lib/app/configuration/index.js - Config loading → RC config: reads overrides
- Sails app → Hook loading: loads hooks
lib/app/Sails.js - Hook loading → Hook lifecycle: initializes
lib/app/private/loadHooks.js - Sails app → Router: sets up routing
lib/app/Sails.js - Router → Route binding: binds routes
lib/router/index.js - Router → Request helpers: uses helpers
lib/router/index.js - Router → Response helpers: uses helpers
lib/router/index.js - HTTP client → Router: sends requests
- Router → Action loading: dispatches actions
- Blueprint routes → Blueprint actions: registers actions
lib/hooks/blueprints/index.js - Router → View rendering: renders views
- Hook lifecycle → HTTP hook: initializes hook
- Hook lifecycle → Security hooks: initializes hook
- Hook lifecycle → Sessions: initializes hook
- Hook lifecycle → Pub/sub: initializes hook
- Waterline ORM → Sails app: provides ORM
- Socket.io → Sails app: enables realtime