# Package application files as a Total.js bundle

> Create a local bundle, load its definitions through the framework startup loader and verify extraction into .src.

Framework: total5
Product: Total.js 5 (total5@0.0.19)
Language: en
Content-SHA256: 0d5c2183cc37e702073e256ef69943b26b22add5405e25c67915140353b0a76c
Snapshot: c0700e321579725c5cf4f5ace1ad7d2866d1b4f93c24a63c0b41b6b7998e976c
Sources: total5-installed@total5@0.0.19
Review: not-recorded

A Total.js application bundle is an archive created with `BACKUP()`, placed in the application's `bundles/` directory with the `.bundle` suffix. At startup `LOAD()` extracts bundles and combines application files into `.src/`; the framework then uses that directory as its application root. Bundle filenames containing `-bk.bundle` or `_bk.bundle` are ignored. A `bundles.debug` file reuses the already extracted `.src` directory.

The source also supports `.url` files that fetch remote bundle archives. Bundle files contain executable application code: load trusted archives only. Keep credentials, runtime databases and private files out of distributable archives. `BACKUP` is packaging, not encryption.

```js controllers/bundles.js
exports.install = function() {
	ROUTE('GET /bundle-loader/', $ => $.json({ load: typeof LOAD, backup: typeof BACKUP }));
};
```
