···11+++
22-title = "Prelude"
22+title = "Standard Library"
33weight = 9
44+++
55+66+MLF ships with a standard library that includes commonly used types for working with the AT Protocol. The standard library consists of:
77+88+1. **The Prelude** - Format types auto-imported into every file
99+2. **ATProto Types** - The full `com.atproto.*` namespace available for import
1010+1111+## The Prelude
512613The prelude is a set of definitions automatically available in every MLF file. You don't need to import them - they're always there.
714···61686269When you use `Datetime` in your record, it expands to `string` with `format: "datetime"`.
63706464-## Future: ATProto Types
7171+## ATProto Standard Types
65726666-In the future, the prelude will also include all `com.atproto.*` definitions:
7373+The standard library includes all `com.atproto.*` types, which you can reference using fully qualified names or imports:
67746875```mlf
6969-// Eventually, these will be in the prelude
7676+// Use fully qualified names
7777+record myPost {
7878+ reference: com.atproto.repo.strongRef,
7979+ labels: [com.atproto.label.label],
8080+}
8181+8282+// Or import them
8383+use com.atproto.repo.strongRef;
8484+use com.atproto.label.label;
8585+7086record myPost {
7171- // Reference standard ATProto types without importing
7272- repo: com.atproto.sync.repo,
7373- commit: com.atproto.sync.commit,
8787+ reference: strongRef,
8888+ labels: [label],
7489}
7590```
76917777-This will make it easier to reference standard ATProto types without manual imports.
9292+### Available ATProto Namespaces
9393+9494+The standard library includes:
9595+- `com.atproto.admin.*` - Administration and moderation types
9696+- `com.atproto.identity.*` - Identity resolution types
9797+- `com.atproto.label.*` - Content labeling types
9898+- `com.atproto.lexicon.*` - Lexicon schema types
9999+- `com.atproto.moderation.*` - Moderation action types
100100+- `com.atproto.repo.*` - Repository and record types
101101+- `com.atproto.server.*` - Server configuration types
102102+- `com.atproto.sync.*` - Synchronization types
103103+104104+### Common ATProto Types
105105+106106+Here are some frequently used ATProto types:
107107+108108+**`com.atproto.repo.strongRef`** - A URI with a content-hash fingerprint:
109109+```mlf
110110+record post {
111111+ replyTo?: com.atproto.repo.strongRef,
112112+}
113113+```
114114+115115+**`com.atproto.label.label`** - Content labels for moderation:
116116+```mlf
117117+record post {
118118+ labels: [com.atproto.label.label],
119119+}
120120+```
121121+122122+**`com.atproto.server.inviteCode`** - Server invite codes:
123123+```mlf
124124+record account {
125125+ invitedBy?: com.atproto.server.inviteCode,
126126+}
127127+```
7812879129## Using Prelude Types
80130···186236187237## Summary
188238189189-The prelude provides:
190190-- ✅ String format types for common patterns
191191-- ✅ No imports needed - always available
192192-- ✅ Eventually will include all `com.atproto.*` types
239239+The standard library provides:
240240+- ✅ **Prelude types** - String format types auto-imported into every file
241241+- ✅ **ATProto types** - Full `com.atproto.*` namespace available via imports or fully qualified names
242242+- ✅ No manual downloads or setup needed - ships with MLF
193243194194-You've now learned all the core features of MLF! You can define records, add constraints, create custom types, use unions and tokens, define XRPC operations, import from other files, and use prelude types.
244244+You've now learned all the core features of MLF! You can define records, add constraints, create custom types, use unions and tokens, define XRPC operations, import from other files, and use standard library types.
195245196246## What's Next?
197247