All Modules are stored in the modules database.
The modules script will call upon the database requesting the modularity data
Should core and 3rd party module code be stored in a flat file or in a database?
This process will also be used for themes.