Skip to content

Conversation

@yamcodes
Copy link
Owner

@yamcodes yamcodes commented Jan 17, 2026

Description

Migrate from TypeBox to ArkType, TypeScript's 1:1 validator.


PR Checklist

  • Read the Developer's Guide in CONTRIBUTING.md
  • Use a concise title to represent the changes introduced in this PR
  • Provide a detailed description of the changes introduced in this PR, and, if necessary, some screenshots
  • Reference an issue or discussion where the feature or changes have been previously discussed
  • Add a failing test that passes with the changes introduced in this PR, or explain why it's not feasible
  • Add documentation for the feature or changes introduced in this PR to the docs; you can run them with bun docs

Summary by CodeRabbit

  • New Features

    • Switched project validation/type system to ArkType, updating runtime/type exports.
  • Bug Fixes

    • Improved validation error formatting and path/message handling for clearer, more robust errors.
  • Documentation

    • Updated Bun links to bun.com; added ArkType and Biome to docs, badges, and setup guidance; refreshed overview and getting-started content.
  • Chores

    • Updated dependencies to add ArkType/arkregex and remove legacy validator; minor package description tweak.

✏️ Tip: You can customize this high-level summary in your review settings.

@yamcodes yamcodes linked an issue Jan 17, 2026 that may be closed by this pull request
3 tasks
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 17, 2026

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

📥 Commits

Reviewing files that changed from the base of the PR and between 705c24a and cf3e03e.

📒 Files selected for processing (1)
  • apps/www/what-is-bedstack.md
 ________________________
< Tree-sitter is my GPS. >
 ------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).

✏️ Tip: You can disable in-progress messages and the fortune message in your review settings.

📝 Walkthrough

Walkthrough

Migrates project DTOs and route schemas from Elysia/TypeBox (t) to ArkType (type), updates imports and exported type aliases to .infer, modifies validation error formatting, adds arktype/arkregex deps, and updates documentation and Bun URLs.

Changes

Cohort / File(s) Summary
Documentation & URLs
CONTRIBUTING.md, README.md, apps/www/getting-started.md, apps/www/index.md, apps/www/what-is-bedstack.md
Updated Bun URLs (bun.shbun.com); added ArkType/ArkType extension and Biome mentions; badge and copy adjustments.
Project Manifests
package.json, apps/conduit/package.json
Removed @sinclair/typebox and overrides; added arktype and arkregex; updated package description.
Global App Module
apps/conduit/src/app.module.ts
Comment updated to reference ArkType-based validation error type (no logic change).
Error Handling Utility
apps/conduit/src/shared/errors/errors.utils.ts
Reworked formatValidationError: robust path handling (array/string), prioritized message extraction, safer per-path initialization and deduplication.
Articles DTOs & Controller
apps/conduit/src/articles/dto/*.ts, apps/conduit/src/articles/articles.controller.ts
Replaced t.Object/TypeBox schemas with ArkType type(...) schemas; changed exported types to typeof X.infer; adjusted some response schemas (e.g., no-content → type('undefined')).
Comments DTOs & Controller
apps/conduit/src/comments/dto/*.ts, apps/conduit/src/comments/comments.controller.ts
Migrated comment DTOs to ArkType type(...); updated route param schemas (e.g., id parsing) and response shapes; switched to .infer.
Profiles DTO
apps/conduit/src/profiles/dto/profile-response.dto.ts
Switched from t.Object to ArkType type(...); optional fields expressed with ?; export alias now infer.
Tags DTO
apps/conduit/src/tags/dto/tags-response.dto.ts
Converted t.Array(t.String())type({ tags: 'string[]' }) and updated export alias to infer.
Users DTOs
apps/conduit/src/users/dto/*.ts
Replaced user DTOs with ArkType type(...); introduced arkregex usage for password/username constraints; export alias changes to infer.
Other DTOs (queries/updates)
apps/conduit/src/articles/dto/*.ts, apps/conduit/src/users/dto/*.ts, ...
Consolidated various query and payload DTOs to ArkType patterns (merge/get/partial/omit/array) and updated type inference to .infer.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • Elysia.t #184 — Modifies many of the same DTO/schema files and type-extraction patterns; strong overlap with this ArkType migration.

Suggested labels

refactor

Suggested reviewers

  • aruaycodes

Poem

🐰 I hopped from t to type beneath the moon,
Schemas snug in pockets, regex hums a tune,
Docs polished bright, Bun’s link led the way,
ArkType and carrots cheer the devs today — hooray! 🥕✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and accurately summarizes the main objective of the PR: adopting ArkType as a core technology throughout the codebase, replacing TypeBox. It is concise, clear, and specific.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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 and usage tips.

@yamcodes yamcodes changed the title 211 migrate away from typebox Adapt ArkType as a core technology Jan 17, 2026
@yamcodes yamcodes marked this pull request as ready for review January 17, 2026 16:16
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🤖 Fix all issues with AI agents
In `@apps/conduit/package.json`:
- Around line 40-41: The dependency "arkregex"@^0.0.5 in package.json is a
pre-stable 0.0.x release and poses risk for production; either remove it if
unused, replace it with a more mature alternative, or at minimum pin to an exact
tested version (change "arkregex": "^0.0.5" to "arkregex": "0.0.5") and document
the rationale; ensure tests still pass and keep "arktype": "^2.1.29" unchanged
if you rely on it.

In `@apps/conduit/src/comments/comments.controller.ts`:
- Line 36: Update the 401 response schema for StatusCodes.UNAUTHORIZED in
comments.controller.ts to match the structured error payload emitted by
requireLogin and shaped by the global error handler (an object with an "errors"
property whose value is a map of string keys to string[]), instead of
type('undefined'); change the schema referenced at the StatusCodes.UNAUTHORIZED
entry so it describes { errors: Record<string, string[]> } (i.e., an object with
an "errors" field containing arrays of error strings) so the OpenAPI/response
spec matches RealWorldError from requireLogin and app.module.ts.
- Line 74: Remove the redundant Number() conversion around params.id in the
comments controller where you call the handler (e.g., inside the method that
currently does Number(params.id)); ArkType's string.numeric.parse already morphs
params.id to a number when Elysia validates, so pass params.id directly to the
function (reference params.id and the handler method in comments.controller.ts)
and delete the Number(...) wrapper to avoid double coercion.

In `@apps/conduit/src/shared/errors/errors.utils.ts`:
- Around line 42-78: The code currently computes a path variable (using err.path
handling and parsePath) but then uses if (path) which drops empty strings (e.g.,
when err.path is [] or parsePath yields ""), losing root-level errors; after
computing path (and after the Array.isArray / parsePath branches) normalize any
empty string or sole "/" back to "general" before using it to index result so
messages are never dropped—update the logic around the path variable in the
function (where parsePath is called and result[path] is looked up) to set path =
'general' if path === '' || path === '/' or otherwise falsy before pushing
message.

In `@apps/conduit/src/users/dto/user-response.dto.ts`:
- Around line 3-10: Update the ArkType schema in UserResponseDto to mark bio and
image as required (remove the '?' suffix) so they read 'bio': 'string | null'
and 'image': 'string | null'; this aligns the type with the response mapper and
DB NOT NULL defaults and ensures TypeScript infers these fields as always
present.

In `@apps/www/what-is-bedstack.md`:
- Line 17: Update the compound adjective in the Drizzle description: change "non
lactose" to "non-lactose" in the line containing
"**[Drizzle](https://orm.drizzle.team/)** - Lightweight, performant, typesafe,
non lactose, gluten-free, flexible, serverless-ready, and headless TypeScript
ORM" so the phrase reads "non-lactose".

yamcodes and others added 2 commits January 17, 2026 22:56
…se schemas, pin `arkregex` dependency, and correct a documentation typo.
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@apps/www/what-is-bedstack.md`:
- Line 21: The current phrasing for ArkType ("The first and only runtime
validator ...") is overstated; edit the line mentioning ArkType to remove "first
and only" and use a neutral, accurate descriptor such as "a leading TypeScript
validator" or "a runtime validator that can 1:1 match TypeScript types," e.g.,
update the sentence referencing ArkType to soften the claim while preserving the
point about 1:1 type alignment; ensure the symbol "ArkType" and its descriptive
clause are the parts you change.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@apps/www/what-is-bedstack.md`:
- Around line 44-46: Replace the definitive marketing phrase "best-in-class type
inference" in the paragraph about ArkType with a softer, factual wording;
specifically edit the sentence that currently reads "ArkType was chosen because
it offers best-in-class type inference and makes the correct choice the easiest
choice" to something like "ArkType offers excellent type inference and makes the
correct choice the easiest choice" (or similar wording that removes the absolute
"best-in-class" claim while keeping the recommendation and rationale intact).

Repository owner deleted a comment Jan 17, 2026
@yamcodes yamcodes merged commit d1f9421 into main Jan 17, 2026
7 checks passed
@yamcodes yamcodes deleted the 211-migrate-away-from-typebox branch January 17, 2026 18:45
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.

Migrate away from TypeBox

2 participants