Files
afilmory/apps/docs/contents/builder/config.mdx
Innei d5a2ea4db2 feat: enhance documentation and add new features for Afilmory
- Introduced a comprehensive `DEVELOPMENT.md` guide for contributors and self-hosters, detailing workspace layout and common commands.
- Updated `README.md` to include links to the new development guide and improved deployment instructions.
- Added new documentation files covering architecture, builder pipeline, configuration, and deployment strategies.
- Implemented new storage provider documentation for Backblaze B2, Eagle, GitHub, and local storage options.
- Enhanced the UI components with new features, including a navigation context and improved theme handling.
- Removed outdated GitHub Action deployment documentation.

Signed-off-by: Innei <tukon479@gmail.com>
2025-11-23 19:40:51 +08:00

74 lines
2.5 KiB
Plaintext

---
title: Configuration
description: How to declare storage, system defaults, and plugins in builder.config.ts.
createdAt: 2025-11-23T19:00:00+08:00
lastModified: 2025-11-23T19:40:52+08:00
order: 3
---
# Configuration
`builder.config.ts` defines storage, processing defaults, observability, and plugins. It uses `defineBuilderConfig` and merges user overrides onto sensible defaults.
## Minimal template
```typescript
import os from 'node:os'
import { defineBuilderConfig } from '@afilmory/builder'
export default defineBuilderConfig(() => ({
storage: {
provider: 'local',
basePath: './apps/web/public/photos',
baseUrl: '/photos',
},
system: {
processing: {
defaultConcurrency: 10,
enableLivePhotoDetection: true,
digestSuffixLength: 0,
},
observability: {
showProgress: true,
showDetailedStats: true,
logging: { verbose: false, level: 'info', outputToFile: false },
performance: {
worker: {
workerCount: os.cpus().length * 2,
workerConcurrency: 2,
timeout: 30_000,
useClusterMode: true,
},
},
},
},
plugins: [],
}))
```
## Storage providers
- **s3**: bucket/region/endpoint plus tuning (`downloadConcurrency`, keep-alive, socket limits, retries, timeouts, `customDomain`, `excludeRegex`, `prefix`).
- **b2**: `applicationKeyId`, `applicationKey`, `bucketId`, optional `bucketName`, `prefix`, `customDomain`, limits.
- **github**: `owner`, `repo`, optional `branch`, `token`, `path`, `useRawUrl` (raw.githubusercontent.com for public URLs).
- **local**: `basePath` (scan source), optional `distPath` to copy originals, `baseUrl` for generated URLs, `excludeRegex`, `maxFileLimit`.
- **eagle**: `libraryPath`, optional `distPath`/`baseUrl`, include/exclude rules, `folderAsTag`, `omitTagNamesInMetadata`.
## System settings
- **processing**: `defaultConcurrency`, `enableLivePhotoDetection`, `digestSuffixLength`, optional `supportedFormats` (Set).
- **observability**:
- `showProgress`, `showDetailedStats`.
- `logging`: `verbose`, `level` (`info | warn | error | debug`), `outputToFile`, optional `logFilePath`.
- `performance.worker`: `workerCount`, `workerConcurrency`, `timeout`, `useClusterMode`.
## Plugins array
`plugins` accepts:
- A plugin instance (`{ hooks: { ... } }`).
- A factory: `() => BuilderPlugin` or `(options) => BuilderPlugin`.
- An async ESM importer `() => import('...')` returning a default export plugin.
See [Plugins](/builder/plugins) for lifecycle and authoring guidance.