A photo gallery application with workflow-based image processing, built with Go + PocketBase backend and SvelteKit frontend.
PhotoCifu follows a clean architecture pattern with dependency injection:
├── main.go # Application entry point
├── pkg/
│ ├── config/ # Configuration management
│ ├── container/ # Dependency injection container
│ ├── errors/ # Centralized error handling
│ ├── handlers/ # HTTP request handlers
│ └── validation/ # Input validation
├── workflow/ # Workflow definitions and activities
├── tools/ # Utility functions
└── ui/ # SvelteKit frontend
Install dependencies:
go mod tidy
cd ui/ && yarn install && cd ..
Run development server:
go run . serve --dev
Access the application:
cd ui/
# Development server with hot reload
yarn run dev
# Build production frontend
yarn run build
# Code quality checks
yarn run lint
yarn run format
yarn run check
# Generate embedded frontend assets
go generate ./...
# Build optimized binary
GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -o photo-cifu
# Run production server
./photo-cifu serve
Backend Configuration:
WORKFLOW_DB_NAME
: Workflow database filename (default: "workflow.db")GALLERY_MAX_FILE_SIZE
: Max gallery ZIP size in bytes (default: 100MB)GALLERY_MAX_IMAGES
: Max images per gallery (default: 100)WORKFLOW_DEFAULT_TIMEOUT
: Default workflow timeout in seconds (default: 300)Frontend Configuration:
PUBLIC_POCKETBASE_URL
: PocketBase API URLPUBLIC_WEBSITE_URL
: Public website URL# Development mode with debugging
go run . serve --dev --debug
# Custom data directory
go run . serve --dir ./custom-data
# Custom public files directory
go run . serve --publicDir ./custom-public
# Disable auto-migration
go run . serve --automigrate=false
All custom APIs use the /api/photocifu/
prefix:
POST /api/photocifu/gallery/create
- Create gallery with ZIP uploadPOST /api/photocifu/workflow/create
- Start workflow instancePOST /api/photocifu/signal/send
- Send workflow signalsPOST /api/photocifu/settings
- Update application settingsAll endpoints require authentication via PocketBase JWT tokens.
pb_data/storage/
workflow.db
)PhotoCifu uses go-workflows for async image processing:
gallery_process
: Process uploaded gallery imagesimage_enhancement
: Individual image processingcleanup
: Background maintenance tasks# Create a gallery processing workflow
curl -X POST http://localhost:8090/api/photocifu/workflow/create \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"workflow_type": "gallery_process",
"input": {
"gallery_id": "abc123",
"gallery_name": "My Gallery",
"user_email": "[email protected]"
}
}'
# Run with live reload
go run . serve --dev
# Update dependencies
go get -u -t ./...
go mod tidy
# Run tests (when available)
go test ./...
# Build for specific platform
GOOS=windows GOARCH=amd64 go build -o photo-cifu.exe
# Reset development database
rm pb_data/data.db pb_data/workflow.db
# Backup database
cp pb_data/data.db pb_data/backups/backup-$(date +%Y%m%d).db
Common Issues:
--http=0.0.0.0:8091
pb_data/workflow.db
for stateyarn run check
for TypeScript issuesDevelopment Database Reset:
# Stop server, backup if needed, then:
rm pb_data/data.db pb_data/workflow.db
# Restart server to recreate with migrations
This project is licensed under the MIT License - see the LICENSE file for details.