Installation

Create a new Bini.js application and run it locally.

Quick start

The quickest way to create a new Bini.js app is using create-bini-app, which sets up everything automatically.

>_Terminal
$ npx create-bini-app@latest my-app
$ cd my-app
$ npm run dev

On installation, you'll see the following prompts:

>_Terminal
? Project name? (my-bini-app)
 
? Use TypeScript?
> Yes
No
↑↓ navigate • ⏎ select
 
? Styling solution?
> Tailwind CSS
CSS Modules
None
↑↓ navigate • ⏎ select
 
? Which platform would you like to target?
> Web Application
Windows Desktop
Linux Desktop
macOS Desktop
Android
iOS
↑↓ navigate • ⏎ select
After the prompts, create-bini-app creates a folder with your project name, installs the required dependencies, and enables TypeScript, Tailwind CSS, Oxlint, the App Router, and the @/* import alias by default.

CLI flags

Skip prompts by passing flags directly:

FlagDescription
--typescriptUse TypeScript (default)
--javascriptUse JavaScript
--tailwindUse Tailwind CSS (default)
--css-modulesUse CSS Modules
--noneNo styling
--platform <target>web · windows · macos · linux · android · ios
--app-name <name>Display name for desktop / mobile apps
--sign / --nosignCode-signing setup
--npm / --pnpm / --yarn / --bunForce a specific package manager
--install / --no-installInstall dependencies
--forceOverwrite existing directory
--version, -vPrint CLI version
--help, -hShow help

System requirements

Before you begin, make sure your development environment meets the following requirements:

  • Minimum Node.js version: 20.19.0
  • Operating systems: macOS, Windows, and Linux.
  • For desktop builds: Windows (C++ Build Tools), macOS (Xcode CLT), Linux (WebKitGTK).
  • For mobile builds: Android (JDK 17, Android Studio), iOS (Xcode, CocoaPods).

Supported browsers

Bini.js supports modern browsers with zero configuration.

  • Chrome 111+
  • Edge 111+
  • Firefox 111+
  • Safari 16.4+

Native platform support

Bini.js builds for multiple platforms from a single codebase. Use the --platform flag to target a specific platform:

>_Terminal
$ npx create-bini-app@latest my-app --platform macos
$ npx create-bini-app@latest my-app --platform android --app-name "My App" --nosign
$ npx create-bini-app@latest my-app --platform windows

Every platform gets the full framework - routing, layouts, API routes, SSG, the overlay, and the rest. The --platform flag only decides what the build targets.

PlatformBuilds
webWeb app
windows · macos · linuxNative desktop binaries
android · iosNative mobile apps

Run the development server

Each platform has its own dev command. Run the one that matches the platform you scaffolded.

Web

>_Terminal
$ npm run dev

Starts the Vite dev server and opens your browser automatically.

Windows

>_Terminal
$ npm run tauri:dev

Launches the app in a native Windows window with full HMR.

macOS

>_Terminal
$ npm run tauri:dev

Launches the app in a native macOS window with full HMR.

Linux

>_Terminal
$ npm run tauri:dev

Launches the app in a native Linux window with full HMR.

Android

>_Terminal
$ npm run android

Runs the app on a connected Android device or emulator.

iOS

>_Terminal
$ npm run ios

Runs the app on a connected iOS device or simulator.

Set up TypeScript

Bini.js now supports TypeScript 7, the native compiler, ~10× faster. Just pick TypeScript in create-bini-app or use the --typescript flag, and the CLI sets everything up for you.

Set up linting

Bini.js uses Oxlint for linting and Oxfmt for formatting - pre-configured and ready to use.

{}package.json
{
  "scripts": {
    "lint": "oxlint",
    "format": "oxfmt",
    "check": "npm run lint && npm run format"
  }
}

These scripts refer to the different stages of developing an application:

  • npm run lint - runs Oxlint.
  • npm run format - runs Oxfmt.
  • npm run check - runs both lint and format.

Set up absolute imports and module path aliases

Bini.js has built-in support for path aliases using the "paths" option in tsconfig.json. These options let you alias project directories to absolute paths, making imports easier to read and refactor:

// Before
import { Button } from '../../../components/button'

// After
import { Button } from '@/components/button'

Path aliases are configured by default:

tsconfig.json
{
  "compilerOptions": {
    "paths": {
      "@/*": ["./src/*"]
    }
  }
}
Vite resolves the @ alias to the src directory through the resolve.alias entry in vite.config.ts.
vite.config.ts
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'
import { biniroute } from 'bini-router'
import { biniOverlay } from 'bini-overlay'
import { biniEnv } from 'bini-env'
import { biniSSG } from 'bini-ssg'

export default defineConfig({
  plugins: [
    tailwindcss(),
    react(),
    biniroute(),
    biniOverlay(),
    biniEnv(),
    biniSSG(),
  ],
  resolve: {
    alias: { '@': '/src' },
  },
})
Was this helpful?