Skip to main content

Validation Rules

All input validation runs server-side in apps/backend/validators/ before any database or manager call. Errors are thrown as UserInputError with translated messages via the translation service.

User fields

FieldRule
username3–50 chars, regex /^[a-zA-Z0-9_-]+$/
emailStandard email regex, max 255 chars
password8–128 chars, must contain uppercase, lowercase, digit, and one of @$!%*?&
bioOptional, max 100 chars
dateOfBirthMin age 13, max age 120
gendermale / female / other / prefer_not_to_say
accountTypepersonal / creator / business
phone7–15 digits (E.164 format, strips spaces/dashes/parentheses)
countryCode+ followed by 1–3 digits
otp4–6 digits

Post fields

FieldRule
textMax 5,000 chars; required unless media is present
visibilitypublic (default) / followers / private / subscribers
limit (pagination)1–100, default 20
offset (pagination)≥ 0, default 0

Comment fields

FieldRule
textMax 2,000 chars
limit1–100, default 20

Message fields

FieldRule
messageTextMax 10,000 chars
messageTypetext (default) / image / video / audio / file / voice / gif / sticker / location / poll / coin_transfer
coinPrice≥ 0; only allowed on image or video messages
limit1–100, default 50
before (cursor)Timestamp-based cursor for keyset pagination

Hashtag fields

FieldRule
nameMax 100 chars, alphanumeric + underscores only, lowercased, leading # stripped

Live stream fields

FieldRule
title3–255 chars
descriptionOptional, max 5,000 chars
visibilitypublic (default) / private / followers_only / close_friends
scheduledStartTimeMust be a future date
commentTextMax 500 chars
interactionTypelike / love / wow / haha / sad / angry
status (update)scheduled / live / ended / cancelled

Coin package fields

FieldRule
name3–100 chars
coinAmountInteger, 1–1,000,000
bonusCoinsInteger, ≥ 0, max 1,000,000
priceFloat, > 0, max $10,000, max 2 decimal places
currencyUSD / EUR / GBP / JPY / MXN (defaults to USD)

Subscription tier fields

FieldRule
name1–100 chars
descriptionOptional, max 500 chars
coinPriceInteger, 0–1,000,000; null = free tier
benefitsArray of strings

Content report fields

FieldAllowed values
contentTypepost / comment / message / user
reasonspam / nudity / hate_speech / violence / harassment / false_information / scam / intellectual_property / self_harm / terrorism / other
detailsOptional, max 1,000 chars
status (lifecycle)pendingreviewingresolved / dismissed

Error format

Validation errors are returned as GraphQL UserInputError with a message string. All messages are internationalized via the translation service and respect the user's locale in the GraphQL context.