Sierra guide / Introduction
Getting started
Install Sierra and Mesa, add three small files to web/, and Vite serves the app. Sierra reads the route table from src/routes/ and boots the router for you.
bun add /sierra /mesa
bun add vite
// web/config/sierra.config.js
export default {
target: 'spa',
routesDir: 'src/routes',
trailingSlash: 'always',
junction: {
url: 'http://localhost:8000',
apiPrefix: '/api',
tokenKey: 'myapp_token',
},
}
// web/config/vite.config.js
import { defineConfig } from 'vite'
import { createSierraViteConfig } from '@frontierjs/sierra/build'
import sierraConfig from './sierra.config.js'
export default defineConfig(createSierraViteConfig(sierraConfig))
<!-- web/index.html -->
<div id="app"></div>
<script type="module" src="virtual:sierra"></script>
<!-- web/src/App.mesa -->
<script>
import { RouterView } from '@frontierjs/sierra/router'
</script>
<RouterView />
cd web && vite config/vite.config.js # dev
cd web && vite build config/vite.config.js # production
What else it can do
virtual:sierraboots the router, Junction, theme and analytics, and mountssrc/App.mesainto#app- Without an
App.mesait mounts the bareRouterView src/main.jsis optional and holds the app's side-effect imports, such asimport '@frontierjs/css'<RouterView {failed} />takes afailedsnippet drawn when a route throws while it renders@frontierjs/junctionand@frontierjs/litestoneare optional peers, installed when you use resources and schema seedingexample/is a runnable app over a real Junction API
In depth: Sierra README § Installation, § Quick start