# Quick start Create a React Native app with a Backtick server in one command, then write a screen, serve it per request and draw it in your app. ```sh npx create-backtick-app@latest ``` It asks for a name, then creates an Expo app with a Backtick server beside it, on Node, and installs its packages. Give the name on the command line, `npx create-backtick-app@latest my-app`, and it asks nothing. It needs Node 22 (22.15 or later) or 24 (24.3 or later), not 23. For a web page instead, pass `--template react` or `--template solid-js`; for a server on Bun, `--runtime bun`. ## Open it on your phone 1. Install Expo Go on your phone, from the App Store or Google Play. 2. Connect your phone to the same Wi-Fi network as your computer. 3. Start your project: ```sh cd my-app npm start ``` It starts your Backtick server and Expo together, and shows a QR code. 4. Scan the QR code: with the Camera app on iPhone, or with Expo Go on Android. No phone at hand? `npm run ios` opens the app in the iOS Simulator, `npm run android` in an Android emulator, and `npm run web` in a browser. The app shows a welcome screen. It isn't in the app: your server sent it. ## Change the screen The screen is `server/Home.tsx`. Replace it with this, and save: ```tsx title="server/Home.tsx" import { cs } from "@backtickjs/core"; import { useState } from "react" with { backtick: "client" }; import { Pressable, Text, View } from "react-native" with { backtick: "client", }; // A client component: it runs on the phone. const Counter = cs`() => { const [count, setCount] = $useState(0); return ( <$Pressable onPress={() => setCount(count + 1)}> <$Text style={{ fontSize: 18, color: "#0a7ea4" }}> Tapped {count} times ); }`; // A server component: it runs on your server, for every request. export async function Home() { const time = new Date().toLocaleTimeString(); return cs`( <$View style={{ flex: 1, justifyContent: "center", alignItems: "center", gap: 16, }} > <$Text style={{ fontSize: 24 }}>Served at {$time} <$Counter /> )`; } ``` Your server restarts, and the app reloads: it shows the new screen, without rebuilding. Tap the counter, then reload the app, by pressing `r` in the terminal running it: the time changes, because the server ran `Home` again. What you just wrote: - **`Home` is a server component.** It runs on your server, for every request. Read from a database here, call an API, use any npm package: none of it reaches the phone. - **`` cs`…` `` is a client script.** The code inside the backticks runs on the phone. Here, it's the screen's JSX. - **`$time` is a splice.** It's a value from your server, written into the screen as data. TypeScript checks it on both sides. - **`Counter` is a client component.** It's a script that takes props, used as `<$Counter />`. Its state lives on the phone. - **`$View` and `$useState` are React Native and React,** with the same names and types: `View` imported from `react-native` with `with { backtick: "client" }`, and `useState` from `react`, the same way. ## What's in your project ```text my-app/ ├── app.json Expo's config ├── client/ │ ├── App.tsx The app: fetches each screen from your server and draws it │ └── backtick.ts What screens may import from the app, and its versions ├── server/ │ ├── index.tsx Your server: its routes │ ├── Home.tsx The screen you just changed │ ├── Home.test.tsx A test that draws the welcome screen, run by npm test │ ├── HelloWave.tsx The welcome screen's waving hand, safe to delete │ ├── test/ What the test draws the screen with │ └── tsconfig.json TypeScript for your server ├── scripts/ What npm start runs, and npm run reset-project ├── installed-packages.json Your packages' versions, written by npm install └── package.json ``` Everything in `server/` reaches users without an app release: deploy your server, and users get the change the next time they open the screen. `npm run typecheck` checks the app and your server, the code inside every `` cs`…` `` included. `npm test` draws the welcome screen and checks what it shows, so it fails now that you've changed the screen; the tutorial writes a test for yours. Tests run on Node, even when your server runs on Bun. `npm run reset-project` replaces `server/Home.tsx` with a blank screen, rewrites the test to match, and deletes `HelloWave.tsx`, when you're ready to start your own. ## A web page instead With `--template react` or `--template solid-js`, `npm start` runs your server on http://localhost:3000, which serves the page: open it in a browser, and refresh after you save. The project has no `client/`: `server/html.ts` writes the page, which loads React or Solid from a CDN. It has no tests yet. ## Next steps - **[Tutorial](/docs/tutorial/):** build a coffee-ordering screen, step by step, in the project you just created. - **[Thinking in Backtick](/docs/thinking-in-backtick/):** what runs where, and what crosses between your server and the phone. --- # Tutorial Build a coffee-ordering screen in six steps: a menu from your server, an order kept on the phone, sent back, and remembered for next time. Each step shows `server/Home.tsx`, with what changed marked. The steps use the React Native template, the Quick start's default. On a web template, `--template react` or `--template solid-js`, the same steps work with the browser's elements: - **Elements:** `<$View>`, `<$ScrollView>` and `<$Text>` become `
`, `
` and ``, written without `$`: the browser draws them. - **Taps:** `<$Pressable onPress={…}>` becomes `