Skip to content

chore: consolidate repo structure; delete stale apps/backend fork - #7

Merged
Rakesh1002 merged 1 commit into
mainfrom
Rakesh1002/repo-restructure-consolidation
May 28, 2026
Merged

chore: consolidate repo structure; delete stale apps/backend fork#7
Rakesh1002 merged 1 commit into
mainfrom
Rakesh1002/repo-restructure-consolidation

Conversation

@Rakesh1002

Copy link
Copy Markdown
Owner

Summary

Collapses the dual-backend layout ADR-0006 had been promising to fix. apps/backend/ was a stale fork of root app/ with diverged code: pre-rebrand UnQuestRequest class names, different import paths (app.services.searxng vs app.services.core.searxng), 2 Alembic migrations vs 5 at root, and (critically) a 2,841-line production SearXNG settings.yml that was never mounted — the live mount path searxng/settings.yml was a 40-line stub falling back to upstream defaults. That's a real bug this PR fixes by salvaging the production config to the live mount path before deleting the fork.

All live deployment paths (ci-cd.yml, deploy-cf.yml, Dockerfile.cloudflare, docker-compose.yml, Makefile, ecosystem.config.js, scripts/manage.sh) already targeted root app/. apps/backend/ existed only as documentation debt promised by ADR-0006 to be collapsed in a future PR.

What changed (134 files)

Phase 1 — Salvage

  • apps/backend/searxng/settings.yml (2,841 lines, production-tuned) → searxng/settings.yml. Replaces the 40-line stub at the live mount path.

Phase 2 — Delete

  • git rm -r apps/backend/ — 130+ files of stale code (Procfile, Dockerfile, alembic, scripts, tests, etc.).
  • Delete .github/workflows/deploy.yml — Railway deploy via cd apps/backend sunset by ADR-0010 (CF Containers GA). Active deploy is deploy-cf.yml.
  • Delete scripts/verify-setup.sh — described a Turborepo monorepo this repo never was (packages/shared/, vercel.json, apps/web/src/...). Would have failed 80% of its own checks today.
  • Delete setup_webhook_quick.sh — orphaned dev artifact, no references in manage.sh or any deployment script.
  • Delete apps/web/public/{file,globe,next,vercel,window}.svg — unreferenced Next.js scaffold SVGs.

Phase 3 — Healthy housekeeping

  • Add pnpm-workspace.yaml — SDK packages reference each other via workspace:* but workspace was never declared at root.
  • Add apps/sdk-ts/tests/client.test.ts — first vitest test (vitest was configured but no test files existed). Smoke-tests constructor + search() header construction.

Docs reconciled

  • docs/adr/0006-monorepo-with-apps-and-workers.md — Amendment section documenting the consolidation; resolved the "Two backend layouts" Con line.
  • docs/architecture.md — "Backend Container — app/ and apps/backend/" → app/ only; removed the technical-debt row about dual backend.
  • docs/configuration/env-variables.mdapps/backend/.env.env.

Risk

  • Production deploy: unaffected. deploy-cf.yml and ci-cd.yml both target root app/ already. The deleted deploy.yml had not been the active path since CF Containers GA in April 2026.
  • CI: .github/workflows/deploy.yml was the only workflow targeting apps/backend. Removed in this PR.
  • Self-host: SearXNG behavior improves (real production config replaces stub).
  • Working tree: apps/backend/.env (gitignored, contains secrets) is left in the working tree. Manually compare with root .env and remove if redundant.

Test plan

  • git pull origin main && ls apps/ shows no backend/ (after manual removal of the gitignored .env).
  • wc -l searxng/settings.yml returns 2841.
  • pnpm install at root succeeds with the new pnpm-workspace.yaml.
  • cd apps/sdk-ts && pnpm test passes the new smoke test.
  • CI: ci-cd.yml quality check + deploy-cf.yml worker + container jobs run green on this PR.
  • docker compose up -d searxng mounts the 2,841-line config (verify via docker logs unsearch-searxng | head — should not show "using default settings" warning).

Follow-ups (not in this PR)

  • Extract shared types between apps/sdk-ts/ and workers/src/lib/ (e.g. VectorMatch) to a packages/sdk-types/ workspace.
  • Add .github/workflows/sdk-ts.yml so the new vitest test runs in CI.
  • Expand backend test coverage from ~40% to 80% per CONTRIBUTING.md.
  • Replace apps/web/public/ Next.js scaffold with UnSearch branding (favicon, OG image, logo).

apps/backend/ was a stale fork of root app/ with diverged code:

- UnQuestRequest class name (pre-rebrand) vs UnSearchRequest at root
- Different import paths (app.services.searxng vs app.services.core.searxng)
- 2 Alembic migrations vs 5 at root
- pytest.ini pointing at sqlite vs the live root postgres
- Independent Dockerfile, docker-compose, requirements.txt, pyproject.toml
  that nothing live referenced
- A 2841-line production SearXNG settings.yml that was never mounted
  (the live mount path searxng/settings.yml was a 40-line stub falling
  back to upstream defaults — a real bug)

All live references (ci-cd.yml, deploy-cf.yml, Dockerfile.cloudflare,
docker-compose.yml, Makefile, ecosystem.config.js, scripts/manage.sh)
already targeted root app/. apps/backend/ existed only as documentation
debt promised by ADR-0006 to be collapsed in a future PR.

This PR collapses it. Specifically:

- Salvage the production SearXNG settings.yml from apps/backend/searxng/
  to searxng/settings.yml (fixes the SearXNG default-config bug).
- git rm -r apps/backend/ (130+ files of stale code).
- Delete .github/workflows/deploy.yml — Railway deploy is sunset by
  ADR-0010 in favor of CF Containers GA. The active deploy is
  deploy-cf.yml which targets root.
- Delete scripts/verify-setup.sh — describes a Turborepo monorepo this
  repo never was (packages/shared, vercel.json, src/ paths) and would
  fail 80% of its checks today regardless.
- Delete setup_webhook_quick.sh — orphaned dev artifact, no references.
- Delete unused Next.js scaffold SVGs in apps/web/public/.

Housekeeping:

- Add pnpm-workspace.yaml declaring apps/* + workers — SDK packages
  reference each other via workspace:* but the workspace was never
  declared at root.
- Add apps/sdk-ts/tests/client.test.ts — first vitest test (vitest
  was configured but no test files existed).
- Update ADR-0006 with an amendment noting the consolidation. Original
  "Two backend layouts" Con line resolved.
- Update docs/architecture.md, docs/configuration/env-variables.md
  to remove the dual-backend references.

apps/backend/.env was left in working tree (gitignored, contains
secrets); the user should manually compare against root .env and
remove if redundant.
@Rakesh1002
Rakesh1002 merged commit c242002 into main May 28, 2026
2 of 6 checks passed
@Rakesh1002
Rakesh1002 deleted the Rakesh1002/repo-restructure-consolidation branch May 28, 2026 15:39
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