nenu-lang / built-in-types
Partial

Built-In Types

  • Nenu defines six intrinsic type keywords: string, number, bool, time, image, and file.
  • App Marché supplies runtime contracts such as Request, Response, and the platform-owned User type.
  • Applications consume platform-owned types but never redeclare them or guess their undocumented fields.

Intrinsic Type Keywords

TypeRepresentsRoom example
stringText."Internet"
numberInteger or decimal numeric values.72.50
boolExactly true or false.false
timeA timestamp value.expense.createdAt
imageImage metadata.A receipt photo.
fileGeneric file metadata.An attached invoice.

Built-In Values And Functions

code
1time current = time.now()2string generated_id = nanoid()3string short_id = nanoid(12)
Built-inResultRule
time.now()timeReturns the current timestamp and accepts no arguments.
nanoid()stringGenerates a unique identifier with the default length.
nanoid(length)stringGenerates a unique identifier using a numeric length.

time.now() and nanoid are available in full/backend Nenu and Page Script. Current-user identity is supplied through an explicit platform contract; do not invent a bare uid binding or treat it as a replacement for the platform-owned User type.

Image And File Metadata

code
1type ExpenseReceipt {2  photo: image?3  invoice: file?4}56with receipt.photo as photo {7  photo_url = photo.url8  photo_width = photo.width9}1011with receipt.invoice as invoice {12  invoice_name = invoice.name13  invoice_size = invoice.size14}
TypeFields
imageurl: string, name: string, size: number, width: number, height: number
fileurl: string, name: string, size: number

The Platform-Provided User Type

User represents a person supplied by the platform. Application entities may reference it, runnable inputs may resolve it, and examples may pass it through typed fields. Application source must not redeclare that platform type.

code
1entity Expense {2  room_id: string @index3  payer: User4  title: string5  amount: number6  note: string?7  receipt: image?8  status: ExpenseStatus9}

Request And Response

An API runnable is an implicit typed function. App Marché metadata supplies its Request input and Response output. Source reads request.field and returns Response { ... }; it must not declare either contract as a source type.

code
1amount = request.amount2return Response { amount }

Managed Entity Fields

App Marché entity records receive managed identity and time fields. Treat id, createdAt, and updatedAt as generated fields; do not redeclare them in an application entity body.

FieldTypeOwner
idstringGenerated entity identity.
createdAttimeGenerated creation time.
updatedAttimeGenerated last-update time.

Common Mistakes

MistakeCorrection
Redeclare a platform typeConsume the type supplied by the active contract.
Guess fields on UserUse only the published platform contract.
Declare Request or Response in runnable sourceDefine those contracts in runnable metadata.
Treat image or file as a URL stringUse the documented media metadata fields.

Continue Learning