# Source mapping

URL: /code/project-structure/source-mapping · Id: `convention:source-mapping`

> A Source mapping translates one Source's records into the Startup's Nouns, field by field.

A [Source](/business/nouns/source) mapping translates one Source's records into the [Startup](/business/nouns/startup)'s [Nouns](/business/nouns/noun), field by field.

| Property | Value |
| --- | --- |
| Path | `mappings/[source].ts` |
| Holds | [Source](/business/nouns/source) |
| Kind | file |
| Leaders | db-first, git-first |
| Team | [Engineering Team](/agents/engineering) |
| Written by | [Change.merge](/business/nouns/change/merge) |
| Compiled by | [SoftwareBuilder](/code/builders/software) |

### Example
`mappings/bank-statement.ts` in a Startup repository.

```ts title="mappings/bank-statement.ts"
import { mapping } from 'startup-builder'

export default mapping({
  from: 'csv',
  to: 'Transaction',
  fields: {
    occurredAt: 'Date',
    description: 'Description',
    amount: (row) => ({ amount: Number(row['Amount']), currency: 'USD' }),
  },
})
```

### Exports
| Export | Kind | Type |
| --- | --- | --- |
| `default` | default | `Mapping` |

### Signature
```ts
mapping(definition: { from: string; to: string; fields: Record<string, string | ((row: Row) => unknown)> }): Mapping
```

### Generates
[SoftwareBuilder](/code/builders/software) compiles it into these records, Verbs and routes.

| Kind | What |
| --- | --- |
| Records | [Mapping](/business/nouns/mapping), [Source](/business/nouns/source) |
| Verbs | None. |
| Routes | None. |