  TRAPPIST-1 is a nearby 0.08 M M-star, which was recently found to harbor a
planetary system of at least seven Earth-mass planets, all within 0.1 au. The
configuration confounds theorists as the planets are not easily explained by
either in situ or migration models. In this Paper we present a scenario for the
formation and orbital architecture of the TRAPPIST-1 system. In our model,
planet formation starts at the H2O iceline, where pebble-size particles --
whose origin is the outer disk -- concentrate to trigger streaming
instabilities. After their formation, planetary embryos quickly mature by
pebble accretion. Planet growth stalls at Earth masses, where the planet's
gravitational feedback on the disk keeps pebbles at bay. Planets are
transported by Type I migration to the inner disk, where they stall at the
magnetospheric cavity and end up in mean motion resonances. During disk
dispersal, the cavity radius expands and the inner-most planets escape
resonance. We argue that the model outlined here can also be applied to other
compact systems and that the many close-in super-Earth systems are a scaled-up
version of TRAPPIST-1. We also hypothesize that few close-in compact systems
harbor giant planets at large distances, since they would have stopped the
pebble flux from the outer disk.
