I wanted to check in as I’m thinking of developing an application for NextCloud and get advice or best practices on things to consider. I’ve heard that if you create an application, you should use the Nextcloud code template, which is composed of PHP code? It’s like a scaffold, is this a must?
What if I develop my application in Vue.js? Does it have to be in PHP? And the application that is developed, should it be more like a package installation, or can it be an external site that works with NextCloud?
I’ve read that NextCloud is resource-heavy from the forums here. Is this something I need to consider in development to optimise for performance of the application?
There is also a talk instance, that might be feasible from time to time: Beginner (low volume) and Community.
Yes, it is a scaffold. Basically what you get when creating a new boilerplate in the app store is build from the raw template prefilled with some information (like the name of your app etc).
You are not obliged to use it. But it is very convenient and has most of the important stuff on board. As you get a minimal working app, you can quickly get an idea where what should be put.
The generated boilerplate contains different aspects of code:
Manifest that tells the NC server what this app is about and stuff (so meta data in fact).
PHP implementation
Frontend (typically done in Vue)
Scripts and configuration for various tools (NPM, Prettier, NVM, php-cs-fixer, …)
GitHub automations to check your code upon pushing to GH
A default license (be careful about this as it is sort of fixed)
Well, you need both. NC uses PHP for the backend part (that is the part that runs in the server) and by default uses Vue in the frontend since a few years now. So, you can build most of your app on Vue (e.g. if the app is mainly frontend and visual) and only have a minimalisic stub in the backend that just serves the frontend code to the user.
Since ~1 year there is the option to create ExApps. That are container-based (mainly backend) apps and thus can be written in any language a docker container can use (aka all ).
An app is sort of a plugin into the NC server. So, the server provides the frame for a page (think of the top navigation headline) and also does some basic stuff for you as a plugin/app dev (e.g. check the authentication/allow authorization of the users).
How would external sites match into this framework?
Well… That depends on what you mean.
PHP is said to be slow in any case (in the past yes, nowadays this is not so much of a problem anymore).
Depending on the number of installed/enabled apps, the NC server core needs to do quite some stuff on every request. So, best to not overload the boot process with whatever bloat you might have in mind.
The frontend feels slow from time to time as the Vue frontend must be loaded first. So, the page appears, seems to stall and then shows the actual site. So, keep the bundles small.
Optimizing your own app is always a good thing. E.g. try not to calculate a expensive value thousands of time. In general, you might know that NP-hard problems are not to be solved in a HTTP request.
Do not over-optimize: You can optimize all and everything rendering it unreadable and unmaintainable. If there are issues with performance, do an actual performance scan (with a profiler) and check the results. Not the other way around hoping to see the bottlenecks.
Generally, I would say that there is no performance problem with NC in general. Individual apps might have problems and do nasty stuff, yeah. But this is not omni-present.
One last thing I want to give you along the way: Get yourself a good development environment ready to use. I personally use Julius setup, which is quite awsome. I’d advice against doing remote development.
If you have any more question, feel free to ask them. I will be away next week but I typically try to give all questions a good look. I hope, you find what you need to get going and wish you happy coding!
I want to build the backend with Python. I’ve heard there is a new Nextcloud’s new AppAPI ecosystem (ExApp) Which can be considered more languages, including Python?
Would you still recommend using PHP app ecosystem?
I am trying to maintain a low complexity approach. Is it optional to use the template? What if you create your selection framework, would it still work?
What does a default licence entail?
This Julius setup you shared is an agnostic Nextcloud development environment?, meaning it works for any type of application you develop for NextCloud? What did you mean by doing remote development? Can you elaborate?
Anything you can put in a container can be run as ExApp. So, yeah, you have some overhead to build the containers but this is not a big deal and then you can use Python code to interact with NC.
The core in itself is still in PHP. There were recent discussions (about go and rust if I remember correctly) but NC will be using PHP for the near future at least.
You might need a small amount of PHP to initialize the frontend of your app but this can be covered by the boilerplate without actual coding.
You can start as you see fit. The scaffold (boilerplate) code generated by the app store is just a starting point to get you going. You could start from scratch but this will be more work I am pretty sure.
What do you mean by selection framework?
It is AGPL [1, 2]. The boilerplate is under AGPL as well and if you intend to publish to the app store, you must be compatible to AGPL as well.
Technically, it is a tweaked local NC server installation that you can use to run (and thus test) your app with. The modifications entail things like a local fake mail server (to debug mail issues), a debugger and profiler for PHP and other similar stuff. So, yes, it is a development-oriented installation that you can use as you like and with whatever app(s) you do so.
You could theoretically rent a server somewhere on the internet, install NC there and use that to run/debug/deploy your self-written app. Most IDE support remote access by SSH protocol, so it looks like you are working locally while in fact you put everything on the big WWW. Do not do that.
While still in heavy development, you should keep your work protected as there might be security flaws in your code that quickly get dirty.
Nextcloud has an app store that is similar to the Play Store? The thing is, we are supposed to use the boilerplate, isn’t that correct, so we must adhere to AGPL because of the use of the template? What I meant by selection framework was just completely using my stack and language
Also, when we release a plugin, I was wondering, generally it could be a plugin for download in NC, but should it be a product that leads to an external site?
Could you tell me why someone would use remote development? This sounds quite esoteric to me. I’m sure there must be a reason for it, perhaps security? I just use a regular IDE locally.
Btw random outside question, do you know any good online text editor for python?
Perfectly fine. Just stick with it.
I just got some requests on the forum here.
NC apps is the name for plugins into the server. So, ExApps are a special form of apps. The app store is publishing all apps you can install inside the NC server. This is not about mobile apps.
As I said: You can do as you like. If you want to use the template, you are bound to AGPL or compatible. If not, fair enough, you can do as you like. Use your stack, but you need to provide the complete boilerplate stuff yourself.
Unfortunately, the documentation is not working at the moment but I am pretty sure that in order to publish your app to the NC app store, you have to be AGPL compatible.
If you publish it by other means, I am honestly unsure about the implications as the server is AGPL as well and thus might poisen your app. But this is too much into license laws for me to give good advice.
Again, you lost me.
You mean to link an external site in NC navigation? There is already the app External Sites.
Maybe you should explain, what you want to achieve.
I am not very fluent there. I know of codespaces and of an online VS code. I do not like either, personally.