How jendryh30/arganotakehome-jh works
Purpose and Runtime
Argano Dispatch is a small internal PHP document-sharing system. Staff create and manage documents, generate recipient share links, and recipients retrieve documents through those links. It runs as a Docker Compose service using PHP and SQLite; startup reseeds the database for a deterministic local environment. Core runtime definitions: Dockerfile, docker-compose.yml, public/index.php.
HTTP Entry Points and UI
The application is server-rendered PHP, with each public script acting as a request handler/page rather than a routed framework controller. Staff-facing flows include login, administration, document editing, and access requests; recipient-facing flows resolve and display shared documents.
• public/login.php
• public/admin.php
• public/edit.php
• public/share.php
• public/view.php
• public/request-access.php
Shared HTML framing and styling are centralized separately from request logic in lib/layout.php and public/assets/style.css.
Application Bootstrap and Cross-Cutting Policy
lib/bootstrap.php is the central application boundary for database initialization/access, authentication/session behavior, and reusable domain helpers. It also establishes the audit-log pattern required for document creation, scheduling changes, and share activity. Request handlers should rely on this layer instead of directly duplicating connection, authorization, or audit behavior.
• lib/bootstrap.php
• lib/layout.php
Document Authoring and Administration
Staff administration is the primary control plane: it lists or manages documents and exposes document creation/editing actions. public/edit.php owns document authoring/update interactions, while public/admin.php is the operational discovery/management surface. The repository includes an edit.php.bak, which is not a production entry point and should not be treated as authoritative.
• public/admin.php
• public/edit.php
Document identity, uniqueness, availability scheduling, and access rules are persisted in SQLite. The later migrations indicate the intended feature evolution: unique titles, available_at scheduling, and voice/readable codes for shares.
• migrations/20260710_unique_document_titles.sql
• migrations/20260709_add_available_at_to_documents.sql
• migrations/20260706_add_voice_code_to_shares.sql
Sharing and Recipient Access Boundary
Sharing is a distinct capability boundary: staff generate or manage recipient access through public/share.php; recipients consume a link through public/view.php. The initial schema/migrations establish document-level ACL and single-use-share concerns, while the voice-code migration suggests a human-friendly alternate identifier layered onto existing share access rather than necessarily replacing opaque tokens.
• public/share.php
• public/view.php
• migrations/0002_document_access_control.sql
• migrations/20260706_add_voice_code_to_shares.sql
The recipient view must enforce both authorization/link validity and document availability. Scheduling is therefore not merely an admin-field concern: it gates content disclosure at the public/recipient-facing boundary.
Persistence and Migration Lifecycle
SQLite is the sole datastore. schema.sql defines the base schema used when reseeding, while ordered SQL files in migrations/ record schema evolution. lib/migrate.php is the migration execution boundary and should track/apply migrations consistently during bootstrap or container initialization. Seed data supplies the fresh local dataset.
• schema.sql
• lib/migrate.php
• seed.php
• migrations/0001_accounts_and_roles.sql
• migrations/0003_document_scheduling.sql
Authentication, Roles, and Auditability
Staff operations are authenticated through the login/logout handlers and account/role schema. Recipient access is link-based and intentionally separate from staff session authentication. Audit records form an operational accountability stream for sensitive mutations and sharing actions.
• public/login.php
• public/logout.php
• migrations/0001_accounts_and_roles.sql
• lib/bootstrap.php
Verification and Delivery
The project’s executable verification is a custom PHP test runner, executed inside the same Compose container/runtime as the app. CI is defined through GitHub Actions and should validate the Docker/PHP-compatible workflow.
• tests/test.php
• .github/workflows/ci.yml
• docker-compose.yml
Main entry points: bootstrap.php Application bootstrap · docker-compose.yml Compose service · migrate.php Migration runner · admin.php Staff control plane
Components 17
Runtime
- Compose service · Runs PHP with SQLite and reseeds the local database.
docker-compose.yml - PHP image
Dockerfile
PHP Application
- Web entry
public/index.php - Staff control plane · Login, administration, authoring, and access-request flows.
public/admin.php - Document authoring · Creates and updates documents.
public/edit.php - Staff authentication · Session login and logout are separate from recipient access.
public/login.php - Share management · Staff creates or manages recipient share links.
public/share.php - Recipient access · Validates a share and enforces document availability before disclosure.
public/view.php - Application bootstrap · Centralizes database access, sessions, authorization, domain helpers, and audit logging.
lib/bootstrap.php - Shared presentation · Provides common HTML framing and styling.
lib/layout.php
Persistence
- SQLite datastore · Stores accounts, documents, access rules, shares, and audit records.
- Base schema · Defines the fresh reseeded database.
schema.sql - Migration runner · Tracks and applies ordered schema evolution.
lib/migrate.php - Schema evolution · Adds roles, ACLs, scheduling, unique titles, and share voice codes.
migrations/0001_accounts_and_roles.sql - Seed dataset · Supplies deterministic local data.
seed.php
Verification
- PHP test runner · Runs inside the Compose PHP runtime.
tests/test.php - GitHub Actions CI
.github/workflows/ci.yml
Connections 21
- Compose service → PHP image: builds
- Compose service → Web entry: serves
- Compose service → Migration runner: initializes with
- Compose service → Seed dataset: reseeds with
- Web entry → Application bootstrap: loads
- Staff control plane → Application bootstrap: uses policy
- Document authoring → Application bootstrap: uses policy
- Staff authentication → Application bootstrap: establishes sessions
- Share management → Application bootstrap: records share activity
- Recipient access → Application bootstrap: validates access
- Staff control plane → Document authoring: manages documents
- Staff control plane → Shared presentation: renders with
- Recipient access → Shared presentation: renders with
- Application bootstrap → SQLite datastore: reads and writes
- Migration runner → Base schema: starts from
- Migration runner → Schema evolution: applies
- Migration runner → SQLite datastore: updates
- Seed dataset → SQLite datastore: populates
- GitHub Actions CI → Compose service: uses runtime
- GitHub Actions CI → PHP test runner: runs
- PHP test runner → Compose service: executes in