I spent years shipping and maintaining products with CodeIgniter 4 and Symfony. Today, Next.js and TypeScript are my default for new applications. I add Supabase, Fly.io, Amazon S3 or Cloudflare R2 where the product calls for them. I wanted a better web experience and a way to run data, file and AI workloads independently. The PHP2Shell advisories in October 2026 brought that decision forward.

In brief

  • I build new web products with Next.js and TypeScript and plan the PWA experience from the start.
  • I stream interactive AI replies and use a durable queue with a worker for long or retryable jobs.
  • I use Supabase for managed Postgres and identity, Fly.io for long-running processes where needed, and S3 or R2 for files.
  • PHP2Shell accelerated the decision. For a live PHP product, patching it and replacing it remain separate decisions.

Why did I move away from PHP?

CodeIgniter 4 gave me a short, readable path from a request to validation and data access. Symfony's components, dependency management and job tooling served me well on larger projects. One habit I carried forward is writing down business rules in terms that make sense beyond the framework. Who may see a document, when it moves to signing, and what happens after cancellation are all product decisions. They survive changes of language or host.

What changed was the number and duration of the operations behind a single action. Someone attaches a file. The product stores it, calls a model, lets another person review the output and sends a notification. When one stage fails, I want the customer to be able to pick up the process at a meaningful point. A recorded state and clear owner for each stage help support trace stalled uploads.

A distributed design can start small. One Next.js application, one Postgres database and object storage suffice for many products. I add a queue and a worker when a task has to outlive the HTTP response. That keeps the initial system easy to reason about while leaving a path to scale document processing on its own when demand grows. The interface remains available during queue maintenance.

Serverless hosting is one part of the choice. A managed runtime can save a small team work on short, stateless requests. I still budget for concurrency, execution deadlines and database connections. A container is often simpler for a long-running job or a process with specific system dependencies. I choose based on how long each action takes, how it uses resources and how the product should recover if it fails.

How did PHP2Shell affect my decision?

On 21 October 2026, the PHP security team released fixes for two critical vulnerabilities in the PHP runtime. CVE-2026-109618 and CVE-2026-109619 could allow remote code execution without authentication. ENISA and CERT-EU issued a joint statement urging users to update. NHS England published a separate alert on 19 November about new PHP security updates covering seven critical vulnerabilities. The international advisories describe exposure and updates.

For me, the incident made the operational work concrete. Do we know which PHP versions and extensions each live application uses? Who takes a patch into production, and which tests run first? If the shared hosting provider controls the runtime version, who checks the version the application is actually running? Finding the answers after an advisory arrives is costly when a small team has several products to look after.

Next.js, Node.js and cloud services have their own security maintenance. In a similar incident today, I would identify the affected components, check what the provider had updated, rebuild the parts we own and run regression tests on critical customer journeys. A managed service can reduce the parts of that process I have to operate directly. Patch ownership, access controls and monitoring still need clear decisions.

Why do I treat a PWA as standard?

A Progressive Web App can be installed on supported devices and can offer useful behaviour in weaker network conditions. I design for mobile browsers, home-screen installation, connection loss and updates when I start a new product. This matters particularly in applications for people on site or travelling between locations, where a connection can disappear mid-task.

Imagine a field worker attaching a photo just as the connection drops. I keep the draft and say that the upload is pending. After reconnection, the app can retry where supported or offer a manual retry. I show completion once the server confirms that the photo has been saved. I also decide in advance what should happen if the same photo is sent twice. That decision matters for both offline usability and data quality.

The manifest describes the app's name, icon, launch URL and presentation. A service worker can implement the offline and caching behaviour I choose. I might cache the app shell, versioned static resources and carefully selected readable content. Customer records and sensitive API responses need their own assessment. When someone signs out or a different user signs in on the same device, ownership of local drafts and pending work must remain clear.

Support for installation, push notifications and background activity varies across devices and browsers. I test installation, offline operation, reconnection and upgrades on real devices. If the product depends on deeper device integration or platform-specific background work, I also consider a native or hybrid app. The ordinary browser experience is still an acceptance criterion across those choices.

How I use Next.js

The App Router lets me organise pages, server-rendered components and HTTP endpoints in one project. For marketing and help pages, I care about crawlable HTML, coherent titles and correct canonical URLs. In an authenticated dashboard, the priorities include authorisation, correct handling of personalised data and responsive interaction. Those two areas get different data and cache policies, in the same repository.

I use client components for forms, drawing, motion and other interactions that need a browser. Server components can read data on the server. Incoming parameters still need validation and authorisation before they reach that data. TypeScript makes shared contracts easier to see and change within the team. I validate data from browsers, webhooks and model responses against a runtime schema

A Route Handler might issue a short-lived upload URL or return an ID for a queued job. It defines the boundary of that HTTP request. Which status transitions are valid and who can trigger them belong to the business logic. Keeping those rules away from HTTP handlers and React components helps me test them directly and compare behaviour before and after migration from PHP.

What does asynchronous architecture bring to AI applications?

For a chat response, I want people to see useful text early. Node.js can make progress elsewhere while it waits for network I/O. Passing the chunks a model emits through an HTTP stream is a good fit for that kind of workload. I measure time to first useful output and completion time separately. I also check whether a client disconnect can cancel the upstream call, as a request that continues unseen can still consume model budget and capacity.

Document extraction and review have a different shape. The result may take longer than a web request can reasonably remain open. I save the file first and record a durable job. A worker retrieves the file, calls the model, validates the output and queues the document for human review if needed. The job can continue with the browser closed. A returning user sees the current status, and support can use the same job ID to follow the events.

How does a document get processed?

Compare where the request ends and where the result is recorded when processing takes longer.

Single HTTP request

  1. Form The browser sends the file.
  2. Application The request stays open for storage and the model call.
  3. Result Success or a timeout appears within that request.

Queue and worker

  1. Upload The app issues a short-lived upload URL.
  2. Queue The upload is verified and the job ID is recorded.
  3. Worker The output is validated and the result is saved.
  4. Dashboard Users can see progress and review the result when ready.

A queue can deliver the same message more than once. I design the job and its side effects to be idempotent. For instance, a repeated delivery can reuse the existing result and skip a second notification. Transient provider failures get a bounded number of retries. A permanent validation failure gets routed for human review. I measure queue delay, retries and the cost of a completed job by model, so I can tell whether better output came at the expense of acceptable latency or cost.

PHP Fibers and asynchronous libraries can support similar patterns. I prefer the TypeScript contracts shared between the browser and services, and the way Node.js handles network-heavy work. CPU-intensive OCR, image conversion and large PDF operations go into a worker, a separate process or Python if that suits the workload.

What do Supabase, Fly.io, Amazon S3 and R2 each do?

I choose Supabase when managed Postgres and identity are both useful. A relational model, versioned schema migrations and SQL give the team familiar tools. Row Level Security lets me express which records a user or workspace can access. I test that two different customers cannot read one another's records. Administrative credentials stay on trusted servers. Before selecting a backup plan, I decide how long a restore may take and how much data loss the product can tolerate.

Fly.io Machines are an option for a long-running worker or a container with specific dependencies. I choose a region after considering where users and the database are. If a worker makes repeated database writes from a distant region, extra round trips can add up. A drive attached to a Machine has local placement constraints. Keeping shared application files in object storage makes scaling out or replacing a Machine easier to operate.

Amazon S3 works well when events from uploaded objects need to trigger AWS services or when a team relies on AWS IAM and lifecycle policies. I consider R2 when a product serves large or frequently downloaded files and outbound transfer drives the bill. R2 does not charge for direct egress to the internet. Storage and operations still cost money, and other services can have their own fees. S3 compatibility lets us reuse SDKs, but I check the precise operations and settings the application relies on before committing.

A browser can upload to object storage with a short-lived presigned URL, saving a hop through the web server. I check the user's permission before issuing the URL. I verify the resulting object key, file size and type before starting the job. Download rights come from the file ID and the user's context as well. The application retains control of the process while the object store handles the bytes.

Technology decisions by layer
LayerMy choiceWhat drives the choice
WebNext.js and TypeScriptCrawlable content, interactive UI and clear request boundaries
Data and identitySupabasePostgres, access policies and recovery targets
Long-running jobsQueue and Fly.io where neededJob duration, process control, region and monitoring
FilesAmazon S3 or Cloudflare R2AWS integration, operation volume, egress and API compatibility

For cloud costs I go beyond the number of gigabytes stored. How often is each document downloaded? Is backup billed separately? How many more calls will a provider outage trigger? What does it cost to keep a worker idle? What changes if the database and file store are in different regions? In a pilot, seeing the total cost per successful job gives me a firmer basis for the architecture than the price list by itself.

How would I migrate an existing PHP application?

First, I identify the journeys that matter to customers and the parts the team struggles to operate. In a document approval portal, signing in, opening a document, making a decision and recording it for audit form a complete journey. I can introduce a new file-processing pipeline alongside that product and have the existing dashboard read the job state. Real traffic exercises the new code while the current sign-in and approval process keep running.

At release time, every record needs an authoritative owner. If both systems write different copies of it, I need a way to detect and reconcile differences. I test identifiers, the data model and the interfaces used by the new flow. A rollback plan needs to say what happens to records written by the new system. Switching off a feature is easy compared with reconciling the data it created while it was on.

I choose the measurements up front. For example, I track the time within which 95% of document jobs finish, the retry rate, errors users see, support volume and cost per completed job. I also watch how long a tested change takes to reach production. A small PHP application with a good user experience and a manageable maintenance cost may be worth patching and retaining until a new requirement makes migration worthwhile.

I know the change has paid off when I can release improvements more readily and see where a job stopped. Moving file storage leaves sign-in intact. Slow model responses leave document viewing available. When the system gives me those boundaries, Next.js, TypeScript and managed services let me put years of PHP experience to work on the parts of the product where it matters.

Frequently asked questions about PHP, Next.js and migration

Have you stopped using PHP entirely?

Next.js and TypeScript are my default for new products. Existing PHP products can still be worth maintaining and improving when they serve the business well.

Can you build a PWA with PHP?

Yes. A manifest and service worker use browser standards, and PHP can still serve the backend.

Does a Next.js app become a PWA automatically?

No. Installation metadata, offline behaviour, updates and any notifications have to be designed and tested on target devices.

When was PHP2Shell disclosed?

PHP released fixes for CVE-2026-109618 and CVE-2026-109619 on 21 October 2026. The 19 November updates were covered in a separate security alert.

Is Node.js suitable for every AI workload?

It suits calls to model APIs and streaming replies. I send heavy CPU tasks to workers or separate processes.

Does serverless still need a worker?

A short request can finish inline. Queues and workers help when jobs are long, retryable or need a durable status.

Why choose Supabase?

It brings managed Postgres and identity together. RLS policies and recovery objectives still need design and testing.

Does Fly.io replace Vercel?

They can serve different purposes in one system. A managed Next.js host can run the web app while Fly.io runs a persistent worker.

Should I choose S3 or R2?

AWS integration or required APIs may favour S3. When downloads drive costs, compare R2 with S3 across storage, operations and transfer.

Does a PHP migration have to happen all at once?

A phased change makes measurement and rollback easier. Start with a bounded workflow.

Is serverless always cheaper?

Cost depends on traffic, execution time, data transfer and the work of operating it. An always-running process can be more predictable under sustained load.

What should I check for SEO after moving to Next.js?

Compare preferred URLs, redirects, canonicals, hreflang, the sitemap and delivered HTML across the old and new versions.

Sources

Related articles