Urgent.News

What's breaking now, across hundreds of outlets.

Tech

The `template` Data Type in ThingsDB

ThingsDB has long supported template strings using backtick syntax ( `Hello {name}!` ). While convenient for inline string interpolation, template strings are evaluated immediately at runtime, which means you couldn't store them in a collection, attach them to a typed model, or render them repeatedly across different contexts without manual string building. With the addition of the new template…

The `template` data type in ThingsDB is a recent addition that provides first-class support for template strings. These templates can be validated, stored, and rendered efficiently. To create a template, the `template()` function is used, which parses and validates the template syntax immediately upon creation, catching errors like unclosed braces or invalid expressions upfront.

The rendered template can then be generated on demand using the `.render()` method, which accepts any thing whose properties are valid variable names, including plain objects or typed instances. This integration with ThingsDB's type system allows for automatic conversion and validation of plain strings into templates when defining custom types.

The `template` type also comes with built-in helper functions such as `is_template()`, `template.len()`, and `str(tpl)`, providing additional functionality for working with templates. Safety features include up-front syntax validation, recursion protection, and context validation to prevent malformed or unsafe templates from being executed.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

Report a problem with this story

More in Tech

Handle API errors by code, not by message

The first version of most API integrations handles errors by reading the message: if (body.error.includes('character limit')) . It works until someone rewords the message.

  • API errors handled by stable codes, not changing messages
  • Error codes appear in five locations: top-level, validation, warnings, media results, issues
  • Three handling categories: fix-input, retry, and reread-then-retry

Next.js Protected Routes: Why a Session Cookie Check in proxy.ts Isn't Enough

I asked an AI assistant for a simple thing: a team dashboard in a Next.js 16 app (Better Auth + Drizzle + Postgres), visible only to signed-in users. It looked done.

  • Proxy.ts checks session cookie presence but doesn't verify authenticity
  • Fake cookie allows access to dashboard with user data
  • Implement session check closer to data access layer for security

A first-year SaaS discount is a price increase with a delayed invoice

A 50% off first year looks generous at checkout. On a $240 annual plan sold at $120, the customer has agreed to a $120 jump at renewal, often billed automatically.

  • First-year SaaS discount appears as price increase with delayed invoice
  • 80 customers buying discounted annual plan generate $9,600 in year-one cash
  • Additional 80 customers needed to offset discount and marketing costs

Reading the DOBI snapshot: device identity, demo fleets, and x402 payments

DOBI is positioning itself as an agent-native IoT platform: device identity, fleet telemetry, configurable automation, and optional pay-per-use via x402.

  • DOBI focuses on device identity, fleet telemetry, and x402 payments
  • Device identity is root, payments are leaf in platform structure
  • ESP32 reference path for device onboarding with device ID and key

More from Monday, 30 November 2026 →