Me as an illustration

Hi, I’m Iva.

I build apps for iPhone, iPad and Mac, and work on the Nextcloud desktop client. These are my notes.

October 26, 2026 · 15 min read

Rewriting Nextcloud in Rust

People on social media keep calling for Nextcloud to be rewritten in Rust or Go because of PHP, not just since PHP2Shell. With this post, I want to explain why I think such a rewrite would break a lot more than it fixes.

Discussions on social media regularly put PHP in Nextcloud on trial. Somebody complains about a slow user interface, somebody else replies that this is what you get with PHP, and a third person concludes that the whole thing should be rewritten in Rust. Or Go. Or whatever.

I have about ten years of professional experience with the LAMP stack (Linux, Apache, MySQL and PHP). Admittedly, that experience ended almost ten years ago. Nowadays I work at Nextcloud GmbH, mostly on the desktop client, which does not involve PHP at all. So I obviously have skin in the Nextcloud game, but not in the PHP one.

I do have a strong feeling that many of these comments underestimate what such a rewrite would involve, and that not all of them come from people who have worked with PHP, Rust or Go. Yet they still focus on technical details with tunnel vision. But there is much more to a project like Nextcloud than that.

Let us do the thought experiment, without a proof of concept but also without any hand-waving. I will try to keep it high-level and understandable.

Me as an Emoji

PHP Has Grown Up

A lot of the hate for PHP stems from the PHP 4 and PHP 5 days, when it was easy to write terrible code and many people did. I totally get the resentment. I know that pain firsthand. Years ago, I often sat in front of a screen in despair, my face in my hands, staring at legacy spaghetti code written in PHP 4. I still remember the CEO of another company I once worked at loudly cursing at PHP. Looking back now, I have a purely pragmatic view of PHP.

A lot has happened since then. Modern PHP has type declarations, enums, readonly properties, attributes and a just-in-time compiler. Plenty of language features now help hold a codebase to a much higher standard.

The current Nextcloud 35 requires at least PHP 8.3, and the codebase is checked by the static analysis tool Psalm on every change. You can still dislike the language, of course. But “PHP is bad” on its own is a matter of taste, and it says nothing about what a rewrite would cost.

Nextcloud Is a Platform

The Nextcloud server is basically a host for apps. Files, Talk, Calendar, Deck, Mail and even the App Store user interface are apps running on it. The server alone has roughly 280,000 lines of PHP code, not counting comments, tests and third-party libraries. The small subset of 21 app repositories I have cloned locally, among them Talk, Mail, Deck and Calendar, adds about 250,000 more. And the Nextcloud App Store lists almost 900 apps at the time of writing, most of them made by the community. Roughly half of them have a release for the current Nextcloud 35.

An app is a folder with PHP source code, a manifest and usually some JavaScript for the user interface. When an administrator clicks “Download and enable” in the App Store, the server downloads a signed archive, verifies the signature, unpacks it into the apps folder and enables it. That is it. Nothing gets compiled, and usually the server does not even need a restart. For a typical app, the very same archive works on a Raspberry Pi and on a high-availability cluster with half a dozen redundant application servers.

On every request, the server registers all enabled apps in the same process and loads whatever the request needs. They share the database connection, the user session and the file system with the server and with each other. Apps can react to events and even change what is about to happen, like modifying a share before it gets created. Some apps build directly on classes of other apps or on internal server classes. This tight integration is what makes the Nextcloud app ecosystem so capable, and a rewrite would throw it away.

Every App Breaks

A server written in Rust cannot run PHP code on its own. So every single one of those apps would simply stop working. The PHP backends of Talk, Deck, Calendar, Mail, Team Folders and all the community apps would have to be rewritten from scratch.

Now, people who know their way around both languages might point out, rightfully, that Rust and PHP can talk to each other. With ext-php-rs you can write PHP extensions in Rust, and FrankenPHP shows that a server written in a compiled language like Go can embed the PHP interpreter. The catch is that PHP stays in the stack in both cases. To run the existing apps in a Rust server, you would have to embed a complete PHP interpreter and build a bridge from Rust to PHP for every part of the public programming interface the apps rely on. That interface alone consists of about 1,100 PHP files. At that point, you have built a PHP server with extra steps. Replacing PHP piece by piece over many years could work, and Nextcloud is doing a bit of that, as you will see below. But that is not the clean rewrite these comments ask for.

App developers already have to keep up with interface changes with every major Nextcloud release. That usually means a few adjustments here and there. A language switch means starting over, and many community apps are hobby projects maintained by a single person in their spare time. It is unrealistic to expect all of these maintainers to learn Rust. Letting coding agents do the port is debatable, and rightly so. I doubt many maintainers would make the jump.

No More One-Click Apps

But okay, let us assume all apps get rewritten in Rust anyway. The next problem is how to install them.

PHP compiles source code on the fly when it is first needed, so dropping new source files into a folder is all it takes. Rust code is compiled ahead of time into machine code for one specific operating system and processor. On top of that, Rust deliberately does not promise a stable binary interface between separately compiled pieces of Rust code. This means a compiled app would have to be built for every platform Nextcloud runs on, at the very least Linux on x86 and on ARM processors. And unless everything is squeezed through a plain C-style interface, it would also have to be built with the same compiler version as the server and rebuilt for every server update.

Well, there are ways around this. Apps could be compiled to WebAssembly, a portable format that runs on any processor, and run in a sandbox, as the extensions of the Zed editor do. That even has an advantage: sandboxed apps could only do what the server explicitly allows them to, while PHP apps can mess with anything. But everything an app is allowed to do would have to be designed up front as an explicit interface, and nothing could be shared directly anymore. Or apps could be compiled right into the server, the way the Go web server Caddy handles its plugins, which means a custom server build for every combination of apps. Or apps could run as separate processes talking to the server over HTTP. Nextcloud already supports that with AppAPI, which runs apps written in other languages, typically as Docker containers. There are 28 of those in the App Store so far, compared to almost 900 classic apps, though AppAPI is only a few years old. In practice, they need Docker, and they cannot hook into the server as deeply as a PHP app can.

So a Rust server could have apps, too. But what makes the App Store so convenient today would be gone: one archive that works on any machine and plugs right into the server. The few apps that do bundle native programs show what that looks like: the Built-in CODE Server comes as two separate apps for x86 and ARM processors.

Shared Hosting Drops Out

Today, you can rent cheap web space, upload a single PHP file via FTP and open it in your browser, and the web installer takes care of the rest. Background jobs can be triggered by page visits, and updates can be installed through the browser.

Shared hosting is built around this model. The hosting provider runs the web server and the PHP processes, and you just bring your PHP files. What you are usually not allowed to do is run your own long-running programs or open your own network ports. But that is how a Rust web server typically operates: as a program that runs all the time, listens on a port and sits behind a reverse proxy, another web server that forwards requests to it.

I have no idea how many Nextcloud instances run on shared hosting, and as far as I know, nobody does. The official installation method nowadays is the Docker-based All-in-One, and for people running Docker or their own server, a single Rust binary might even be easier to deploy. Some Nextcloud components, like Client Push, the Talk signaling server or AppAPI apps, need more than plain web space anyway. Either way, a rewrite would turn a documented way of running Nextcloud into one that practically does not work anymore. Those hit the hardest would be the people with the fewest technical options, which I find rather unfair.

Me as an Emoji

PHP Is Rarely the Bottleneck

Performance is the argument I hear the most, and sure, Rust code runs faster and uses less memory than PHP code. PHP also has a real structural cost: in the classic setup, every request boots the server again, including all enabled apps. Nextcloud 35 already contains experimental support for FrankenPHP’s worker mode to chip away at that, even though it is not ready for production yet.

But where does the time actually go when you wait for a folder to load? As far as I know, most of it goes into database queries, storage backends like S3 or SMB, file locking and network round trips. The heavy lifting for thumbnails, video previews and office documents is already done by native libraries and programs like GD, ImageMagick, FFmpeg or Collabora Online. The server tuning recommendations reflect that and talk about caching, database tuning and background jobs. Nextcloud’s own recent wins with the ADA engine came from the same place: 60% faster loading of shared folders and two to ten times faster thumbnails through smarter data access.

Where PHP’s model really does not fit, Nextcloud already uses compiled languages. Client Push is written in Rust, the signaling server for Talk in Go, and even the ADA engine, a rewrite of the file access layer, is “written in PHP, Go and Rust”. So Nextcloud already uses other languages where it makes sense.

Apart from that boot cost, I doubt you would notice much of a difference where you are waiting today.

Me as an Emoji

Security Bugs Are Mostly Logic Bugs

Rust’s main selling point is memory safety: outside of code explicitly marked as unsafe, it rules out bugs where a program reads or writes memory it should not touch. That is a big deal for C and C++, where Microsoft found that around 70% of its security vulnerabilities are of this kind. PHP, like Python or Java, does not make you manage memory by hand in the first place. The PHP interpreter itself is written in C, though, and just this week PHP2Shell reminded all of us of that. Two critical bugs in PHP’s memory handling let attackers run their own code on PHP web servers, Nextcloud included, without logging in. Fair point for Rust, I admit.

It is just not where Nextcloud’s own security issues come from. None of the 283 security advisories Nextcloud has published since 2021 is a memory corruption bug. By far the most common category is broken access control: somebody could see or do something they should not. You can write that bug in Rust, too. The OWASP Top 10 agrees: broken access control is number one, and memory management failures did not make the list, since web applications dominate its data.

Then there is the rest of the stack: web server, TLS, database, often Redis, the operating system and native libraries for previews. And there are humans who skip updates, pick weak passwords or leave data directories reachable. Even PHP2Shell is only fixed on servers where somebody has actually installed the patched PHP version. A Rust core would change hardly any of that.

Also, a rewrite is brand-new code, and Google found that vulnerabilities are concentrated in new code. Their answer is to write new code in memory-safe languages and leave the old code as it is. Sure, Rust’s strict type system would get rid of some PHP-specific pitfalls. Though, I would not call swapping a mature codebase for a fresh one a security upgrade by default.

ownCloud Already Tried This

ownCloud, the project Nextcloud was forked from in 2016, started rewriting its PHP server in Go a few years later and named the result ownCloud Infinite Scale. It became a separate product you migrate to instead of an update, and the classic PHP apps did not come along. The PHP version is still alive, too: ownCloud Server 11 came out in July 2026. I do not want to judge Infinite Scale here, because starting fresh can be a perfectly valid decision. But ownCloud’s case does show that a rewrite gives you a different product rather than a faster version of the old one. Joel Spolsky wrote back in 2000 about what gets lost when you throw away a working codebase in Things You Should Never Do, Part I, and I agree with him.

Code Is Cheap, Community Is Not

Coding agents have made all of this a bit more interesting lately. By now, everybody with a coding agent subscription can build a basic Nextcloud server replacement in whatever technology they fancy. Code got really cheap, and I would not be surprised if somebody is doing that right now. Nextcloud GmbH is well aware of that and is acting on it.

But all you get out of such an effort is code. All those apps and the people maintaining them do not come with it, and neither do the volunteers translating the user interface into more than 50 languages, like the ones I wrote about in German Nextcloud Localizations. The same goes for the admins who know how to run it, the hosting providers offering it, years of answered questions in the forum, the security researchers reporting issues and the organizations that trust it with their data. Neither a rewrite in a hyped technology stack nor a coding agent can copy a community and an ecosystem that grew over more than a decade.

Me as an Emoji

This is the point I want to stress the most. To me, the community and the ecosystem are the biggest asset Nextcloud has, for the project as well as for the business behind it. Anybody can copy the code since it is open source, but the people do not come along with a fork.

Losing them is the biggest risk, if you ask me. If you think about it, nearly every problem above ends up hitting people. App developers have to start over or give up, shared hosting users and providers are left behind, admins have to relearn what they know and security researchers start from zero. A rewrite would put at risk the one thing that cannot be rebuilt, in exchange for code that might be faster and safer but keeps getting cheaper to write. To me, that is simply a bad deal.

People Depend on Nextcloud

The app ecosystem does not end with the App Store either. Universities and entire university networks, enterprises and public-sector institutions run Nextcloud, and some of them even have invested in their own server apps written in PHP. Those apps connect Nextcloud to their identity management, their campus or business systems and the rest of their in-house stack. Most of them never show up in the App Store, so nobody outside these organizations even knows how many there are. A rewrite would force every one of these organizations to rewrite their own apps, too, whether they want to or not, with their own budgets, procurement processes and staff. That is a huge cost nobody could avoid. And as far as I can tell, these organizations are where most people use Nextcloud today. The typical Nextcloud user nowadays is a student, an employee or a civil servant who simply wants to get their work done, and much less a homelabber tinkering on weekends.

There is also a more personal side to this. Nextcloud is not some tinkerer’s fun side project on GitHub that can pull off rewrite stunts without potentially devastating consequences for people and organizations in real life. The company behind it has grown considerably, and a lot of people rely on it to pay their bills and provide for their families, including mine. Ideas like a complete rewrite have to be weighed with that in mind. What would be a fun experiment for a hobby project can be an existential risk for a company and everybody depending on it, be it employees, customers or partners. So when Nextcloud GmbH is careful with ideas like this instead of jumping on the latest hype, I call that responsible.

Favorite Frameworks Are Not an Architecture

What bugs me most is that many of these comments read like a personal list of favorite frameworks. Backend in this, frontend in that, mobile apps in something else, and everything would be perfect. Nice wish list, though. In my experience, the hard part is more than fifteen years of decisions, edge cases, migrations, integrations and an ecosystem of people who built their apps on top of all that. These comments hardly ever mention what problem the rewrite would actually solve, who would port hundreds of apps or how existing installations would be migrated.

Me as an Emoji

Do not get me wrong: I have favorite tools, too. I am not against rewrites from scratch myself. I would love to see more Swift everywhere, and I have thought about native Nextcloud clients. But I would not suggest rewriting someone else’s project in Swift without being able to answer those questions.

If you love Rust or Go, there are good ways to put that love to use in the Nextcloud world. Client Push is written in Rust, the Talk signaling server in Go, and both are open source. AppAPI lets you write the backend of an app in any language you like, Rust included. And if Nextcloud is slow for you, a bug report with concrete measurements, slow queries or a profile helps far more than another “rewrite it in Rust” comment.

Me as an Emoji