Which framework to use? Blazor? Razor? Very non-standard project for Raspberry Pi

evilC 0 Reputation points
2025-12-12T13:11:48.3633333+00:00

The project:

Hardware

A flexible LED matrix (Display) mounted to a T-Shirt. Displays animations (Gifs), images etc. Rotates through a playlist.

The LED matrix is connected to a Raspberry Pi Zero 2 W and driven via GPIO (It's not an HDMI type display, this is electronics type stuff)

The RPi will have some buttons connected to it via GPIO pins on the Pi to trigger "quick actions" - (eg flash up "Hello!" on the display, temporarily disable the screen etc)

Software

Server (The Rpi)

Images / animations are displayed on the screen via a shell command - eg show-file myfile.gif

The server maintains a list of media to be played, the order to play it in, and what each button is assigned to do

Must run a minimal (Terminal only) version of Linux (ideally DietPi). A Gui OS messes with the LED Matrix too much and is not feasible.

Client

There needs a UI to control and configure the whole system. In the field, I may want to enable and disable some images and animations on the fly. At home, I need a UI to upload new media.

The whole system should not need the client to be connected at all for the Rpi to continue displaying stuff

So I am thinking a Web UI makes sense. When out in the field, I will access it via an Android Phone (The RPi will run a WiFi hotspot for the phone to connect to). At home, while developing or configuring the system, this will be a web browser on my PC.

There will be actions happening on the server that I need to represent on the client - for example, on the client I wish to show the state of the system - which file is currently playing, whether a "quick action" (Button triggered state) is currently active etc, so ideally there needs to be a "push" from the server to the client (This is not a hard requirement tho)

Dev environment

I wish to develop on a Windows PC, and use VS Code or Visual Studio to write code in. I wish to be able to hit F5 to debug, and the code executes on the Pi and allows me to debug on the PC.

I have made some good progress here. It ain't hugely pretty, but I have it so that I can hit F5 in VS Code and be debugging code on the Pi within seconds. Certainly the server-side stuff. Not so sure about how I would handle the client-side stuff yet.

What I would like help with

I have spent over a week getting to grips with the dev environment and writing a few bits of code to POC various aspects (Showing stuff on the screen and detecting button input on the Pi)

I have also spent a fair of time agonizing over what the exact software architecture I will use - about the only thing I am sure of at this point is that I would like as much of it as possible to be C#, with probably a bit of JS / HTML / CSS etc thrown in.

I am starting to narrow it down to a couple of contenders, but I am pretty new to this kind of stuff, so the choices are a little confusing and overwhelming, and seeing as it's likely to be a long project, I don't want to waste even more time going down a rabbit hole that ends up not panning out.

At the moment I am thinking of one of the following options:

  1. Blazor server
    As far as I can tell, this would mean that everything is effectively server-side, even the client.
    Which would make debugging easy?
    Not wholly sure if this supports eg SignalIR so the server can "push" updates to the client
  2. Blazor Hybrid (WebAssembly for the client)
    I did some sample code for this, but it looks like I can't debug the client.
    Also SignalIR (Server push to client) is defo supported.
    I have also encountered some jankiness with accessing the WebAssembly page from the phone, so not really liking this option at the moment
  3. Rest API for the server and a plain old web page for the client.
    I am thinking to probably two separate projects in this case. I can debug the server via one instance of VS Code, and have a 2nd copy of VS Code for the client (The web app could maybe even run on my windows PC instead of on the Pi?)
  4. Razor
    Not sure I will be able to interactively debug the client like I could with (3)
    I think server push via SignalIR is possible?

As far as I can tell, this would mean that everything is effectively server-side, even the client. Which would make debugging easy?

If you have got this far, I appreciate your time - if you have any suggestions, I would love to hear them!

Developer technologies | ASP.NET | ASP.NET Core
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Q&A Assist
    2025-12-12T13:12:20.74+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    For your project involving a Raspberry Pi and a flexible LED matrix, both Blazor and Razor can be viable options, but they serve different purposes and come with distinct benefits and limitations.

    1. Blazor Server: This option allows you to build a web UI where the rendering happens on the server. It can simplify debugging since the client-side logic is executed on the server. Blazor Server also supports SignalR, enabling real-time communication between the server and client, which is beneficial for your requirement to show the current state of the system and push updates to the client.
    2. Blazor Hybrid (WebAssembly): This approach allows you to run .NET code directly in the browser using WebAssembly. It supports SignalR for server push capabilities. However, you've mentioned encountering issues with debugging the client side and some jankiness when accessing the WebAssembly page from a phone. If these issues persist, it may not be the best fit for your project.
    3. REST API with a Plain Web Page: This option involves creating a separate server-side application (potentially using ASP.NET Core) that serves a REST API, while the client could be a simple HTML/CSS/JavaScript web page. This setup allows for clear separation of concerns and can be debugged independently. You can run the client on your Windows PC while developing, which may streamline your workflow.
    4. Razor Pages: This framework is a server-side web application framework that can also utilize SignalR for real-time updates. It allows for easy debugging since the logic is server-side, similar to Blazor Server. However, it may not provide the same level of interactivity as Blazor or a SPA approach.

    Given your requirements and the need for real-time updates, Blazor Server seems to be the most suitable option. It provides a good balance of ease of debugging, real-time capabilities with SignalR, and the ability to maintain a server-side architecture. If you find that you need more client-side interactivity later, you can consider transitioning to a Blazor Hybrid or REST API approach.

    Ultimately, the choice may depend on your comfort level with each technology and the specific needs of your project as it evolves.

    0 comments No comments

  2. Bruce (SqlWork.com) 82,061 Reputation points Volunteer Moderator
    2025-12-12T18:35:07+00:00

    as this is private app, I think Blazor server is the best choice. This will be the easiest for you to code. It uses signal/r to talk to the client, so the server can deliver realtime updates.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.