[API reference](https://evolu.dev/docs/api-reference) › [@evolu/common](https://evolu.dev/docs/api-reference/common) › [Type](https://evolu.dev/docs/api-reference/common/Type) › startsWith

```ts
function startsWith<Prefix>(
  prefix: Prefix & ValidateLiteral<Prefix>,
): BrandFactory<`StartsWith${Prefix}`, string, StartsWithError<Prefix>>;
```

Defined in: [packages/common/src/Type.ts:6634](https://github.com/evoluhq/evolu/blob/dd96d79f1dbe9a49fa12ce8e0aa7d3d0177795ca/packages/common/src/Type.ts#L6634)

String [Brand](https://evolu.dev/docs/api-reference/common/Brand/interfaces/Brand) requiring an exact, case-sensitive prefix.

Validation preserves the complete string, including the prefix. An empty
prefix accepts every string allowed by the parent Type. The prefix must be
one concrete string literal so different prefixes have distinct brands.

### Example

```ts
import {
  assertEqual,
  assertErr,
  assertOk,
  assertType,
  maxLength,
  startsWith,
  String,
  type Brand,
} from "@evolu/common";

const EnvName = startsWith("APP_")(maxLength(64)(String));

const name = EnvName.fromUnknown("APP_PORT");
assertOk(name, "APP_PORT");
assertType<
  typeof name.value,
  string & Brand<"MaxLength64"> & Brand<"StartsWithAPP_">
>();

assertEqual(EnvName.to(name.value), "APP_PORT");

assertErr(EnvName.fromUnknown("app_PORT"));
assertErr(EnvName.fromUnknown("APP_" + "X".repeat(61)));
```