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 😎

Basic Example

  • Раздел: Examples

On this page

  1. Running it
  2. For a real app
  3. The other examples
GitHub DevGitHub Source

examples/basic is the canonical Point0 app, IdeaNick — a collective ideas blog where anyone posts an idea and adds news updates to it. It is the reference the other four examples are described against: each of them is "the same app, but with one piece swapped". The buttons above and below open it on CodeSandbox, GitHub, and github.dev; this page only sketches the shape.

What it puts together:

  • SSR for the first load, then client-side (SPA-style) navigation between pages
  • the whole point family wired up — pages, layouts, queries, mutations, components — plus an MDX page
  • Prisma + SQLite, type-safe routing through wouter, Tailwind v4, React 19 with the React Compiler
  • a client bundled by Bun (this is the distinctive choice — the vite example bundles the same client with Vite instead)
  • a file upload, infinite-query pagination, and an OpenAPI spec behind basic auth

Everything grows from the root — one builder chain that sets the serialization wire, the schema helper, the error class, the prefetch policy, the global head, the loading/error fallbacks, and the OpenAPI middleware:

// examples/basic/src/lib/root.tsx
export const root = Point0.lets
  .root()
  .serverUrl(sharedEnv.SERVER_URL)
  .clientUrl(sharedEnv.CLIENT_URL)
  .transformer(superjson) // Date/Map/etc survive the SSR wire
  .schemaHelper(zodSchemaHelper()) // teach Point0 to read zod schemas
  .errorClass(AppError) // your own error class (default is ErrorPoint0)
  .head('global', () => ({
    titleTemplate: '%s | IdeaNick',
    htmlAttrs: { lang: 'en' },
  }))
  .loading(() => <LoadingCard />) // shown while any point's data is pending
  .error(({ error }) => <ErrorCard error={error} />) // shown on a thrown error
  .middleware(
    openapi({
      route: '/openapi.json',
      filter: 'all',
      before: basicAuth({ users: { admin: 'admin' } }),
    }),
  )
  .root()

Every page, query, and mutation in the app starts from root.lets. From there a typical point is a short .lets chain — a server .loader (Prisma never ships to the browser), then the closing call that picks its kind:

// examples/basic/src/lib/idea.ts — a query: a reusable, cacheable read
export const ideaViewQuery = root.lets
  .query()
  .input(z.object({ id: z.number() }))
  .loader(async ({ input }) => ({
    idea: await prisma.idea.findUniqueOrThrow({ where: { id: input.id } }),
  }))
  .query()

For each piece — pages, layouts, queries, mutations, components, assets, file upload, infinite query, MDX, OpenAPI — follow the link to its own page; the source shows how they come together here.

Running it

From the repo root once, then inside examples/basic:

# repo root — build the @point0/* packages so the `point0` CLI exists
bun install
bun run build

# in examples/basic
bun run setup   # SQLite DB + prisma generate + point0 generate + seed
bun run dev     # point0 dev --hot — server + client, server hot reload

src/generated/ (the Prisma client and Point0's points/routes/assets) is gitignored — bun run setup produces it. For production, bun run build then bun run start. See getting-started, CLI, and Dev.

For a real app

This example shows Point0 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).

The other examples

  • vite — same app, client bundled by Vite instead of Bun.
  • better-auth — same app, plus Better Auth.
  • capacitor — same app, wrapped in a native mobile shell. Experimental.
  • expo — Point0's server and data layer behind a React Native client. Experimental.
GitHub DevGitHub Source
НазадCompressДалееVite 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