The trap environment in which Bose-Einstein condensates are generated and/or stored strongly influences the way they interact with light. The situation is analogous to cavity QED in quantum optics, except that in the present case, one tailors the matter-wave mode density rather than the density of modes of the optical field. Just as in QED, for short times, the atoms do not sense the trap and propagate as in free space. After times long enough that recoiling atoms can probe the trap environment, however, the way condensates and light fields are mutually influenced differs significantly from the free-space situation. We use as an example the condensate collective atomic recoil laser, which is the atomic matter-wave analog of the free-electron laser.