Scripting mass app installation with occ or a compose file

Hey, wondering what the best way would be to export my installed app list so I can script installation as opposed to locating, installing and enabling the same 40 apps from the webui appstore.

I see the /apps directory for www-data and was curious how others are handling this.

Thanks!