Skip to main content

Deployment

Build TypeScript before production hile start. In development, hile start --dev imports src/**/*.boot.ts; in production it imports dist/**/*.boot.js.

Runtime And Lifecycle Notes

  • defineService(key, fn) registers a service factory and does not execute it.
  • loadService(service) executes the factory on first call and returns the cached value afterwards.
  • The shutdown callback registers teardown functions; they run in LIFO order.
  • The container tracks dependencies when service factories call loadService().
  • container.shutdown() triggers registered teardowns.
  • @hile/bootstrap loads env files first, sets NODE_ENV, imports auto-load packages, scans boot files, and installs exit hooks.
  • @hile/logger.createLogger() returns { logger, teardown }.
  • @hile/ioredis.createRedis() waits for connect.
  • @hile/typeorm.createDataSource() initializes a TypeORM DataSource.

Runtime And Lifecycle Notes

  • HttpNext wraps an internal Http instance.
  • It serves publicPath, then .next/static, then Hile controllers, then Next.js as the fallback handler.
  • Development mode is determined by process.env.NODE_ENV === 'development'.
  • Controller directory is {cwd}/src/{controllerDirectory} in development and {cwd}/dist/{controllerDirectory} in production.
  • specialControllers load additional controller roots with their own prefixes.

Production Checklist

  • Register every server/client close function with shutdown.
  • Load controllers before listen() in new code.
  • Size Redis lock TTLs for the actual job duration.
  • Monitor queue DLQs and idempotency release failures.
  • Keep DB constraints or provider idempotency keys for irreversible side effects.