Skip to main content
FarmFarm
Version: 1.x
On this page

Quick Start

Online experience

Edit Farm

Create a Farm Project

sh
npm create farm@latest
sh
yarn create farm@latest
sh
pnpm create farm@latest
sh
bun create farm@latest
sh
npm create farm farm-app --template react
sh
yarn create farm farm-app --template react
sh
pnpm create farm farm-app --template react
sh
bun create farm farm-app --template react
TemplateDescriptionOptional Features
vanillaVanilla JavaScriptTypeScript
reactreact18TypeScript
vue3vue3TypeScript
vue2vue2TypeScript
sveltesvelteTypeScript
solidsolidTypeScript
preactpreactTypeScript
litlitTypeScript
nestjsnestjsTypeScript
tauritauri2TypeScript
electronelectronTypeScript

2. Start the Project

Choose the package manager you like, install dependencies, then start the project. Then, start the project:

sh
cd farm-app && npm install && npm dev
sh
cd farm-app && yarn install && yarn dev
sh
cd farm-app && pnpm install && pnpm dev
sh
cd farm-app && bun install && bun dev

The project will start at http://localhost:9000 by default.

3. Configuring the Project

The project is configured by farm.config.ts/js/mjs file in the root directory of the project.

farm.config.ts
import { defineConfig } from "@farmfe/core";
import react from '@farmfe/plugin-react';

export default defineConfig({
  // Additional plugins
  plugins: [react()],
});

4. Building the project

Build the Farm project as production-ready static files:

sh
npm run build
sh
yarn run build
sh
pnpm run build
sh
bun run build

The built product is downgraded to ES2017 by default, and the product will be compressed and Tree Shake. If you want to preview the build product locally, you can execute npm run preview or npx farm preview.

4. Preview the build products

Start preview server

sh
npm run preview
sh
yarn run preview
sh
pnpm run preview
sh
bun run preview

Next Steps


100%

Drag or pinch to explore. Keyboard: + / − zoom, arrows pan, 0 resets, Esc closes.