Scripts Reference
ElyOS is a Bun workspaces based monorepo. The root package.json contains main commands that invoke workspace package scripts.
Monorepo Structure
Section titled “Monorepo Structure”elyos-core/├── package.json # Root scripts (using bun --filter)├── apps/│ └── web/│ └── package.json # @elyos/core scripts└── packages/ └── database/ └── package.json # @elyos/database scriptsImportant: Root scripts can be run from anywhere in the monorepo. Scripts specific to apps/web must be run from the apps/web directory.
Development
Section titled “Development”bun app:dev
Section titled “bun app:dev”Location: Root
Runs: apps/web → dev script
Starts SvelteKit dev server with local .env file (without Varlock).
bun app:devWhat it does:
- Loads
../../.envfile (root.env) - Starts Vite dev server (
http://localhost:5173) - Hot module replacement (HMR) enabled
When to use: Local development, fast iteration.
bun app:dev:varlock
Section titled “bun app:dev:varlock”Location: Root
Runs: apps/web → dev:varlock script
Starts SvelteKit dev server with Varlock (Infisical secrets).
bun app:dev:varlockWhat it does:
- Varlock loads secrets from Infisical
- Validates environment variables
- Starts Vite dev server
When to use: Testing configuration similar to production.
Build and Preview
Section titled “Build and Preview”bun app:build
Section titled “bun app:build”Location: Root
Runs: apps/web → build script
Creates production build.
bun app:buildWhat it does:
- SvelteKit production build (
vite build) - Adapter-node output:
apps/web/build/ - Static assets:
apps/web/build/client/
bun app:preview
Section titled “bun app:preview”Location: apps/web
Runs: preview script
Starts production build locally.
cd apps/webbun previewWhat it does:
- Starts Express + Socket.IO server (
server.js) - Serves built application
- Port:
process.env.PORTor3000
Prerequisite: Run bun app:build first.
Type Checking
Section titled “Type Checking”bun app:check
Section titled “bun app:check”Location: Root
Runs: apps/web → check script
TypeScript and Svelte type checking.
bun app:checkWhat it does:
svelte-kit sync— generates SvelteKit typessvelte-check— checks Svelte componentstsc— TypeScript type checking
When to use: Before commit, in CI/CD.
Database
Section titled “Database”bun db:init
Section titled “bun db:init”Location: Root
Runs: packages/database → db:init script
First startup — complete database initialization.
bun db:initWhat it does:
db:generate— generate migrationsdb:migrate— run migrationsdb:seed— load seed data
When to use: First installation or after complete reset.
bun db:generate
Section titled “bun db:generate”Location: Root
Runs: packages/database → db:generate script
Generate Drizzle migrations from schema changes.
bun db:generateWhat it does:
- Compares
src/schemas/files with database - Generates SQL migration files in
drizzle/folder
When to use: After schema modification (new table, column, index, etc.).
bun db:migrate
Section titled “bun db:migrate”Location: Root
Runs: packages/database → db:migrate script
Run pending migrations.
bun db:migrateWhat it does:
- Runs all new migrations from
drizzle/folder - Updates
__drizzle_migrationstable
bun db:seed
Section titled “bun db:seed”Location: Root
Runs: packages/database → db:seed script
Load seed data.
bun db:seedWhat it does:
- Runs seed scripts from
src/seeds/folder - Creates admin user (based on
ADMIN_USER_EMAIL) - Loads default applications, roles, etc.
bun db:studio
Section titled “bun db:studio”Location: Root
Runs: packages/database → db:studio script
Open Drizzle Studio.
bun db:studioWhat it does:
- Starts Drizzle Studio web interface
- Opens in browser:
https://local.drizzle.studio - Visual database browser and editor
bun db:reset
Section titled “bun db:reset”Location: Root
Runs: packages/database → db:reset script
Complete database reset.
bun db:resetWhat it does:
- Drops all tables
- Re-runs migrations
- Loads seed data
Warning: All data is lost!
Docker
Section titled “Docker”bun docker:db
Section titled “bun docker:db”Location: Root
Start PostgreSQL container only.
bun docker:dbWhat it does:
- Starts
postgresservice - Port:
5432 - Data:
docker/postgres-data/(persistent)
When to use: Local development, database only.
bun docker:up
Section titled “bun docker:up”Location: Root
Start full stack (ElyOS + PostgreSQL).
bun docker:upWhat it does:
- Builds Docker image
- Starts
appandpostgresservices - Detached mode (
-d)
Available at: http://localhost:3000
bun docker:down
Section titled “bun docker:down”Location: Root
Stop all containers.
bun docker:downWhat it does:
- Stops and removes containers
- Volumes remain (data not lost)
bun docker:logs
Section titled “bun docker:logs”Location: Root
Follow container logs.
bun docker:logsWhat it does:
- Real-time container logs
Ctrl+Cto exit
Testing
Section titled “Testing”bun test
Section titled “bun test”Location: apps/web
Run all tests once.
cd apps/webbun testWhat it does:
- Vitest unit tests
--runmode (not watch)
bun test:watch
Section titled “bun test:watch”Location: apps/web
Run tests in watch mode.
cd apps/webbun test:watchWhat it does:
- Re-runs tests on file changes
- Interactive mode
bun test:pbt
Section titled “bun test:pbt”Location: apps/web
Run property-based tests only.
cd apps/webbun test:pbtWhat it does:
- Runs tests containing “Property”
- fast-check based tests
Code Quality
Section titled “Code Quality”bun lint
Section titled “bun lint”Location: apps/web
Prettier and ESLint check.
cd apps/webbun lintWhat it does:
prettier --check .— formatting checkeslint .— code quality check
bun format
Section titled “bun format”Location: apps/web
Automatic code formatting.
cd apps/webbun formatWhat it does:
prettier --write .— formats all files
Common Workflows
Section titled “Common Workflows”First Startup
Section titled “First Startup”# 1. Dependenciesbun install
# 2. Env filecp .env.example .env# Edit .env file
# 3. Databasebun docker:dbbun db:init
# 4. Dev serverbun app:devSchema Modification
Section titled “Schema Modification”# 1. Modify packages/database/src/schemas/ files
# 2. Generate migrationbun db:generate
# 3. Run migrationbun db:migrate
# 4. (Optional) Re-run seedbun db:seedProduction Build Testing
Section titled “Production Build Testing”# 1. Buildbun app:build
# 2. Previewcd apps/webbun previewDocker Deployment
Section titled “Docker Deployment”# 1. Env file (bootstrap credentials only)cp .env.example .env# INFISICAL_CLIENT_ID and INFISICAL_CLIENT_SECRET
# 2. Startbun docker:up
# 3. Logsbun docker:logsNext Steps
Section titled “Next Steps”- Environment Variables → — Varlock and Infisical
- Database → — Drizzle ORM and migrations
- Testing → — Unit and property-based tests