New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

elm-native

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

elm-native

Scaffold hybrid mobile apps with Elm + Vite + Capacitor

latest
npmnpm
Version
0.1.1
Version published
Maintainers
1
Created
Source

elm-native

Scaffold hybrid mobile apps with Elm, Vite, and Capacitor. (Blog post)

npx elm-native my-app
cd my-app
npm run dev

This gives you a working Elm + Vite + Capacitor project with iOS and Android ready to go, including safe area inset handling so you don't have to fight the notch on day one.

Why?

I wanted to write mobile apps in Elm. Getting Elm, Vite, and Capacitor to play nice together is not trivial, so I made a scaffolding tool. It's very much an MVP, but it works.

What you get

my-app/
├── src/
│   ├── Main.elm          # Your Elm app (starts as a counter)
│   └── main.js           # Thin JS bridge to Capacitor
├── index.html            # Mobile-friendly HTML shell
├── elm.json
├── vite.config.js
├── capacitor.config.json
├── android/              # Open with Android Studio
├── ios/                  # Open with Xcode
└── assets/               # App icons and splash screens

The template includes a simple counter that handles safe area insets, so you can see the full Elm-to-native pattern in action before replacing it with your own code.

How it fits together

main.js reads device info from Capacitor (like safe area insets) and passes it to Elm as flags. Elm handles all the UI. Vite compiles Elm via vite-plugin-elm. Capacitor wraps the built web app in a native shell.

Scripts

CommandWhat it does
npm run devVite dev server on port 3000
npm run buildProduction build to dist/
npm run syncGenerate assets, build, and sync to native projects
npm run open:androidOpen in Android Studio
npm run open:iosOpen in Xcode
npm run run:androidBuild and run on Android device/emulator
npm run run:iosBuild and run on iOS device/simulator

Adding native capabilities

Install a Capacitor plugin and wire it up in main.js:

npm install @capacitor/camera

Use flags for initial data, ports for runtime communication back to Elm.

Requirements

  • Node.js
  • Android Studio for Android (works on all platforms)
  • Xcode for iOS (requires macOS)

License

MIT

Keywords

elm

FAQs

Package last updated on 13 Feb 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts