Point0by 1gr14
  • Меню
    • GitHub
    • Блог
  • Introduction
    • Overview
    • Getting Started
    • Full Overview
    • Benchmarks
    • Points
  • Points
    • Page
    • Layout
    • Component
    • Provider
    • Mountable
    • Query
    • Infinite Query
    • Mutation
    • Action
    • Root
    • Base
    • Plugin
  • Methods
    • Validation
    • Loader
    • Context
    • Middleware
    • Loading & error
    • .with
    • Mapper
    • Transformer
    • Stage Methods
  • Core
    • Navigation
    • SSR
    • RSC
    • Request
    • Response
    • Error handling
    • Env
    • Head
    • MDX
    • Assets
    • File upload
    • OpenAPI
    • Query client
    • Events
    • Infer
  • Engine
    • Engine Config
    • Engine Runtime
    • CLI
    • Dev
    • Build
    • Compiler
    • Generator
    • Project MCP
    • Docs MCP
    • Importer
    • Public dir
    • Testing
    • Deploy
    • Bun or Vite
  • Extra
    • SsrStore
    • CookieStore
    • Basic Auth
    • CORS
    • Cache-Control
    • Compress
  • Examples
    • Basic
    • Vite
    • Better Auth
    • Capacitor
    • Expo
  • 1gr14
    • Главная
    • Start0
    • Поддержать
    • Обучение
    • Группа
    • Блог
    • Автор
  • Сообщество
    • Discord
    • Telegram
  • Опенсорс
    • Point0
    • Route0
    • Error0
    • Flat
  • Аккаунт
    • Войти
    • Регистрация
Point0by 1gr14
Создаю опенсорс во славу Господа Иисуса Христа ☦️
С любовью ко всем разработчикам на свете ❤️
Условия использованияПолитика конфиденциальностиСергей Дмитриев 2026 😎

Vite Example

  • Раздел: Examples

On this page

  1. Running it
  2. For a real app
GitHub DevGitHub Source

examples/vite is the same app as basic — the IdeaNick ideas board, SSR, Prisma, Tailwind, pages, layouts, queries, mutations — with exactly one thing changed: the client is bundled by Vite (Rolldown) instead of Bun's native bundler. The app code is identical; only a handful of wiring files differ. The buttons above and below open the full source.

The switch is a single engine option. Add viteConfig, drop client.bunPlugins — there is no useVite flag, the presence of viteConfig is the switch:

// examples/vite/src/engine.ts
import tailwindcss from '@tailwindcss/vite'
import react from '@vitejs/plugin-react'

export const engine = Engine.create({
  file: import.meta.url,
  ssr: true,
  pointsGlob: '**/*.{ts,tsx,mdx}',
  viteConfig: ({ plugins, side }) => ({
    plugins: [
      ...plugins, // point0's own Vite compiler plugin — spread it in where you want
      react({ include: /\.(jsx|js|mdx|md|tsx|ts)$/ }),
      tailwindcss(), // replaces bun-plugin-tailwind
    ],
  }),
  // server / client config — as in basic, minus client.bunPlugins
})

viteConfig is a callback returning a Vite UserConfig. Its argument carries plugins (point0's compiler plugin, already inside — spread it), plus side, command, mode, and scope to branch on. You only add what you want on top; the engine injects root, define, the SSR/dev middleware, sourcemaps, and merges your callback over them. bun create point0-app@latest --vite scaffolds this wiring (--no-vite is the Bun default).

Beyond engine.ts, the Vite path differs in a few small ways: preload.ts passes preventLoadBunPlugins: true, index.html uses an absolute script src plus an explicit stylesheet <link>, index.server.ts (the entry) self-accepts Vite's SSR program via import.meta.hot (dispose → re-serve granularly, not a full reload), and there is a thin vite.config.ts so external tooling (vitest, the IDE) sees a normal Vite project. Two behavioral notes: --hot is a no-op under Vite (Bun-native feature), and the build is vite build for both client and server.

For why you'd pick one bundler over the other and how each pipeline works, see bun-vs-vite — that page owns the full Vite story.

Running it

Identical to basic — bun install && bun run build at the repo root, then bun run setup && bun run dev inside examples/vite. (The start script runs ./dist/server/main.js — Vite names the SSR entry by its entry key, where Bun names it by source basename; always read the example's own start script.) See getting-started.

For a real app

This example shows the Vite path in isolation. For a real product, start from Start0 — the SaaS boilerplate with auth, admin, forms, CRUD, email, and deploy already wired together (bun create start0@latest my-app).

GitHub DevGitHub Source
НазадBasic ExampleДалееBetter Auth Example

Enjoying Point0?

Give it a star on GitHub, ask questions, and follow what's new

Star Point0

A star on GitHub helps more developers find Point0
Star on GitHub

Start0

Point0 integrated into the Start0 SaaS boilerplate — the best way to use it
Explore Start0

YouTube

Tutorials, walkthroughs, and updates
YouTube

Discord

Questions and chat in English
Join Discord

Telegram

News channel and chat in Russian
ChannelChat

Twitter

Posts and updates
Twitter