Compare commits

..

12 Commits

Author SHA1 Message Date
imbytecat 036afb8d20 chore: remove React Compiler and @rolldown/plugin-babel 2026-04-01 18:26:09 +08:00
imbytecat 688252fd49 chore(deps): bump @biomejs/biome to 2.4.9 and @orpc/* to 1.13.11 2026-03-26 01:14:09 +08:00
imbytecat 42c2fff7cd chore: update VS Code TypeScript SDK path 2026-03-25 09:58:50 +08:00
imbytecat 034f570794 chore(deps): update TanStack devtools packages 2026-03-25 09:51:21 +08:00
imbytecat ea5935e29b chore(deps): remove babel-plugin-react-compiler 2026-03-25 09:45:37 +08:00
imbytecat 3663f3d010 chore(deps): add @rolldown/plugin-babel and update dependencies
- Add @rolldown/plugin-babel for React compiler support
- Update TypeScript to 6.0.2
- Update TanStack packages (@tanstack/react-query, @tanstack/react-router, @tanstack/react-start)
- Update @vitejs/plugin-react to 6.0.1
- Update Vite to 8.0.2 and Nitro nightly
- Refactor vite.config.ts to use separate babel plugin with reactCompilerPreset
2026-03-25 09:44:13 +08:00
imbytecat 9d1beab2e1 chore: migrate to TypeScript 6.0.2
- Upgrade typescript from 5.9.3 to 6.0.2
- Add explicit types: ['node'] to base tsconfig (TS6 breaking change)
- Remove deprecated baseUrl from server tsconfig
- All typecheck passing
2026-03-25 09:23:07 +08:00
imbytecat 88326c4992 refactor(server): 改用 Vite 原生 tsconfig 路径解析 2026-03-22 01:27:47 +08:00
imbytecat 4e2bc5b8dc chore(deps): 更新 bun lock 2026-03-22 00:39:25 +08:00
imbytecat 9da3df6ad7 chore: 升级 monorepo 依赖版本 2026-03-22 00:02:55 +08:00
imbytecat 9d8a38a4c4 fix: 修正 ORPC handler 语义、加固 Electron 安全、优化构建与运行时配置
- todo.router: create 错误码 NOT_FOUND → INTERNAL_SERVER_ERROR,remove 增加存在性检查
- __root: devtools 仅在 DEV 环境渲染
- Electron: 添加 will-navigate 导航拦截、显式安全 webPreferences、deny-all 权限请求
- sidecar: 空 catch 块补充意图注释,新增 lastResolvedUrl getter
- todo.contract: 硬编码 omit 改用 generatedFieldKeys
- router: QueryClient 添加 staleTime/retry 默认值
- turbo: build 任务精细化 inputs 提升缓存命中率
- fields: id() 改为模块私有
2026-03-05 14:06:43 +08:00
imbytecat cd7448c3b3 docs: 统一使用 bun run <script> 避免与 Bun 内置子命令冲突
bun build 会调用 Bun 内置 bundler 而非 package.json script,
将所有文档中的 bun <script> 改为 bun run <script> 以避免歧义。
bun test 保留不变(直接使用 Bun 内置 test runner)。
2026-03-05 12:57:26 +08:00
19 changed files with 435 additions and 425 deletions
+1
View File
@@ -43,6 +43,7 @@
"files.watcherExclude": { "files.watcherExclude": {
"**/routeTree.gen.ts": true "**/routeTree.gen.ts": true
}, },
"js/ts.tsdk.path": "node_modules/typescript/lib",
"search.exclude": { "search.exclude": {
"**/routeTree.gen.ts": true "**/routeTree.gen.ts": true
} }
+46 -47
View File
@@ -4,7 +4,7 @@ Guidelines for AI agents working in this Bun monorepo.
## Project Overview ## Project Overview
> **This project uses [Bun](https://bun.sh) exclusively as both the JavaScript runtime and package manager. Do NOT use Node.js / npm / yarn / pnpm. All commands start with `bun` — use `bun install` for dependencies and `bun run` / `bun <script>` for scripts. Never use `npm`, `npx`, or `node`.** > **This project uses [Bun](https://bun.sh) exclusively as both the JavaScript runtime and package manager. Do NOT use Node.js / npm / yarn / pnpm. All commands start with `bun` — use `bun install` for dependencies and `bun run <script>` for scripts. Always prefer `bun run <script>` over `bun <script>` to avoid conflicts with Bun built-in subcommands (e.g. `bun build` invokes Bun's bundler, NOT your package.json script). Never use `npm`, `npx`, or `node`.**
- **Monorepo**: Bun workspaces + Turborepo orchestration - **Monorepo**: Bun workspaces + Turborepo orchestration
- **Runtime**: Bun (see `mise.toml` for version) — **NOT Node.js** - **Runtime**: Bun (see `mise.toml` for version) — **NOT Node.js**
@@ -18,57 +18,57 @@ Guidelines for AI agents working in this Bun monorepo.
### Root Commands (via Turbo) ### Root Commands (via Turbo)
```bash ```bash
bun dev # Start all apps in dev mode bun run dev # Start all apps in dev mode
bun build # Build all apps bun run build # Build all apps
bun compile # Compile server to standalone binary (current platform) bun run compile # Compile server to standalone binary (current platform)
bun compile:darwin # Compile server for macOS (arm64 + x64) bun run compile:darwin # Compile server for macOS (arm64 + x64)
bun compile:linux # Compile server for Linux (x64 + arm64) bun run compile:linux # Compile server for Linux (x64 + arm64)
bun compile:windows # Compile server for Windows x64 bun run compile:windows # Compile server for Windows x64
bun dist # Package desktop distributable (current platform) bun run dist # Package desktop distributable (current platform)
bun dist:linux # Package desktop for Linux (x64 + arm64) bun run dist:linux # Package desktop for Linux (x64 + arm64)
bun dist:mac # Package desktop for macOS (arm64 + x64) bun run dist:mac # Package desktop for macOS (arm64 + x64)
bun dist:win # Package desktop for Windows x64 bun run dist:win # Package desktop for Windows x64
bun fix # Lint + format (Biome auto-fix) bun run fix # Lint + format (Biome auto-fix)
bun typecheck # TypeScript check across monorepo bun run typecheck # TypeScript check across monorepo
``` ```
### Server App (`apps/server`) ### Server App (`apps/server`)
```bash ```bash
bun dev # Vite dev server (localhost:3000) bun run dev # Vite dev server (localhost:3000)
bun build # Production build -> .output/ bun run build # Production build -> .output/
bun compile # Compile to standalone binary (current platform) bun run compile # Compile to standalone binary (current platform)
bun compile:darwin # Compile for macOS (arm64 + x64) bun run compile:darwin # Compile for macOS (arm64 + x64)
bun compile:darwin:arm64 # Compile for macOS arm64 bun run compile:darwin:arm64 # Compile for macOS arm64
bun compile:darwin:x64 # Compile for macOS x64 bun run compile:darwin:x64 # Compile for macOS x64
bun compile:linux # Compile for Linux (x64 + arm64) bun run compile:linux # Compile for Linux (x64 + arm64)
bun compile:linux:arm64 # Compile for Linux arm64 bun run compile:linux:arm64 # Compile for Linux arm64
bun compile:linux:x64 # Compile for Linux x64 bun run compile:linux:x64 # Compile for Linux x64
bun compile:windows # Compile for Windows (default: x64) bun run compile:windows # Compile for Windows (default: x64)
bun compile:windows:x64 # Compile for Windows x64 bun run compile:windows:x64 # Compile for Windows x64
bun fix # Biome auto-fix bun run fix # Biome auto-fix
bun typecheck # TypeScript check bun run typecheck # TypeScript check
# Database (Drizzle) # Database (Drizzle)
bun db:generate # Generate migrations from schema bun run db:generate # Generate migrations from schema
bun db:migrate # Run migrations bun run db:migrate # Run migrations
bun db:push # Push schema (dev only) bun run db:push # Push schema (dev only)
bun db:studio # Open Drizzle Studio bun run db:studio # Open Drizzle Studio
``` ```
### Desktop App (`apps/desktop`) ### Desktop App (`apps/desktop`)
```bash ```bash
bun dev # electron-vite dev mode (requires server dev running) bun run dev # electron-vite dev mode (requires server dev running)
bun build # electron-vite build (main + preload) bun run build # electron-vite build (main + preload)
bun dist # Build + package for current platform bun run dist # Build + package for current platform
bun dist:linux # Build + package for Linux (x64 + arm64) bun run dist:linux # Build + package for Linux (x64 + arm64)
bun dist:linux:x64 # Build + package for Linux x64 bun run dist:linux:x64 # Build + package for Linux x64
bun dist:linux:arm64 # Build + package for Linux arm64 bun run dist:linux:arm64 # Build + package for Linux arm64
bun dist:mac # Build + package for macOS (arm64 + x64) bun run dist:mac # Build + package for macOS (arm64 + x64)
bun dist:mac:arm64 # Build + package for macOS arm64 bun run dist:mac:arm64 # Build + package for macOS arm64
bun dist:mac:x64 # Build + package for macOS x64 bun run dist:mac:x64 # Build + package for macOS x64
bun dist:win # Build + package for Windows x64 bun run dist:win # Build + package for Windows x64
bun fix # Biome auto-fix bun run fix # Biome auto-fix
bun typecheck # TypeScript check bun run typecheck # TypeScript check
``` ```
### Testing ### Testing
@@ -113,7 +113,6 @@ import type { ReactNode } from 'react'
- Components: arrow functions (enforced by Biome) - Components: arrow functions (enforced by Biome)
- Routes: TanStack Router file conventions (`export const Route = createFileRoute(...)`) - Routes: TanStack Router file conventions (`export const Route = createFileRoute(...)`)
- Data fetching: `useSuspenseQuery(orpc.feature.list.queryOptions())` - Data fetching: `useSuspenseQuery(orpc.feature.list.queryOptions())`
- Let React Compiler handle memoization (no manual `useMemo`/`useCallback`)
### Error Handling ### Error Handling
- Use `try-catch` for async operations; throw descriptive errors - Use `try-catch` for async operations; throw descriptive errors
@@ -160,7 +159,7 @@ export const myTable = pgTable('my_table', {
## Critical Rules ## Critical Rules
**DO:** **DO:**
- Run `bun fix` before committing - Run `bun run fix` before committing
- Use `@/*` path aliases (not relative imports) - Use `@/*` path aliases (not relative imports)
- Include `createdAt`/`updatedAt` on all tables - Include `createdAt`/`updatedAt` on all tables
- Use `catalog:` for dependency versions - Use `catalog:` for dependency versions
@@ -178,9 +177,9 @@ export const myTable = pgTable('my_table', {
## Git Workflow ## Git Workflow
1. Make changes following style guide 1. Make changes following style guide
2. `bun fix` - auto-format and lint 2. `bun run fix` - auto-format and lint
3. `bun typecheck` - verify types 3. `bun run typecheck` - verify types
4. `bun dev` - test locally 4. `bun run dev` - test locally
5. Commit with descriptive message 5. Commit with descriptive message
## Directory Structure ## Directory Structure
+18 -18
View File
@@ -4,7 +4,7 @@ Thin Electron shell hosting the fullstack server app.
## Tech Stack ## Tech Stack
> **⚠️ This project uses Bun as the package manager. Runtime is Electron (Node.js). Never use `npm`, `npx`, `yarn`, or `pnpm`.** > **⚠️ This project uses Bun as the package manager. Runtime is Electron (Node.js). Always use `bun run <script>` (not `bun <script>`) to avoid conflicts with Bun built-in subcommands. Never use `npm`, `npx`, `yarn`, or `pnpm`.**
- **Type**: Electron desktop shell - **Type**: Electron desktop shell
- **Design**: Server-driven desktop (thin native window hosting web app) - **Design**: Server-driven desktop (thin native window hosting web app)
@@ -22,18 +22,18 @@ Thin Electron shell hosting the fullstack server app.
## Commands ## Commands
```bash ```bash
bun dev # electron-vite dev (requires server dev running) bun run dev # electron-vite dev (requires server dev running)
bun build # electron-vite build (main + preload) bun run build # electron-vite build (main + preload)
bun dist # Build + package for current platform bun run dist # Build + package for current platform
bun dist:linux # Build + package for Linux (x64 + arm64) bun run dist:linux # Build + package for Linux (x64 + arm64)
bun dist:linux:x64 # Build + package for Linux x64 bun run dist:linux:x64 # Build + package for Linux x64
bun dist:linux:arm64 # Build + package for Linux arm64 bun run dist:linux:arm64 # Build + package for Linux arm64
bun dist:mac # Build + package for macOS (arm64 + x64) bun run dist:mac # Build + package for macOS (arm64 + x64)
bun dist:mac:arm64 # Build + package for macOS arm64 bun run dist:mac:arm64 # Build + package for macOS arm64
bun dist:mac:x64 # Build + package for macOS x64 bun run dist:mac:x64 # Build + package for macOS x64
bun dist:win # Build + package for Windows x64 bun run dist:win # Build + package for Windows x64
bun fix # Biome auto-fix bun run fix # Biome auto-fix
bun typecheck # TypeScript check bun run typecheck # TypeScript check
``` ```
## Directory Structure ## Directory Structure
@@ -56,13 +56,13 @@ bun typecheck # TypeScript check
## Development Workflow ## Development Workflow
1. **Start server**: `bun dev` in `apps/server` (or use root `bun dev` via Turbo). 1. **Start server**: `bun run dev` in `apps/server` (or use root `bun run dev` via Turbo).
2. **Start desktop**: `bun dev` in `apps/desktop`. 2. **Start desktop**: `bun run dev` in `apps/desktop`.
3. **Connection**: Main process polls `localhost:3000` until responsive, then opens BrowserWindow. 3. **Connection**: Main process polls `localhost:3000` until responsive, then opens BrowserWindow.
## Production Build Workflow ## Production Build Workflow
From monorepo root, run `bun dist` to execute the full pipeline automatically (via Turbo task dependencies): From monorepo root, run `bun run dist` to execute the full pipeline automatically (via Turbo task dependencies):
1. **Build server**: `apps/server``vite build``.output/` 1. **Build server**: `apps/server``vite build``.output/`
2. **Compile server**: `apps/server``bun compile.ts --target ...``out/server-{os}-{arch}` 2. **Compile server**: `apps/server``bun compile.ts --target ...``out/server-{os}-{arch}`
@@ -70,8 +70,8 @@ From monorepo root, run `bun dist` to execute the full pipeline automatically (v
The `electron-builder.yml` `extraResources` config reads binaries directly from `../server/out/`, no manual copy needed. The `electron-builder.yml` `extraResources` config reads binaries directly from `../server/out/`, no manual copy needed.
To build for a specific platform explicitly, use `bun dist:linux` / `bun dist:mac` / `bun dist:win` in `apps/desktop`. To build for a specific platform explicitly, use `bun run dist:linux` / `bun run dist:mac` / `bun run dist:win` in `apps/desktop`.
For single-arch output, use `bun dist:linux:x64`, `bun dist:linux:arm64`, `bun dist:mac:x64`, or `bun dist:mac:arm64`. For single-arch output, use `bun run dist:linux:x64`, `bun run dist:linux:arm64`, `bun run dist:mac:x64`, or `bun run dist:mac:arm64`.
## Development Principles ## Development Principles
+25 -2
View File
@@ -1,5 +1,5 @@
import { join } from 'node:path' import { join } from 'node:path'
import { app, BrowserWindow, dialog, shell } from 'electron' import { app, BrowserWindow, dialog, session, shell } from 'electron'
import { createSidecarRuntime } from './sidecar' import { createSidecarRuntime } from './sidecar'
const DEV_SERVER_URL = 'http://localhost:3000' const DEV_SERVER_URL = 'http://localhost:3000'
@@ -61,6 +61,8 @@ const createWindow = async () => {
webPreferences: { webPreferences: {
preload: join(__dirname, '../preload/index.js'), preload: join(__dirname, '../preload/index.js'),
sandbox: true, sandbox: true,
contextIsolation: true,
nodeIntegration: false,
}, },
}) })
mainWindow = windowRef mainWindow = windowRef
@@ -78,6 +80,21 @@ const createWindow = async () => {
return { action: 'deny' } return { action: 'deny' }
}) })
windowRef.webContents.on('will-navigate', (event, url) => {
const allowed = [DEV_SERVER_URL, sidecar.lastResolvedUrl].filter((v): v is string => v != null)
const isAllowed = allowed.some((origin) => url.startsWith(origin))
if (!isAllowed) {
event.preventDefault()
if (canOpenExternally(url)) {
void shell.openExternal(url)
} else if (!app.isPackaged) {
console.warn(`Blocked navigation to: ${url}`)
}
}
})
windowRef.on('closed', () => { windowRef.on('closed', () => {
if (mainWindow === windowRef) { if (mainWindow === windowRef) {
mainWindow = null mainWindow = null
@@ -151,7 +168,13 @@ const handleWindowCreationError = (error: unknown, context: string) => {
app app
.whenReady() .whenReady()
.then(() => ensureWindow()) .then(() => {
session.defaultSession.setPermissionRequestHandler((_webContents, _permission, callback) => {
callback(false)
})
return ensureWindow()
})
.catch((error) => { .catch((error) => {
handleWindowCreationError(error, 'Failed to create window') handleWindowCreationError(error, 'Failed to create window')
}) })
+8 -1
View File
@@ -27,6 +27,7 @@ type SidecarRuntimeOptions = {
type SidecarRuntime = { type SidecarRuntime = {
resolveUrl: () => Promise<string> resolveUrl: () => Promise<string>
stop: () => void stop: () => void
lastResolvedUrl: string | null
} }
const sleep = (ms: number): Promise<void> => new Promise((resolve) => setTimeout(resolve, ms)) const sleep = (ms: number): Promise<void> => new Promise((resolve) => setTimeout(resolve, ms))
@@ -72,7 +73,9 @@ const isServerReady = async (url: string): Promise<boolean> => {
return true return true
} }
} catch {} } catch {
// Expected: probe request fails while server is still starting up
}
} }
return false return false
@@ -239,11 +242,15 @@ export const createSidecarRuntime = (options: SidecarRuntimeOptions): SidecarRun
throw new Error('Dev server not responding. Run `bun dev` in apps/server first.') throw new Error('Dev server not responding. Run `bun dev` in apps/server first.')
} }
state.url = options.devServerUrl
return options.devServerUrl return options.devServerUrl
} }
return { return {
resolveUrl, resolveUrl,
stop, stop,
get lastResolvedUrl() {
return state.url
},
} }
} }
+19 -20
View File
@@ -4,7 +4,7 @@ TanStack Start fullstack web app with ORPC (contract-first RPC).
## Tech Stack ## Tech Stack
> **⚠️ This project uses Bun — NOT Node.js / npm. All commands use `bun`. Never use `npm`, `npx`, or `node`.** > **⚠️ This project uses Bun — NOT Node.js / npm. All commands use `bun`. Always use `bun run <script>` (not `bun <script>`) to avoid conflicts with Bun built-in subcommands. Never use `npm`, `npx`, or `node`.**
- **Framework**: TanStack Start (React 19 SSR, file-based routing) - **Framework**: TanStack Start (React 19 SSR, file-based routing)
- **Runtime**: Bun — **NOT Node.js** - **Runtime**: Bun — **NOT Node.js**
@@ -20,29 +20,29 @@ TanStack Start fullstack web app with ORPC (contract-first RPC).
```bash ```bash
# Development # Development
bun dev # Vite dev server (localhost:3000) bun run dev # Vite dev server (localhost:3000)
bun db:studio # Drizzle Studio GUI bun run db:studio # Drizzle Studio GUI
# Build # Build
bun build # Production build → .output/ bun run build # Production build → .output/
bun compile # Compile to standalone binary (current platform, depends on build) bun run compile # Compile to standalone binary (current platform, depends on build)
bun compile:darwin # Compile for macOS (arm64 + x64) bun run compile:darwin # Compile for macOS (arm64 + x64)
bun compile:darwin:arm64 # Compile for macOS arm64 bun run compile:darwin:arm64 # Compile for macOS arm64
bun compile:darwin:x64 # Compile for macOS x64 bun run compile:darwin:x64 # Compile for macOS x64
bun compile:linux # Compile for Linux (x64 + arm64) bun run compile:linux # Compile for Linux (x64 + arm64)
bun compile:linux:arm64 # Compile for Linux arm64 bun run compile:linux:arm64 # Compile for Linux arm64
bun compile:linux:x64 # Compile for Linux x64 bun run compile:linux:x64 # Compile for Linux x64
bun compile:windows # Compile for Windows (default: x64) bun run compile:windows # Compile for Windows (default: x64)
bun compile:windows:x64 # Compile for Windows x64 bun run compile:windows:x64 # Compile for Windows x64
# Code Quality # Code Quality
bun fix # Biome auto-fix bun run fix # Biome auto-fix
bun typecheck # TypeScript check bun run typecheck # TypeScript check
# Database # Database
bun db:generate # Generate migrations from schema bun run db:generate # Generate migrations from schema
bun db:migrate # Run migrations bun run db:migrate # Run migrations
bun db:push # Push schema directly (dev only) bun run db:push # Push schema directly (dev only)
# Testing (not yet configured) # Testing (not yet configured)
bun test path/to/test.ts # Run single test bun test path/to/test.ts # Run single test
@@ -226,7 +226,6 @@ import type { ReactNode } from 'react'
### React ### React
- Use arrow functions for components (Biome enforced) - Use arrow functions for components (Biome enforced)
- Use `useSuspenseQuery` for guaranteed data - Use `useSuspenseQuery` for guaranteed data
- Let React Compiler handle memoization (no manual `useMemo`/`useCallback`)
## Environment Variables ## Environment Variables
@@ -257,7 +256,7 @@ export const env = createEnv({
## Critical Rules ## Critical Rules
**DO:** **DO:**
- Run `bun fix` before committing - Run `bun run fix` before committing
- Use `@/*` path aliases - Use `@/*` path aliases
- Include `createdAt`/`updatedAt` on all tables - Include `createdAt`/`updatedAt` on all tables
- Use `ORPCError` with proper codes - Use `ORPCError` with proper codes
+1 -3
View File
@@ -50,11 +50,9 @@
"@tanstack/react-router-devtools": "catalog:", "@tanstack/react-router-devtools": "catalog:",
"@types/bun": "catalog:", "@types/bun": "catalog:",
"@vitejs/plugin-react": "catalog:", "@vitejs/plugin-react": "catalog:",
"babel-plugin-react-compiler": "catalog:",
"drizzle-kit": "catalog:", "drizzle-kit": "catalog:",
"nitro": "catalog:", "nitro": "catalog:",
"tailwindcss": "catalog:", "tailwindcss": "catalog:",
"vite": "catalog:", "vite": "catalog:"
"vite-tsconfig-paths": "catalog:"
} }
} }
+8 -1
View File
@@ -5,7 +5,14 @@ import type { RouterContext } from './routes/__root'
import { routeTree } from './routeTree.gen' import { routeTree } from './routeTree.gen'
export const getRouter = () => { export const getRouter = () => {
const queryClient = new QueryClient() const queryClient = new QueryClient({
defaultOptions: {
queries: {
staleTime: 30 * 1000,
retry: 1,
},
},
})
const router = createRouter({ const router = createRouter({
routeTree, routeTree,
+2
View File
@@ -46,6 +46,7 @@ function RootDocument({ children }: Readonly<{ children: ReactNode }>) {
</head> </head>
<body> <body>
{children} {children}
{import.meta.env.DEV && (
<TanStackDevtools <TanStackDevtools
config={{ config={{
position: 'bottom-right', position: 'bottom-right',
@@ -61,6 +62,7 @@ function RootDocument({ children }: Readonly<{ children: ReactNode }>) {
}, },
]} ]}
/> />
)}
<Scripts /> <Scripts />
</body> </body>
</html> </html>
@@ -1,21 +1,14 @@
import { oc } from '@orpc/contract' import { oc } from '@orpc/contract'
import { createInsertSchema, createSelectSchema, createUpdateSchema } from 'drizzle-orm/zod' import { createInsertSchema, createSelectSchema, createUpdateSchema } from 'drizzle-orm/zod'
import { z } from 'zod' import { z } from 'zod'
import { generatedFieldKeys } from '@/server/db/fields'
import { todoTable } from '@/server/db/schema' import { todoTable } from '@/server/db/schema'
const selectSchema = createSelectSchema(todoTable) const selectSchema = createSelectSchema(todoTable)
const insertSchema = createInsertSchema(todoTable).omit({ const insertSchema = createInsertSchema(todoTable).omit(generatedFieldKeys)
id: true,
createdAt: true,
updatedAt: true,
})
const updateSchema = createUpdateSchema(todoTable).omit({ const updateSchema = createUpdateSchema(todoTable).omit(generatedFieldKeys)
id: true,
createdAt: true,
updatedAt: true,
})
export const list = oc.input(z.void()).output(z.array(selectSchema)) export const list = oc.input(z.void()).output(z.array(selectSchema))
@@ -15,7 +15,7 @@ export const create = os.todo.create.use(db).handler(async ({ context, input })
const [newTodo] = await context.db.insert(todoTable).values(input).returning() const [newTodo] = await context.db.insert(todoTable).values(input).returning()
if (!newTodo) { if (!newTodo) {
throw new ORPCError('NOT_FOUND') throw new ORPCError('INTERNAL_SERVER_ERROR', { message: 'Failed to create todo' })
} }
return newTodo return newTodo
@@ -32,5 +32,9 @@ export const update = os.todo.update.use(db).handler(async ({ context, input })
}) })
export const remove = os.todo.remove.use(db).handler(async ({ context, input }) => { export const remove = os.todo.remove.use(db).handler(async ({ context, input }) => {
await context.db.delete(todoTable).where(eq(todoTable.id, input.id)) const [deleted] = await context.db.delete(todoTable).where(eq(todoTable.id, input.id)).returning({ id: todoTable.id })
if (!deleted) {
throw new ORPCError('NOT_FOUND')
}
}) })
+1 -1
View File
@@ -4,7 +4,7 @@ import { v7 as uuidv7 } from 'uuid'
// id // id
export const id = (name: string) => uuid(name) const id = (name: string) => uuid(name)
export const pk = (name: string, strategy?: 'native' | 'extension') => { export const pk = (name: string, strategy?: 'native' | 'extension') => {
switch (strategy) { switch (strategy) {
// PG 18+ // PG 18+
-1
View File
@@ -1,7 +1,6 @@
{ {
"extends": "@furtherverse/tsconfig/react.json", "extends": "@furtherverse/tsconfig/react.json",
"compilerOptions": { "compilerOptions": {
"baseUrl": ".",
"paths": { "paths": {
"@/*": ["./src/*"] "@/*": ["./src/*"]
} }
+1
View File
@@ -4,6 +4,7 @@
"tasks": { "tasks": {
"build": { "build": {
"env": ["NODE_ENV", "VITE_*"], "env": ["NODE_ENV", "VITE_*"],
"inputs": ["src/**", "public/**", "package.json", "tsconfig.json", "vite.config.ts"],
"outputs": [".output/**"] "outputs": [".output/**"]
}, },
"compile": { "compile": {
+4 -7
View File
@@ -4,25 +4,22 @@ import { tanstackStart } from '@tanstack/react-start/plugin/vite'
import react from '@vitejs/plugin-react' import react from '@vitejs/plugin-react'
import { nitro } from 'nitro/vite' import { nitro } from 'nitro/vite'
import { defineConfig } from 'vite' import { defineConfig } from 'vite'
import tsconfigPaths from 'vite-tsconfig-paths'
export default defineConfig({ export default defineConfig({
clearScreen: false, clearScreen: false,
plugins: [ plugins: [
tanstackDevtools(), tanstackDevtools(),
tailwindcss(), tailwindcss(),
tsconfigPaths(),
tanstackStart(), tanstackStart(),
react({ react(),
babel: {
plugins: ['babel-plugin-react-compiler'],
},
}),
nitro({ nitro({
preset: 'bun', preset: 'bun',
serveStatic: 'inline', serveStatic: 'inline',
}), }),
], ],
resolve: {
tsconfigPaths: true,
},
server: { server: {
port: 3000, port: 3000,
strictPort: true, strictPort: true,
+245 -260
View File
File diff suppressed because it is too large Load Diff
+26 -28
View File
@@ -22,46 +22,44 @@
"typecheck": "turbo run typecheck" "typecheck": "turbo run typecheck"
}, },
"devDependencies": { "devDependencies": {
"@biomejs/biome": "^2.4.5", "@biomejs/biome": "^2.4.9",
"turbo": "^2.8.13", "turbo": "^2.8.20",
"typescript": "^5.9.3" "typescript": "^6.0.2"
}, },
"catalog": { "catalog": {
"@orpc/client": "^1.13.6", "@orpc/client": "^1.13.11",
"@orpc/contract": "^1.13.6", "@orpc/contract": "^1.13.11",
"@orpc/openapi": "^1.13.6", "@orpc/openapi": "^1.13.11",
"@orpc/server": "^1.13.6", "@orpc/server": "^1.13.11",
"@orpc/tanstack-query": "^1.13.6", "@orpc/tanstack-query": "^1.13.11",
"@orpc/zod": "^1.13.6", "@orpc/zod": "^1.13.11",
"@t3-oss/env-core": "^0.13.10", "@t3-oss/env-core": "^0.13.11",
"@tailwindcss/vite": "^4.2.1", "@tailwindcss/vite": "^4.2.2",
"@tanstack/devtools-vite": "^0.5.3", "@tanstack/devtools-vite": "^0.6.0",
"@tanstack/react-devtools": "^0.9.9", "@tanstack/react-devtools": "^0.10.0",
"@tanstack/react-query": "^5.90.21", "@tanstack/react-query": "^5.95.2",
"@tanstack/react-query-devtools": "^5.91.3", "@tanstack/react-query-devtools": "^5.95.2",
"@tanstack/react-router": "^1.166.2", "@tanstack/react-router": "^1.168.3",
"@tanstack/react-router-devtools": "^1.166.2", "@tanstack/react-router-devtools": "^1.166.11",
"@tanstack/react-router-ssr-query": "^1.166.2", "@tanstack/react-router-ssr-query": "^1.166.10",
"@tanstack/react-start": "^1.166.2", "@tanstack/react-start": "^1.167.6",
"@types/bun": "^1.3.10", "@types/bun": "^1.3.11",
"@types/node": "^24.11.0", "@types/node": "^24.12.0",
"@vitejs/plugin-react": "^5.1.4", "@vitejs/plugin-react": "^6.0.1",
"babel-plugin-react-compiler": "^1.0.0",
"drizzle-kit": "1.0.0-beta.15-859cf75", "drizzle-kit": "1.0.0-beta.15-859cf75",
"drizzle-orm": "1.0.0-beta.15-859cf75", "drizzle-orm": "1.0.0-beta.15-859cf75",
"electron": "^34.0.0", "electron": "^34.0.0",
"electron-builder": "^26.8.1", "electron-builder": "^26.8.1",
"electron-vite": "^5.0.0", "electron-vite": "^5.0.0",
"motion": "^12.35.0", "motion": "^12.38.0",
"nitro": "npm:nitro-nightly@3.0.1-20260227-181935-bfbb207c", "nitro": "npm:nitro-nightly@3.0.1-20260324-103046-9ce219ca",
"postgres": "^3.4.8", "postgres": "^3.4.8",
"react": "^19.2.4", "react": "^19.2.4",
"react-dom": "^19.2.4", "react-dom": "^19.2.4",
"tailwindcss": "^4.2.1", "tailwindcss": "^4.2.2",
"tree-kill": "^1.2.2", "tree-kill": "^1.2.2",
"uuid": "^13.0.0", "uuid": "^13.0.0",
"vite": "^8.0.0-beta.16", "vite": "^8.0.2",
"vite-tsconfig-paths": "^6.1.1",
"zod": "^4.3.6" "zod": "^4.3.6"
}, },
"overrides": { "overrides": {
+3 -1
View File
@@ -20,7 +20,9 @@
"noFallthroughCasesInSwitch": true, "noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true, "noUncheckedSideEffectImports": true,
"noUncheckedIndexedAccess": true, "noUncheckedIndexedAccess": true,
"noImplicitOverride": true "noImplicitOverride": true,
"types": ["bun"]
}, },
"exclude": ["node_modules"] "exclude": ["node_modules"]
} }
+1 -6
View File
@@ -14,12 +14,7 @@
"cache": false "cache": false
}, },
"typecheck": { "typecheck": {
"inputs": [ "inputs": ["package.json", "tsconfig.json", "tsconfig.*.json", "**/*.{ts,tsx,d.ts}"],
"package.json",
"tsconfig.json",
"tsconfig.*.json",
"**/*.{ts,tsx,d.ts}"
],
"outputs": [] "outputs": []
} }
}, },