Build and Packaging
Build Process
Section titled “Build Process”There are two main build steps during app development: standalone dev mode and production build.
Standalone Dev Mode
Section titled “Standalone Dev Mode”bun run devStarts a Vite dev server (http://localhost:5174) that mounts App.svelte directly via the index.html → src/main.ts entry point. Used together with the Mock SDK, it provides a full development experience in the browser with hot reload.
This mode does not run the IIFE bundle — the app runs here as a normal Svelte app, not as a Web Component.
Production Build (for loading into ElyOS)
Section titled “Production Build (for loading into ElyOS)”bun run buildCompiles the app to IIFE format in the dist/ folder. Vite uses the src/app.ts entry point, which exports the app as a Web Component. This bundle is loaded by ElyOS.
Build output:
dist/└── index.iife.js # IIFE bundle — loaded by ElyOSStatic Dev Server (for testing in ElyOS)
Section titled “Static Dev Server (for testing in ElyOS)”bun run dev:serverStarts the dev-server.ts Bun HTTP server at http://localhost:5174. The server serves files from the dist/ folder and the project root with CORS headers — ElyOS fetches the manifest.json and IIFE bundle from here.
Building an App with menu.json
Section titled “Building an App with menu.json”If the app contains a menu.json (AppLayout mode), all page components must be built separately in addition to the main component. The build-all.js script automates this:
bun run build:allThis script:
- Builds the main app (
BUILD_MODE=main) - Iterates through the
src/components/folder - Builds each
.sveltefile separately (BUILD_MODE=components)
// build-all.js (excerpt)execSync('BUILD_MODE=main vite build', { stdio: 'inherit' });
for (const file of svelteFiles) { execSync(`BUILD_MODE=components COMPONENT_FILE=${file} vite build`, { stdio: 'inherit' });}In vite.config.js, the BUILD_MODE env variable determines which entry point to build.
Packaging (.elyospkg)
Section titled “Packaging (.elyospkg)”After building, the app must be packaged into a single .elyospkg file:
bun run packageThis runs the build-package.js script in the project root, which:
- Reads
manifest.jsonfor theidandversionfields - Collects the
dist/,locales/,assets/folders andmanifest.json - Compresses them into a ZIP archive
- Saves it with the
.elyospkgextension in the project root
The package name is composed from the id and version fields in manifest.json:
{app-id}-{version}.elyospkgFor example: hello-world-1.0.0.elyospkg
Package Contents
Section titled “Package Contents”hello-world-1.0.0.elyospkg (ZIP archive)├── manifest.json├── dist/│ └── index.iife.js├── locales/│ ├── hu.json│ └── en.json├── assets/│ └── icon.svg├── migrations/ # optional — only if migrations/ folder exists│ └── 001_init.sql└── server/ # optional — only if server/ folder exists └── functions.jsThe build-package.js automatically only packages folders/files that actually exist — missing migrations/ or server/ folders don’t cause errors.
Upload
Section titled “Upload”Via App Manager UI (recommended)
Section titled “Via App Manager UI (recommended)”- Open ElyOS in the browser
- Click Start menu → App Manager
- Click the “Upload App” button
- Select the
.elyospkgfile - Confirm the installation
Via API
Section titled “Via API”The /api/apps/upload endpoint uses session cookie-based authentication (better-auth) — Bearer tokens are not supported. This means the API can only be called from a logged-in browser, or an HTTP client that includes the session cookie.
Upload with curl (using a session cookie copied from the browser):
curl -X POST https://your-elyos-instance.com/api/apps/upload \ -H "Cookie: better-auth.session_token=<session_token>" \ -F "file=@hello-world-1.0.0.elyospkg"The session token can be copied from browser DevTools → Application → Cookies → better-auth.session_token (while logged in).
Updates
Section titled “Updates”When updating an existing app, increment the version number in manifest.json and upload the new package. ElyOS automatically recognizes it as an update.
Full Build Workflow
Section titled “Full Build Workflow”# 1. Standalone development (Vite dev server, Mock SDK, hot reload)bun run dev
# 2. Testing in ElyOSbun run build # Create IIFE bundlebun run dev:server # Start static server (http://localhost:5174)# ElyOS: App Manager → Dev Apps → Load → http://localhost:5174
# 3. Production packagingbun run buildbun run package # Create .elyospkg file
# 4. Upload (recommended via App Manager UI)# Or with curl, using session cookie:curl -X POST .../api/apps/upload \ -H "Cookie: better-auth.session_token=<token>" \ -F "file=@my-app-1.0.0.elyospkg"