The starter for an Assembly Line factory: a repo of lines and
stations whose steps run in a factory session against the Orchestrator. Built on
@assemblyline/lib-factory. It ships one
example line, EX, that turns text files into workpieces and counts their words.
git clone https://github.com/assemblyline-sh/factory-template.git factory-<name>
cd factory-<name>rm -rf .git
git init| Placeholder | Replace with | Example |
|---|---|---|
{{ORG_NAME}} |
Your org identifier (lowercase) | acme |
{{LOCATION}} |
Where this factory runs; lines at this location run here | acme-office |
{{FACTORY_NAME}} |
factory-<name> |
factory-acme |
{{FACTORY_DESCRIPTION}} |
Short description | Factory for the acme org |
# macOS
grep -rl '{{ORG_NAME}}' . --exclude-dir=node_modules | xargs sed -i '' 's/{{ORG_NAME}}/acme/g'
grep -rl '{{LOCATION}}' . --exclude-dir=node_modules | xargs sed -i '' 's/{{LOCATION}}/acme-office/g'
grep -rl '{{FACTORY_NAME}}' . --exclude-dir=node_modules | xargs sed -i '' 's/{{FACTORY_NAME}}/factory-acme/g'
grep -rl '{{FACTORY_DESCRIPTION}}' . --exclude-dir=node_modules | xargs sed -i '' 's/{{FACTORY_DESCRIPTION}}/Factory for the acme org/g'npm install
npx factory steps list # the example steps; runs a step locally with no account- Sign up and verify your email. Your account comes with an organisation.
- In the Orchestrator, open Settings → API keys and create a key. The secret is shown only once.
- Put the key and secret in
.env:
cp .env.example .env
# ORCHESTRATOR_API_KEY=... ORCHESTRATOR_API_SECRET=...- Install the CLIs and give al-orc the same key:
npm install -g @assemblyline/al-orc @assemblyline/al-control
al-orc config profiles add acme --api-key <key> --api-secret <secret>
al-orc statusal-orc lines push --all && al-orc stations push --all # creates EX, EX0, EX1
npm run dev # in a second terminal: a factory session
al-orc stations run EX0 # seeds 3 workpieces from samples/
al-control lines status EX -f . # watch them move: 2 done, 1 failedsamples/empty.txt is empty on purpose: it fails the word count and lands in
temp/stations/EX1/failed/ with its error. EX0 runs only when you start it, so the factory
session warns at start that nothing triggers EX0; EX1 starts by itself when EX0's output has
workpieces. Delete the EX line, its steps and samples/
when you add your own.
- Add step handlers in
src/steps/{SHORT_CODE}__{station_slug}/usingdefineStep()(see CLAUDE.md) - Add line and station JSONs in
.orchestrator/lines/and.orchestrator/stations/, and push them withal-orc lines push --all && al-orc stations push --all - Run one step on its own:
npx factory steps run <slug> --station <CODE>(output intemp/<slug>.json; attachments stay intemp/work_records/) - Run with
npm run devduring development
Replace this setup guide with a short factory readme:
# {{FACTORY_NAME}}
{{FACTORY_DESCRIPTION}}. See [CLAUDE.md](CLAUDE.md) for architecture and development details.
## Quick Start
\```bash
npm install
cp .env.example .env # fill in credentials
npm run dev
\```├── CLAUDE.md # Factory documentation (has placeholders)
├── README.md # This file
├── .env.example # Environment variables
├── .orchestrator/
│ ├── lines/EX.json # Example line
│ └── stations/ # EX0 (intake) and EX1 (count words)
├── samples/ # Input for the example line
├── src/
│ ├── index.js # Entry point: factory session + bin watcher
│ └── steps/ # One folder per station
├── tests/example-line.test.js # Runs the example line end to end
├── docs/
└── scripts/
temp/ is created at runtime and gitignored. Bins live there:
temp/stations/{STATION}/{input,doing,output,done,failed}/.