Skip to content

Commit d5a2ea4

Browse files
committed
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 <[email protected]>
1 parent f598add commit d5a2ea4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+5671
-1842
lines changed

DEVELOPMENT.md

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# Development Guide
2+
3+
This document is for contributors and self-hosters who want to customize or run Afilmory from source.
4+
5+
## Workspace Layout
6+
7+
- `apps/web`: React + Vite SPA that consumes `photos-manifest.json` and generated thumbnails under `apps/web/public`.
8+
- `apps/ssr`: Next.js wrapper that injects the manifest for SEO/OG and proxies SPA assets.
9+
- `packages/builder`: Photo pipeline that syncs sources → processes images → writes manifest/thumbnails into the SPA.
10+
- `config.json` + `site.config.ts`: Presentation/content config merged at runtime for both SPA and SSR.
11+
- `builder.config.ts`: Builder pipeline config (storage, concurrency, repo sync, plugins).
12+
13+
## Quick Start (from source)
14+
15+
1. Install dependencies
16+
17+
```bash
18+
pnpm install
19+
```
20+
21+
2. Copy configs and fill values
22+
23+
```bash
24+
cp config.example.json config.json
25+
cp builder.config.default.ts builder.config.ts
26+
```
27+
28+
3. Environment variables (`.env`)
29+
30+
- Storage: `S3_REGION`, `S3_ENDPOINT`, `S3_BUCKET_NAME`, `S3_ACCESS_KEY_ID`, `S3_SECRET_ACCESS_KEY`, `S3_PREFIX`, `S3_CUSTOM_DOMAIN`, `S3_EXCLUDE_REGEX`
31+
- Repo sync (optional): `GIT_TOKEN`, `BUILDER_REPO_URL`, `BUILDER_REPO_BRANCH`
32+
33+
4. Build/update manifest and thumbnails (writes to `apps/web/src/data/photos-manifest.json` and `apps/web/public`)
34+
35+
```bash
36+
pnpm run build:manifest # incremental
37+
pnpm run build:manifest -- --force # full rebuild
38+
```
39+
40+
5. Run the app
41+
42+
```bash
43+
pnpm dev # SPA + SSR
44+
pnpm --filter web dev # SPA only
45+
pnpm --filter @afilmory/ssr dev # SSR wrapper only
46+
```
47+
48+
## Builder Configuration (`builder.config.ts`)
49+
50+
The builder uses `defineBuilderConfig` from `@afilmory/builder`. `builder.config.default.ts` shows the recommended shape:
51+
52+
```ts
53+
import os from 'node:os'
54+
import { defineBuilderConfig, githubRepoSyncPlugin } from '@afilmory/builder'
55+
import { env } from './env.js'
56+
57+
export default defineBuilderConfig(() => ({
58+
storage: {
59+
// Switch to { provider: 'local', basePath, baseUrl } for local-only testing.
60+
provider: 's3',
61+
bucket: env.S3_BUCKET_NAME,
62+
region: env.S3_REGION,
63+
endpoint: env.S3_ENDPOINT,
64+
accessKeyId: env.S3_ACCESS_KEY_ID,
65+
secretAccessKey: env.S3_SECRET_ACCESS_KEY,
66+
prefix: env.S3_PREFIX,
67+
customDomain: env.S3_CUSTOM_DOMAIN,
68+
excludeRegex: env.S3_EXCLUDE_REGEX,
69+
downloadConcurrency: 16,
70+
},
71+
system: {
72+
processing: { defaultConcurrency: 10, enableLivePhotoDetection: true, digestSuffixLength: 0 },
73+
observability: {
74+
showProgress: true,
75+
showDetailedStats: true,
76+
logging: { verbose: false, level: 'info', outputToFile: false },
77+
performance: {
78+
worker: { workerCount: os.cpus().length * 2, timeout: 30_000, useClusterMode: true, workerConcurrency: 2 },
79+
},
80+
},
81+
},
82+
plugins: [
83+
githubRepoSyncPlugin({
84+
repo: {
85+
enable: false,
86+
url: process.env.BUILDER_REPO_URL ?? '',
87+
token: env.GIT_TOKEN,
88+
branch: process.env.BUILDER_REPO_BRANCH ?? 'main',
89+
},
90+
}),
91+
],
92+
}))
93+
```
94+
95+
Notes:
96+
97+
- B2/GitHub storage are also supported (see comments in `builder.config.ts`).
98+
- Outputs land in `apps/web/public/thumbnails` and `apps/web/src/data/photos-manifest.json`.
99+
100+
## Site Presentation Config (`config.json`)
101+
102+
`config.json` merges into `site.config.ts` for both SPA and SSR:
103+
104+
- `name` / `title` / `description` / `url` / `accentColor`
105+
- `author`: `{ name, url, avatar }`
106+
- `social`: `{ github?, twitter?, rss? }`
107+
- `feed`: supports `folo.challenge.feedId` and `userId`
108+
- `map`: map providers, e.g. `["maplibre"]`
109+
- `mapStyle`: `builtin` or provider-specific style
110+
- `mapProjection`: `globe` or `mercator`
111+
112+
## Common Commands
113+
114+
```bash
115+
# Lint and format
116+
pnpm lint
117+
pnpm format
118+
119+
# Type check (web)
120+
pnpm --filter web type-check
121+
122+
# Build production
123+
pnpm build
124+
```

README.md

Lines changed: 9 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -77,94 +77,19 @@ Designed with adapter pattern, supporting multiple storage backends:
7777
- **Eagle Storage** - Using Eagle app library as image storage
7878
- **Local File System** - Local storage for development and testing
7979

80-
## 🚀 Quick Start
80+
## 🚀 Self-Host
8181

82-
### Docker Deployment
82+
### Option A: Docker (recommended)
8383

84-
[Docker Deployment](https://github.com/Afilmory/docker)
84+
[Docker deployment guide](https://github.com/Afilmory/docker) ships prebuilt images with minimal setup.
8585

86-
## ⚙️ Configuration Options
86+
### Option B: Manual install
8787

88-
#### Remote Repository Configuration (`repo`)
88+
1. Copy `config.example.json` to `config.json` and fill in your site name, description, and social links.
89+
2. Prepare access to your photo storage (S3/B2/GitHub/local). The builder will read photos and generate thumbnails plus `photos-manifest.json`.
90+
3. Run the builder to generate assets, then start the site.
8991

90-
To achieve incremental builds in CI, it is necessary to configure a cache repository, which will pull the cache before each build and upload the build results after the build.
91-
92-
```json
93-
{
94-
"repo": {
95-
"enable": true,
96-
"url": "https://github.com/username/gallery-assets"
97-
}
98-
}
99-
```
100-
101-
This will automatically pull resources from the remote repository, avoiding rebuilds each time.
102-
103-
**In order to achieve uploading to the git repository, you need to provide a `GIT_TOKEN` and write it in the `.env` file.**
104-
105-
#### Storage Configuration (`storage`)
106-
107-
- `provider`: Storage provider (`s3` | `github`)
108-
- `bucket`: S3 bucket name
109-
- `region`: S3 region
110-
- `endpoint`: S3 endpoint (optional)
111-
- `prefix`: File prefix
112-
- `customDomain`: Custom domain
113-
- `excludeRegex`: Regular expression to exclude files (optional)
114-
115-
#### System Processing (`system.processing`)
116-
117-
- `defaultConcurrency`: Default concurrency
118-
- `digestSuffixLength`: The length of the SHA-256 digest appended to the photo ID
119-
- `enableLivePhotoDetection`: Enable Live Photo detection
120-
- `supportedFormats`: Optional allowlist of file extensions to process
121-
122-
#### System Observability (`system.observability`)
123-
124-
- `showProgress`: Show build progress
125-
- `showDetailedStats`: Show detailed statistics
126-
- `logging.verbose`: Verbose logging
127-
- `logging.level`: Log level (`info` | `warn` | `error` | `debug`)
128-
- `logging.outputToFile`: Output to file
129-
- `performance.worker.workerCount`: Number of worker processes
130-
- `performance.worker.timeout`: Worker timeout (milliseconds)
131-
- `performance.worker.useClusterMode`: Enable cluster mode
132-
133-
## 📋 CLI Commands
134-
135-
### Build Commands
136-
137-
```bash
138-
# View help
139-
pnpm run build:manifest -- --help
140-
141-
# Incremental update (default)
142-
pnpm run build:manifest
143-
144-
# Force full update
145-
pnpm run build:manifest -- --force
146-
147-
# Only regenerate thumbnails
148-
pnpm run build:manifest -- --force-thumbnails
149-
150-
# Only regenerate manifest
151-
pnpm run build:manifest -- --force-manifest
152-
```
153-
154-
### Development Commands
155-
156-
```bash
157-
# Start development server
158-
pnpm dev
159-
160-
# Build production version
161-
pnpm build
162-
```
163-
164-
### Notes
165-
166-
- Ensure your S3 bucket already contains photo files
167-
- If using remote repository, configure `builder.config.ts` first
92+
Looking for developer commands, environment variables, and builder config details? See `DEVELOPMENT.md`.
16893

16994
## 🔧 Advanced Usage
17095

@@ -205,7 +130,7 @@ Attribution Network License (ANL) v1.0 © 2025 Afilmory Team. See [LICENSE](LICE
205130

206131
## 🔗 Related Links
207132

208-
- [Live Demo](https://gallery.innei.in)
133+
- [Live Demo](https://afilmory.innei.in)
209134
- [Personal Website](https://innei.in)
210135
- [GitHub](https://github.com/innei)
211136

0 commit comments

Comments
 (0)