Skip to main content

Project Structure

A typical Krema project has the following structure:

my-app/
├── krema.toml # Krema configuration
├── pom.xml # Maven build file
├── package.json # Frontend dependencies
├── src/ # Frontend source (HTML/CSS/JS)
│ ├── index.html
│ ├── main.js
│ └── style.css
├── src-java/ # Java backend source
│ └── com/example/myapp/
│ ├── Main.java # Entry point
│ └── Commands.java # @KremaCommand methods
└── dist/ # Build output

Configuration: krema.toml

The krema.toml file is the central configuration for your Krema app:

[package]
name = "my-app"
version = "1.0.0"
identifier = "com.example.myapp"
description = "My Krema Application"

[window]
title = "My App"
width = 1200
height = 800
min_width = 800
min_height = 600
resizable = true
fullscreen = false
decorations = true

[build]
frontend_command = "npm run build"
frontend_dev_command = "npm run dev"
frontend_dev_url = "http://localhost:5173"
out_dir = "dist"

[bundle]
icon = "icons/icon.icns"
identifier = "com.example.myapp"
copyright = "Copyright 2024"

[bundle.macos]
signing_identity = ""
notarization_apple_id = ""

[permissions]
allow = [
"fs:read",
"clipboard:read",
"clipboard:write",
"notification"
]

[splash]
enabled = true
image = "splash.png"
width = 480
height = 320
show_progress = true

Window Options Reference

OptionTypeDefaultDescription
titlestring"Krema App"Window title
widthint1024Initial width
heightint768Initial height
min_widthint0Minimum width
min_heightint0Minimum height
resizablebooltrueAllow resizing
fullscreenboolfalseStart fullscreen
decorationsbooltrueShow title bar
always_on_topboolfalseAlways on top
transparentboolfalseTransparent background

Permissions Reference

Krema uses a permission system to control access to native APIs:

PermissionDescription
fs:readRead files from the filesystem
fs:writeWrite files to the filesystem
fs:*Full filesystem access
clipboard:readRead from clipboard
clipboard:writeWrite to clipboard
notificationShow desktop notifications
shell:executeExecute shell commands
shell:openOpen files/URLs with default app
system-traySystem tray access
system-infoRead system information
networkNetwork requests
dialogFile dialogs

Frontend Directory (src/)

Contains your web UI code. Krema supports any frontend framework:

  • React, Vue, Svelte, Angular
  • Vanilla HTML/CSS/JS
  • Any build tool (Vite, Webpack, etc.)

Java Backend (src-java/)

Contains your Java code:

  • Main.java: Application entry point using Krema.app() builder
  • Commands.java: Methods annotated with @KremaCommand for frontend calls
  • Plugins: Custom plugin implementations

Build Output (dist/)

After running krema build:

  • Compiled frontend assets
  • Compiled Java classes
  • Bundled JAR file
  • krema-commands.d.ts — auto-generated TypeScript definitions for your @KremaCommand methods
tip

Copy krema-commands.d.ts into your src/ directory (or set -Akrema.ts.outDir to write it there automatically) to get full autocompletion and type checking for krema.invoke() calls. See TypeScript Support.

After running krema bundle:

  • Platform-specific bundle (.app, .exe, .AppImage)
  • Installer if configured (.dmg, .msi)