Skip to content

refactor: move workers/ into apps/workers/; add backend/README.md - #9

Merged
Rakesh1002 merged 1 commit into
mainfrom
Rakesh1002/repo-reorg-v2
May 28, 2026
Merged

refactor: move workers/ into apps/workers/; add backend/README.md#9
Rakesh1002 merged 1 commit into
mainfrom
Rakesh1002/repo-reorg-v2

Conversation

@Rakesh1002

Copy link
Copy Markdown
Owner

Summary

Continues the directory reorg. Adopts a single rule: every deployable TypeScript / SDK package lives under apps/*. The Python backend stays at backend/ because it's Python (different language, conventionally one source tree per project, and its app/ module would collide with apps/ if nested).

Before:
```
unsearch/
├── backend/ Python
├── workers/ TypeScript (CF Workers) ← inconsistent shelf
└── apps/
├── web/ TypeScript (CF Workers)
└── sdk-*/
```

After:
```
unsearch/
├── backend/ Python (the only non-apps/ deployable)
└── apps/
├── workers/ TypeScript (CF Workers edge router) — moved
├── web/ TypeScript (CF Workers — Next.js dashboard)
├── sdk-ts/, sdk-py/, sdk-llamaindex/, mcp-server/ (planned)
```

Mechanical changes

  • git mv workers apps/workers — every TS source file moved with history preserved.
  • pnpm-workspace.yaml: collapses to a single - "apps/*" glob (drops the now-redundant - "workers" line).
  • apps/workers/containers.toml: build context ..../..; dockerfile path ../backend/Dockerfile.cloudflare../../backend/Dockerfile.cloudflare.
  • .github/workflows/deploy-cf.yml: every working-directory: workers, workingDirectory: workers, and workers/pnpm-lock.yaml reference → apps/workers.
  • scripts/cf-provision.sh: cd into apps/workers; output paths updated.
  • backend/Dockerfile.cloudflare: header comment references apps/workers/containers.toml.
  • All docs: workers/...apps/workers/... in docs/architecture.md, docs/what-is-what.md, docs/README.md, docs/citation-envelope.md, docs/roadmap.md, docs/strategy/user-journey.md, docs/strategy/pricing.md, ADR-0001, ADR-0010, and the README.md repo tree.
  • ADR-0006 Amendment Part 3: documents this move + the new "single apps/*" rule.

What did NOT change

  • The Worker's internal Hono routes, Durable Object bindings, D1 schema, MCP transport, wrangler.toml, and all source code are unchanged — only their file system location.
  • No runtime behaviour, no public API surface, no env vars, no wire formats.
  • CHANGELOG.md intentionally untouched — historical release notes refer to the workers/ path that was correct at the time; rewriting history is wrong.

Other audit cleanup in this PR

apps/backend/ directory removed

The empty apps/backend/ directory left behind by the previous restructure PR (it contained only a gitignored .env) is gone. The .env was filesystem-copied to backend/.env in this workspace, but since both .env files are gitignored neither is in the diff. Users with their own local checkouts will need to do the same dance:

```bash
cp apps/backend/.env backend/.env
rm -rf apps/backend
```

Added backend/README.md

Every other package (apps/web, apps/workers, apps/sdk-ts, apps/sdk-py, apps/sdk-llamaindex) had a per-package README. backend/ was the lone exception. Added one — covers layout, quickstart (make dev, make test, etc.), env setup, request flow from the Worker, citation envelope pointer.

Risk

  • CI: all apps/workers paths in deploy-cf.yml updated; expect green.
  • Production deploy: unchanged. Worker code unchanged. Container image unchanged.
  • Self-host: unchanged. docker-compose paths weren't affected by this PR.
  • Local dev: anyone with a checked-out branch needs to delete their root workers/ checkout and pull fresh (or git will refuse to clean a renamed-away dir).

Test plan

  • `git pull origin main && ls` — no top-level workers/; apps/workers/ exists.
  • `ls apps/backend/` returns no such file or directory.
  • `ls backend/` includes README.md, app/, alembic/, tests/, etc.
  • `pnpm install` at root resolves apps/workers as a workspace member.
  • CI green on deploy-cf.yml worker + container + web + smoke jobs.
  • `wrangler containers deploy --config apps/workers/containers.toml` finds ../../backend/Dockerfile.cloudflare.
  • `cd apps/workers && pnpm test` still runs the vitest suite.

Continues the directory reorg. After the previous two PRs the tree
still had `workers/` (Cloudflare edge router) as a sibling of `apps/`
even though `apps/web` was also a Cloudflare Workers deployment. Two
Workers deployments shelved differently — inconsistent.

This PR adopts a single rule: every deployable TypeScript / SDK
package lives under `apps/*`. The Python backend stays at `backend/`
because (a) it's Python (different language), (b) its `app/` module
would collide with `apps/` if nested, (c) Python convention is one
source tree per project.

Mechanical changes:

- git mv workers apps/workers — preserves history for every src file.
- pnpm-workspace.yaml: collapse to single `apps/*` glob (drop the
  separate `- "workers"` line; covered by apps/*).
- apps/workers/containers.toml: build context `..` → `../..`;
  dockerfile `../backend/Dockerfile.cloudflare` → `../../backend/...`.
- .github/workflows/deploy-cf.yml: every `working-directory: workers`
  and `workingDirectory: workers` → `apps/workers`; cache-dependency
  path updated similarly.
- scripts/cf-provision.sh: cd into apps/workers; output paths updated.
- backend/Dockerfile.cloudflare: comment header references
  apps/workers/containers.toml.
- All docs (architecture, what-is-what, README, citation-envelope,
  roadmap, strategy/user-journey, strategy/pricing, ADR-0001, ADR-0010,
  docs/README): workers/... → apps/workers/...
- ADR-0006 gets an Amendment Part 3 documenting this move and the
  rationale (single apps/* workspace rule).
- README.md repo tree: workers/ moved under apps/.
- CHANGELOG.md is intentionally untouched (historical release notes
  reference the workers/ path that was correct at the time).

apps/backend/ directory removed entirely (it was an empty leftover
containing only a gitignored .env from the apps/backend/ collapse PR).
The .env was filesystem-copied to backend/.env locally; gitignored so
not tracked. Users with their own checkouts need to do the same:
  cp apps/backend/.env backend/.env && rm -rf apps/backend

Audit additions:
- backend/README.md created (every other package — apps/web,
  apps/workers, apps/sdk-ts, apps/sdk-py, apps/sdk-llamaindex — had a
  README; backend was the lone exception).
@Rakesh1002
Rakesh1002 merged commit 887da33 into main May 28, 2026
@Rakesh1002
Rakesh1002 deleted the Rakesh1002/repo-reorg-v2 branch May 28, 2026 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant