Skip to content

Add native Windows Service support for bun build --compile executables #25824

@BattlefieldDuck

Description

@BattlefieldDuck

What is the problem this feature would solve?

On Windows, long-running background applications are typically deployed as Windows Services managed by the Service Control Manager (SCM).

Currently, executables produced by bun build --compile are standard console binaries and cannot be registered as true Windows services. Users must rely on third-party wrappers (e.g. NSSM / WinSW), custom native service hosts, or Task Scheduler, which adds extra complexity and dependencies.

This makes it harder to deploy Bun-based agents and daemons cleanly on Windows.

What is the feature you are proposing to solve the problem?

Add native Windows Service support to Bun so a compiled Bun executable can run as a proper SCM service without external wrappers.

This could be exposed via a CLI flag or a Windows-specific runtime mode that integrates with the Windows Service lifecycle (start, stop, shutdown).

What alternatives have you considered?

  • Third-party service wrappers (NSSM, WinSW)
  • Writing a separate native service host
  • Task Scheduler (not equivalent to SCM services)
  • bun:ffi / cc (cannot provide a service entrypoint)

All require additional tooling outside of Bun.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions