Depending on: project’s scope, business expectations, your knowledge and Raspberry Pi’s role you can develop software for RPi in mainly three ways:
- Turn Raspberry Pi into API-like webserver with node.js and do all the programming in clients.
- Develop a HTML/CSS/JS application
- Develop an native Raspberry Pi app
All of the above require you to:
- Develop a regular Linux app
- Optimised to use hardware and computing power of Raspberry Pi
- Run it in Raspbian OS or any other Linux distribution of your choice
And, if you really want to get your hands dirty and truly have no limits then you must forget about Linux and start thinking about Ultibo (there’s a separate article for that).
Developing in Ultibo (or similar complete embedded development environment) requires a lot of expertise, development knowledge and practice. And simply isn’t an option for all. Especially, if you only need to build a quick-and-easy app for RapberryPi. For these purposes this article lists details about RPi development.
Building for RPi
You can program your Raspberry Pi in generally three ways:
- Turn Raspberry Pi into API-like webserver with node.js and do all the programming in clients:
- All the logic is in your thin client or clients
- Develop an language and platform of your choice
- I.e. web application in React run in your favourite browser
- Send and receive JSON to/from RPi like you’d with any API server
- Your Raspberry only reads and sets GPIO pins (or other ports) reacting to your API requests
- This way you can control any device connected to GPIO in any way you would like
- Develop a HTML/CSS/JS application:
- You can use Electron (baked by Cordova?), AppJS, Quark, Tauri and many more
- Develop your logic and design just as you’d do with rich web page or web application
- Build it / embed it with an executable header (mostly web view for the OS of your choice)
- Install and run it on Raspbian OS or any other RPi-based Linux distro
- Develop an native Raspberry Pi app:
But… there’s always a Linux in the equation.
Raspbian OS in the background.
Each of above approaches:
- Requires different level of expertise
- Consumes more or less time and thus is or isn’t costly
- Gives some possibilities, but also sometimes hit the wall
- Has less or more strict approach into security of the developed app
As said, each of listed approaches requires you to have any Linux distribution behind your app, acting like an operating system. They can be big or small, but they still are. If that’s a problem for you then a complete embedded development environment like Ultibo seems to be the only option.
Which one should I choose?
I can’t answer that. No one can, except for you.
As said in the introduction, decision must be made depending on:
- Project’s scope
- Business expectations
- Your knowledge and experience and
- Raspberry Pi’s role in particular scenario.
If you truly unsure, but have some spare time (for both learning curve and development) then consider… trying all of them.
What would you do?
In my case, developing an native Raspberry Pi app was out of option for many reasons:
- I don’t have enough hands-on knowledge
- I can build only one platform solution out of single code base
- In most RPi projects I’ve been so far we simply didn’t need the flexibility this approach gives
- And in the same time our budget didn’t allow to hire a professional native Linux apps’ developer
Because I am an API and multi-platform fascist, in all Raspberry Pi-based projects that I recall so far (and actually in all development projects, I’ve been in since 2015) we used second approach:
- We had some API server, written by ourselves in PHP or someone else in Java or Node.js
- We were building a HTML/CSS/JS application from the same base as views for webpage
- Out of single codebase we could build: web page or web app, mobile application and RPi application
- Because of the same API server and single codebase the exchanged data was the same in all scenarios
But, I can easily think about many scenarios that uses first approach — i.e. turning Raspberry Pi into API server itself and doing all the logic in thin clients.