Skip to content
frama21Public

About

100% client-side photo & video sorter that runs in the browser.

Resources

Security policy

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

259 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NATA

A fast, 100% client-side photo & video sorter that runs in the browser. Open a local folder, preview each file, and copy/move it into sort sub-folders with single-key shortcuts. Nothing is uploaded — all processing happens locally via the File System Access API.

Requires a Chromium-based browser (Chrome / Edge / Opera). The File System Access API is not available in Firefox/Safari.

Features

  • Open a local folder and scan top-level images & videos — nothing leaves your machine.
  • Chronological order — files are sorted by capture date/time (EXIF / video metadata), falling back to the file's modified date.
  • Sort with shortcuts — keys 1–9 assign the current file to a folder. Click a folder's badge and press any key to rebind it (arrows, Space, U, Esc, and keys used by another folder are refused).
  • English & Indonesian UI — a navbar toggle switches language; the choice is remembered on the device. Strings live in src/shared/i18n/language/{en,id}.json.
  • Copy or Cut mode — duplicate into the target folder, or move it there.
  • Filmstrip & grid view — a thumbnail strip under the viewer and a toggleable responsive grid (with RAW previews), both showing sort status.
  • Zoom & pan — a desktop hover loupe magnifier, plus pinch-to-zoom / drag-to-pan and double-tap-to-reset on touch, for pixel-peeping.
  • Multi-select + batch sort — select many photos (checkbox, shift-range, "Select unsorted") and sort them all into a folder at once — via the folder button or its number shortcut; a batch is a single undo.
  • Undo the last action (Ctrl/Cmd+Z), covering single and batch sorts.
  • Jump to next unsorted (U) to skip already-sorted files, plus an "all sorted" completion state.
  • Wide format support — JPEG/PNG/WebP/AVIF/GIF/BMP/TIFF, SVG, plus RAW (Canon, Nikon, Sony, Fuji, Panasonic, Olympus, Pentax, DNG, …) and video (MP4, MOV, MKV, WebM, AVI, …).
  • RAW preview — extracts the largest embedded JPEG preview (sharp & fast), with a full-resolution libraw-wasm decode as fallback.
  • Metadata panel — EXIF for images (camera, lens, ISO, shutter, aperture, date) and mediainfo.js for video (duration, fps, codecs, bitrate). Metadata is extracted lazily on demand and cached.
  • Auto-persisted project state — folders, sort mappings, mode, and the recent operation log are saved to .nata-sort-db.json inside the chosen folder and restored on the next visit.
  • Shared catalog — ratings, labels and flags live in .creative-suite.json, which RONA and KALA read too. Each sort folder is a collection there (its members are the files in the folder), so RONA shows "photos in folder X". When another app renamed, deleted or changed such a collection, NATA shows the changes on open and applies them to the folders on disk once confirmed (closing the dialog closes the project); a copy is deleted only when its identical original is at the root. NATA follows the other apps while it is open: when the window comes back it reads the catalog again, updates the marks and shows "Catalog updated by RONA". A damaged catalog shows a banner with one action, "Restore from backup" (a valid .creative-suite.json.bak) or "Start a new catalog"; the damaged file is first copied to .creative-suite.corrupt-<time>.json, never deleted. A catalog from a newer version is only read, and keys NATA does not know are kept when it writes.
  • Filter bar — above the grid and the filmstrip: minimum rating, colour labels (several), flag and Unsorted, with "12 of 240" and Reset. Filters only narrow the view: arrows, folder shortcuts, U and the selection follow the photos in view, and a photo you just marked stays until you move on. The filter is kept per project on this device, not in the catalog.
  • Phones — folders open with the system folder picker (Chrome on Android); a handle whose move() fails falls back to copy-then-delete. NATA has no browser-storage (OPFS) project mode, so the shared catalog lives in the folder you pick.
  • Filename-collision safe — copies/moves never silently overwrite; a _1, _2, … suffix is added when a name already exists.
  • Installable PWA — install to your desktop/home screen and keep working offline thanks to a precaching service worker. New versions wait until you press Reload, so an open project is never swapped out from under you.
  • Responsive — desktop sidebar layout and a mobile action bar with swipe navigation. Light/dark themes.

Keyboard shortcuts

Key Action
1–9 Sort into folder 1–9
← / → Previous / next photo
Space Next photo
U Jump to next unsorted photo
Ctrl/Cmd + Z Undo last action
Ctrl/Cmd + A Select all (grid view)
Shift + 1–5 / Shift + 0 Rate 1–5 (again clears) / clear rating
Shift + 6–9 Color label red, yellow, green, blue (purple in the info panel menu)
P / X Mark picked / rejected (again clears)

(Shortcuts are ignored while typing in a text field.)

Suite workflow

NATA is the first of three apps that share one project folder (Help > Suite workflow shows this in the app). Ratings, labels, flags and collections travel with the folder.

  1. NATA, Sort (you are here): open the shoot folder and sort photos and videos into folders; rate, label and flag them.
  2. RONA, Edit: open the same folder; every photo and NATA's folders are already there. Edit and export next to the originals.
  3. KALA, Video: open the same folder; folders become bins with their marks. Build the timeline and export.
  4. Claude Code (optional): let Claude sort, edit and export through Settings > MCP on a computer.

Using with Claude Code

NATA ships an MCP server so Claude Code can sort for you: list photos, mark them, make sorting folders, copy or move photos, and undo. It runs on your computer only (desktop). Nothing is uploaded.

  1. Install dependencies once (bun install).

  2. Add the server to your agent. Easiest: open NATA, go to Settings > MCP and press the copy button in Connect an AI agent, then paste it into .mcp.json at the root of your workspace (Claude Code). It is always npx -y <app address>/mcp (a small launcher that fetches the latest server on each start), on the hosted app and in dev alike: bun run build makes the package as dist/mcp, and bun run dev serves the same package at /mcp (e.g. npx -y http://localhost:5173/mcp). From a clone you can also run the server directly:

    {
      "mcpServers": {
        "nata": { "command": "node", "args": ["nata-sort/mcp/server.ts"] }
      }
    }

    (Node 24 runs the TypeScript file directly. bun run mcp does the same from this folder.)

  3. Open NATA, open a project, then Settings > MCP and turn on Allow Claude Code to control NATA. The status turns to Connected. The copied config adds NATA_MCP_PORT when you change the port; copy it again after NATA updates.

  4. Ask Claude, for example: "Sort every photo rated 4 or more into a folder called Picks" or "Separate rejected photos".

What it does through the open tab is the same as the buttons and shortcuts: the screen updates and Undo works. It asks you to confirm (a prompt in Claude Code) before it moves photos (Cut), deletes a sort folder, or sorts more than 20 photos at once. Copy of up to 20 photos, marks and new folders need no confirmation. If your client cannot ask, those actions are refused. Every call is logged in .nata-sort-mcp-log.jsonl in the project folder (the last 1,000 lines).

Without a tab open, list_folders, list_photos and set_marks also work on a project folder on disk (project_path); marks are written to the shared catalog .creative-suite.json with the same rules as the app. Sorting always needs the tab.

Setting Default Notes
Port 41174 The server reads NATA_MCP_PORT; set the same number in Settings > MCP.
Allowed origins the NATA domain and http://localhost:5174 NATA_MCP_ORIGINS (comma separated) adds more.
Call timeout 120 s MCP_CALL_TIMEOUT_MS; long calls report progress and keep going.

Tools: get_status, list_folders, list_photos, set_marks, plan_sort, sort_photos, set_move_mode, create_folder, delete_folder, undo; resource nata://project; prompts "Sort by rating" and "Separate rejected photos". Details and the security model: docs/SECURITY.md.

When the project database .nata-sort-db.json is changed by something else (another program, a text editor), NATA reloads the project in place when the window comes back and says so; if it has unsaved changes it asks you instead (Reload or Keep mine).

Tech stack

React 19 · TypeScript (strict) · Vite · React Router · Tailwind CSS v4 · Zustand · i18next · ExifReader · mediainfo.js · libraw-wasm · vite-plugin-pwa. UI primitives live in src/shared/components/ui: Dialog, Tooltip, Menu, Checkbox and Switch are built on Base UI (@base-ui/react), styled to the suite guide in design-system/; the rest are small in-house components, with no Radix or shadcn dependency. Tests: Vitest + React Testing Library + Playwright. Production server: nginx, configured inside the Dockerfile (see docs/ARCHITECTURE.md).

Getting started

Requires Node 22.23.4+ and bun 1.4.5+.

bun install
bun run dev                  # start the dev server
bun run build                # typecheck + production build
bun run preview              # preview the production build
bun run lint                 # oxlint (JSDoc, React rules, import boundaries; warnings fail)
bun run format:check         # Prettier
bun run typecheck            # tsc -b
bun run check:architecture   # module boundaries on resolved paths + import cycles

Architecture

The code is organized by feature. A feature owns its UI, logic, routes, and tests, so you can change or delete it mostly inside its own folder.

src/
├── app/        # composition: providers, router + route discovery, layout, error boundary, styles
├── features/
│   ├── sorter/ # the sorting workspace (route "/"): controller hook, components, project DB
│   └── media/  # format registry, metadata extraction, RAW decoding (no routes, public API in index.ts)
├── shared/     # business-agnostic building blocks: UI primitives, i18n, status toasts, cn(), route types
└── test/       # global test setup and test doubles (in-memory File System Access handles)
design-system/  # suite guide copied by the sync script; reference only, never imported (see Documentation)

Each feature uses only the folders it needs (components/, hooks/, pages/, services/, types/, utils/, config/, tests/). It may also have:

  • routes.ts declares the feature's pages. It is found automatically, see below.
  • index.ts is the feature's public API. Only media and sorter have one, because only they have consumers. If a feature has no index.ts, other features cannot import it.
  • README.md documents the feature's purpose, contract, and how to remove it safely.

Import boundaries

From May import Must not import
app/ shared/, feature routes (via discovery) feature internals
features/<name>/ its own files (relative paths), shared/, another feature's index.ts (@/features/<other>) app/, another feature's internal files
shared/ shared/, packages app/, features/

These rules are enforced in two places:

  • oxlint (no-restricted-imports, in .oxlintrc.json) checks alias imports and gives feedback in the editor. It generates one rule block per folder in src/features.
  • bun run check:architecture checks the resolved paths, so relative escapes like ../other-feature/... are caught too. It also reports import cycles and unresolved imports. Test files may import the internals they test.

Route discovery

src/app/routes/feature-routes.ts uses import.meta.glob("/src/features/*/routes.ts", { eager: true }). Each routes.ts exports routes: FeatureRoute[] (see src/shared/types/route.types.ts):

export const routes: FeatureRoute[] = [
  {
    path: "/about",
    lazy: () => import("./pages/AboutPage").then(m => ({ Component: m.AboutPage })),
    title: "Tentang", // document title
    nav: { label: "Tentang", order: 10 } // optional link in the main navigation
  }
]
  • Validation: collectFeatureRoutes validates every module. A missing routes export, an invalid route, or a duplicate path is logged and skipped; the other routes still work.
  • Lazy loading: pages are lazy-loaded into their own chunks. Each route has its own error boundary, so a crash or a failed chunk download stays inside that route.
  • Not found: unknown URLs show a not-found page.
  • One screen, several URLs: routes with the same screen stay mounted while the URL moves between them (no enter animation, scroll or focus reset). The sorter uses it for / and /project/:projectId: an open project lives at its own URL (its id in the recent list), a refresh reopens it (or asks for folder access with one click when the browser dropped it), Back asks before closing it, and an unknown id or a bare /project goes to /.
  • Not supported yet: nested routes, per-route layouts, and auth guards. Add them to FeatureRoute when a feature needs them.

The glob is resolved at build time. Adding or deleting a feature changes the routes with no registry to edit. A dev server picks this up on restart.

Adding a feature

  1. Create src/features/<name>/ with only the folders it needs.
  2. If it has pages, add routes.ts.
  3. If other features need it, export a minimal public API from index.ts.
  4. Put its tests in tests/unit-test/, tests/integration-test/, or tests/e2e-test/.
  5. Add a README.md (copy src/features/sorter/README.md as a template).

Removing a feature

Delete its folder, then run bun run typecheck && bun run check:architecture && bun run test.

  • No dependents: removing sorter needs no other change. It was verified this way, including the build and the remaining tests.
  • Has dependents: sorter depends on media, so deleting media fails at tsc and check:architecture with "unresolved import". It never fails silently at runtime. Each feature README lists its dependencies.

Testing

Command Runs
bun run test all Vitest projects (unit + integration)
bun run test:unit src/**/tests/unit-test/**/*.test.ts(x)
bun run test:integration src/**/tests/integration-test/**/*.test.ts(x)
bun run test:e2e Playwright on a production build (src/**/tests/e2e-test/*.spec.ts, Chromium)
bun run test:all Vitest, then Playwright
  • Folder picker in E2E: Playwright can't drive the native folder picker. Instead, the E2E suite points showDirectoryPicker() at a folder in the browser's Origin Private File System. Those are real File System Access handles, so copy, move, undo, and the project database run against actual files.
  • Unit and integration tests use the in-memory handles in src/test/global-mocks/file-system.ts.

Run with Docker

Deployment is a single container driven by docker compose. A two-stage Dockerfile builds the app with bun on oven/bun:1.4.5-alpine (no Node appears), then an unprivileged nginx runtime serves the static output. The whole nginx config lives in the Dockerfile (the repo's only deploy files are Dockerfile and docker-compose.yml): strict CSP + security headers, cross-origin isolation, SPA routing, immutable asset caching, and correct PWA/WASM MIME types. The final image contains only nginx and the built assets — no Node, no toolchain — and it runs as a non-root user.

docker compose up -d --build    # build & run → http://localhost:8080
docker compose down             # stop

The Compose file is hardened for production out of the box: read-only root filesystem, no-new-privileges, all Linux capabilities dropped, resource limits, log rotation, and a health check. For public HTTPS, terminate TLS at your platform edge (Cloudflare, a load balancer, Caddy/Traefik) and forward to the container. See docs/SECURITY.md for the full deployment hardening details.

Or without Compose:

docker build -t nata-sort .
docker run -d -p 8080:8080 nata-sort

How state is stored

A single JSON file, .nata-sort-db.json, is written to the folder you open. It contains the sort folders, the per-file sort mapping (keyed by file name), the move mode, the recent operation log, and a metadata cache. Deleting this file resets the project; the app recreates it on the next open. The database carries a schema version and is reset (with a visible warning) if an incompatible version is found.

Security

  • All files are processed locally in the browser; nothing is uploaded and there is no network egress (connect-src 'self').
  • A strict Content-Security-Policy and a full set of security headers (COOP/COEP/CORP cross-origin isolation, HSTS, X-Frame-Options, Referrer-Policy, Permissions-Policy, …) are set by the nginx config in the Dockerfile.
  • Untrusted input is defended in depth: images are parsed header-only and decodes are bounded/timed-out; the project database is sanitized against prototype pollution; folder names are strictly validated.
  • The dependency tree is audit-clean (bun audit → No known vulnerabilities found), and the production image ships only three audited server dependencies.
  • Routing is client-side only: an unknown URL renders an inert not-found page with a link home.

A full security policy, threat model, and audit report is in docs/SECURITY.md. Report vulnerabilities privately via GitHub security advisories (see /.well-known/security.txt).

Documentation

Detailed project documentation lives in docs/:

Document Purpose
PRD.md Product requirements — vision, personas, user stories, scope.
SPEC.md Functional specification — features, formats, behaviors, edge cases.
ARCHITECTURE.md System architecture — modules, data flow, deployment.
DESIGN.md Software design — key decisions, rationale, core algorithms.
TDD.md Technical design — module internals, DB schema, sequence diagrams, limits.
UI-Design.md UI/UX — design tokens, layout, components, theming, accessibility.
PRINCIPLES.md Engineering & product principles (Clean Code · YAGNI · DRY · KISS · Semantic · A11y).
DEPLOYMENT.md Deployment guide — Docker Compose, the server, and Firebase Hosting.
SECURITY.md Security policy, threat model, and audit report.
brand/ Logo kit (SVG/PNG), colours, and usage rules.

Suite design system guide

design-system/ is the shared guide for NATA, RONA, and KALA: spec, tokens, component guidance and previews, logos, and the .creative-suite.json contract. It is a reference, not app code: nothing in src/ imports it, and it is excluded from oxlint, Prettier, Tailwind's class scan, Vite's dependency scan, and the Docker build context. It is included in the graphify knowledge graph, so the design language is searchable alongside the code.

Do not edit it here. It is a copy of the single source at the root of the creative-suite workspace and is updated with node design-system/scripts/sync.ts --only nata-sort, run from the workspace root (--check reports drift if the copy was edited by hand). NATA's own components follow the guide but live in src/.

Changelog

See CHANGELOG.md for the release history.

About

100% client-side photo & video sorter that runs in the browser.

Resources

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Contributors

Languages