A capsule for an aerosol-generating device is provided, including a shell including a base and at least one side wall extending from the base, the shell containing an aerosol-forming substrate; and a lid sealed on the at least one side wall for forming a sealed capsule, wherein the base includes a recess extending into said shell along the longitudinal axis for receiving a heater of an aerosol-generating device. An aerosol-generating device is also provided, including a power supply; at least one heater; a cavity for receiving the capsule containing the aerosol-forming substrate; and a mouthpiece including a piercing element for piercing the lid of the capsule, wherein the at least one heater is configured to be insertable into a recess of the capsule. An aerosol-generating system including the aerosol-generating device and the capsule is also provided.