Skip to content

fix(monorepo): modern monorepo architecture, eliminate shallow trpc wrapper & fix CLI publish - #7

Open
KitsuneKode wants to merge 1 commit into
mainfrom
fix/monorepo-audit-fixes
Open

KitsuneKode wants to merge 1 commit into
mainfrom
fix/monorepo-audit-fixes

Conversation

@KitsuneKode

Copy link
Copy Markdown
Owner

Summary of Architectural Improvements

This PR addresses all 14 findings from our Principal Engineer monorepo audit, restoring clean package boundaries, fixing publish-breaking issues in the CLI, and streamlining the Turborepo CI pipeline.


1. Architectural Cleanup & Inversion Fix

  • Eliminated packages/trpc: Removed the zero-value shallow wrapper package and inverted dependency (packages/trpc was depending on apps/server).
  • Direct Server Contract: apps/web, apps/worker, and integration tests now consume typed contracts directly from @arche-template/server/trpc (AppRouter, createCaller, RouterInputs, RouterOutputs).
  • Updated CLI Generators & Templates: Fullstack scaffolds and presets now use direct server contract imports instead of shipping an extraneous packages/trpc.

2. Workspace Graph & Tooling Fixes

  • Fixed Workspace Glob: Corrected root package.json workspaces from "tests/*" to "tests", bringing @arche-template/tests into the workspace dependency graph.
  • Removed Dead Code & Config: Deleted unused apps/server/env.ts and empty .npmrc.
  • Repo Tooling Robustness: toolings/scripts/repo-doctor.ts, sync-template-agents.ts, and sync-web-core.ts now resolve repo root relative to module location rather than relying on variable runtime process.cwd().

3. CLI Publishing Readiness

  • Fixed Template Path Resolution: Updated apps/cli/src/lib/web-core.ts with a fallback to find template directories both during local development and inside compiled dist/ bundles.
  • Dependency Scoping: Moved bundled CLI dependencies (@arche-template/registry, zod) from dependencies to devDependencies so npm consumers don't encounter unresolvable workspace:* or catalog: versions.
  • Package Dry Run: Swapped npm pack for bun pm pack in CLI packaging scripts.
  • CLI Test Scope: Scoped CLI test runner to apps/cli/tests to prevent executing embedded template stubs.

4. Environment Validation & Reliability

  • Store Production Guard: Updated packages/store/src/index.ts to strictly require DATABASE_URL in production while safely allowing standard local dev fallbacks.
  • Client Env Dev Defaults: Added sensible local defaults and VERCEL skip-validation support in packages/common/src/env/client.ts and apps/web/env.ts.

5. Turborepo & CI Consolidation

  • Streaming UI: Switched turbo.json UI mode to "stream" to prevent TUI SIGSEGV crashes in headless/CI environments.
  • CI Pipeline Tasks: Added test and db:studio tasks to Turborepo.
  • Unified CI Pipeline: bun run ci orchestrates format:check, lint, check-types, test, build, pkg:check, and repo:doctor:strict.

Verification

  • bun run format:check -> All files formatted
  • bun run lint -> 0 errors across all 14 workspaces
  • bun run check-types -> 12/12 type check tasks passed
  • bun test -> 560+ unit, integration, and scaffold tests passed
  • bun run build -> Next.js, Express, Worker, and CLI bundles built successfully
  • bun run pkg:check -> @kitsunekode/arche tarball generated cleanly with 466 files
  • bun run repo:doctor:strict -> 0 errors, 0 warnings

Eliminate shallow @arche-template/trpc package and export tRPC contract
directly from @arche-template/server/trpc.

Fix workspace glob 'tests/*' to 'tests' in root package.json so
@arche-template/tests is included in the workspace graph.

Fix CLI template path resolution in web-core.ts after bun build.

Move bundled CLI dependencies (@arche-template/registry, zod) to
devDependencies for npm publish readiness.

Switch CLI package dry-run script from npm pack to bun pm pack.

Enforce strict DATABASE_URL requirement in production for packages/store.

Add sensible defaults and Vercel skipValidation to clientEnv.

Consolidate turbo CI pipeline with streaming UI and root tasks.

Remove dead apps/server/env.ts and empty .npmrc.

Update documentation and template generators for direct tRPC exports.
@vercel

vercel Bot commented Aug 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
arche-landing Ready Ready Preview Aug 24, 2026 8:51am
arche-template-server Ready Ready Preview Aug 24, 2026 8:51am

@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b34cda51-5c52-498a-8a84-a8ab51b39254


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant