Getting started
Flare is a TypeScript-first, GPU-rendered 2D engine for React Native and the web — one codebase for animation, gamification, interactive UI, and games on iOS, Android, and the browser. This page takes you from an empty directory to a running first frame.
-
Install the engine.
Add the umbrella package (
@flare-engine/engine), which re-exports the lower layers and providescreateGame(). Most apps also want the React bindings (<GameView>, hooks, virtual controls):Terminal window bun add @flare-engine/engine @flare-engine/reactTerminal window npm install @flare-engine/engine @flare-engine/reactTerminal window pnpm add @flare-engine/engine @flare-engine/reactTerminal window yarn add @flare-engine/engine @flare-engine/reactBecause the scope is restricted, point
@flare-engineat npm with an auth token first. Create an.npmrcnext to yourpackage.json:@flare-engine:registry=https://registry.npmjs.org///registry.npmjs.org/:_authToken=${NPM_TOKEN}Depend with a caret range so patch releases flow in:
^0.2.1.Prefer to start from a runnable template instead? Scaffold an Expo + Flare app — it ships a minimal scene and HUD:
Terminal window npm create flare-app@latest my-gameTemplates:
blank(empty scene,GameViewwired — the smallest starting point),topdown(4-dir movement, tilemap, camera follow), andshmup(auto-fire player, enemy spawner, HUD). -
Create a program.
The front door is
<GameView>— the React host that owns the Skia canvas, the fixed-timestep loop, and input. It lives in@flare-engine/reactand is re-exported from the@flare-engine/engineumbrella, so you can import it from either. Mount it, and inonReadystart the loop. This is theblankstarter verbatim:import { GameView, type GameContextValue } from "@flare-engine/engine";import type React from "react";import { StyleSheet, View } from "react-native";function handleReady(ctx: GameContextValue): void {ctx.loop.start();}export function App(): React.ReactElement {return (<View style={styles.root}><GameView onReady={handleReady} style={styles.game} /></View>);}const styles = StyleSheet.create({root: { flex: 1, backgroundColor: "#000" },game: { flex: 1 },});ctxis the game context —{ world, camera, input, audio, assets, scenes, loop, renderer, batch }— your entry point for spawning entities, registering scenes, and loading assets. -
Render the first frame.
ctx.loop.start()begins the fixed-timestep loop; the render system flushes the sprite batch once per frame, and<GameView>draws it to the Skia canvas. The empty scene above already produces a frame (a cleared canvas). To put something on screen, spawn an entity with aPositionand aSpritefromonReadyand drive it from the loop — see thetopdowntemplate for a worked example that adds a component and camera-follows it.The canonical, runnable first-scene code lives in the engine repo’s starter templates (
packages/create-flare-app/templates/) and the api-specs reference. This site links rather than forks it, so the API contract stays single-sourced. -
Run on web and native.
The same source targets both. Through React Native + Expo you run on iOS and Android, where rendering goes through
@shopify/react-native-skia; on the web the renderer is CanvasKit WASM, shipped as@flare-engine/render-web. (This site’s hero currently runs a local precursor of it; the published-package dogfood is in progress.) The scaffolded app (step 1) wires the Expo dev scripts for you — start it from your project the usual way and pick a target (iOS, Android, or web).
Next steps
Section titled “Next steps”- Concepts → Architecture — the layered package model, native vs web backends, and the dependency-flow rule.
- Guides → Overview — where to go next once the first frame is on screen.