This time of year, fireworks are even more American than apple pie. But about halfway through every Fourth of July display, don't you sometimes wonder how the heck anyone could pull of such a blazing light parade? Turns out, a lot more goes into a typical fireworks show than meets the eye—intense preparation, computer choreography, solid science and hand-me-down secrets that stretch back across two millennia.

"It can take anywhere from 10 hours to two weeks to set up a show," says Marcy Zambelli, executive vice president of Zambelli Internationale, a 114-year old company that counts Disney theme parks, the Kentucky Derby and the Super Bowl among its clients—and even holds the world record for launching fireworks from the highest altitude ever. "We produce 1800 shows for the Fourth of July each year, and use more than 1 million shells doing it."

Each of those shells still makes its way to the sky just as it did over 100 years ago, when Antonio Zambelli immigrated to the United States with a black book full of secret fireworks recipes—that he packed by hand. "You have to be very careful that you don't create any type of spark," says Zambelli. The multi-break shells can range from 3 in. to 12 in. in diameter and weigh between 1 and 60 lbs. A single projectile is packed with a mixture of potassium nitrate, sulfur and charcoal known as "black powder," which acts as both a propellant and a bursting charge.

To create patterns that dazzle us year after year, the company uses something like a cookie cutter. "We open up the shell and place in the stars in the shape we want," says Zambelli, "so when the fireworks break open, they create that pattern."

Once you pack, color and shape fireworks, there's nothing left but to fire them. Shooting the shells as high as 1500 ft. requires metal, heavy cardboard or PVC mortar tubes. A computer-created schematic determines how to position and drive the tubes into the ground, with the shells and their corresponding mortars numbered for firing sequences. The diameters of the mortars and shells must match, or else the proper pressure cannot be generated and the shells won't catapult into the air.

After the shell drops into the mortar, a long fuse rises up out of the tube and connects a pouch of explosive black power to an electrical match known as a squib. The fireworks are launched when electrical currents travel through the wires to ignite the shell.

Since the Chinese invented them two millennia ago, very little about fireworks has changed—with one exception. "The only thing that has changed in our industry is the computer," Zambelli says. "It allows us to choreograph shows to music, put the mortars in sequential order and even fire the fireworks with the computer." —Erin McCarthy