Sorry for the long post. I wanted to share with you all my experience on coding with AI, on a self-hosted oss.

This entire post (the link is the source) has been fully written by me without any AI.

The starting idea

I have been playing with self-hosted AI for several months now, as you can see from the dedicated LLM & AI pages in this wiki. After months of messing around with local IA, i can finally say i am quite satisfacted on how my setup turned out, and by how far open models have grown.

So it is time to use this page to summarize my experiments about using AI for software development.

LazyNVR

I have been working for years on and off a custom software to aggregate and access IP video cameras in my house. Existing solutions do not fullfil my requirements and i am an experienced software developer, so why not fix that. Many years ago (2017?) i started developing a simple C++ backend with a Javascrip frontend to collect and show live statics from all my webcams. Over time, this piece of software (called VideoServer) was something i kept for myself tailoring it to my specific needs, and honestly, giving it very little love overall. I only needed it to to it’s job, and it did just that.

Sometime this year, 2026, i decided to give it a good makeover and so LazyNVR was started. It stem from VideoServer source code but i heavily rewrote the C++ backend to make good use of C++17 standard and learn a new (for me) JS framework called AlpineJS. It was cool and it was fun, i decided that it was polished enough for a wider public and so i published it on Codeberg (here) and make a few posts on Lemmy and Reddit about it.

Nobody cared too much, beside one or two users, but i don’t really care as i developed it for myself and use it myself at home.

Meanwhile…

During the same time, i was also experimenting with AI and specifically, coding with AI. I mean local AI, so no Claude Code or other big names out there. At some point, after my Qwen 3.8 37b was running finally fine, the tought come to me to experiment on how it could be used on LazyNVR.

Buckle up for my experience…

The setup & approach

I have not connected AI to my coding workbench. To code i use QtCreator for the backend (C++) and kate for the frontend (Javascript + AlpineJS), and i didn’t care about having direct AI assist, so i skipped that.

My AI setup is OpenWebUI with OpenTerminal, as AI frontend, and llama.cpp as AI backend with Qwen 3.8 27b (UD_Q5_K). Openterminal is running containerized and has access to a nice set of tools like compiler, git, python, headless browser and a few more tools. The setup is perfectly capable to install or develop any additional tools it needs for the tasks i ask it.

I ask to the AI to do stuff, then i review directly using git diff and code editors. I never allow AI to commit or push/pull on the repository itself.

The repository on which the AI works is not my work repository, and it’s only connected (trough remotes) to my private Forjeio instance. I will use this to push/pull changes over to my non IA development environment. Any push to Codeberg only happens from there, and manually by me. The IA does not have access to Codeberg via remote git URL, and doesn’t have my Codeberg credentials either.

Step 1: vibe coding

The first step has been to ask for big stuff. At some point, a user pointed to me that a NVR server should be able to stream RTSP videos, while LazyNVR was only capable to show static stills.

So i opened up my AI and directly asked it “add RTSP support to LazyNVR, for which you have the repository under lazynvr-sources. Find out the best approach and write the code”. It started churming, and being a local AI i have full access to entire train of toughts. It localized the repository, analyzed it, understood the general architecture (FCGI backend, JS frontend, folder structures, how stuff was divided into C++ classes, the works) then got to work. It did a few web searches to get info on RTSP, identified compatibility issues between browser, then did some assessments over which architecture to use and got to write code both on the C++ backend, and the JS frontend.

I don’t like suspance, so here is the first result in short: it didn’t work.

Now, the details. Yeah, it worked.

I mean, it wrote a couple of C++ classes, identified by coding style and the overall architectural approach and fit right in. The coding style was pretty similat to mine, but much more messy so unmistakenly you can understand who wrote which code, me or the AI. The solution it choose was… pretty bad, overnegineered and simply too complex. But it worked! Out of the box, or kind of.

The frontend was a different matter: it also did a good job, even fitting much better in the overall style. Here you cannot see difference between my code and AI code. That probably says a lot on how bad my frontend coding skills are. But… on firefox it didn’t work, and even on Chrome, stuff broke. It also broke some stuff that was working before AI worked on it.

It took about half a day to bake RTSP in, which was pretty impressive, but now how long to have it working?

Step 2: try to debug and fix it

The first issue was that the RTSP manager code AI wrote in C++ was pretty conovluted. On a first glance, classes where neat and methods meaningful. On a more deep investigation, patterns where messed up, code paths uncessarily complex, and it reinvented hot water and the wheel a couple of times, like utilities and code that was already there, but got ignored and rewritten from scratch.

I asked AI to debug it, but not much come out of it. This is my fault probably, because i didnt gave AI the right tools to do it. I should have given AI the URL for a working camera, and probably direct access to the development environment, so that it could actually run all the tests, but i didn’t. Instead, it kep trying to rig up tools for the jobs, starting RTSP servers to create fake streams, and it spent a long time trying to run an NGINX server because it kept hitting some weird port unavailable issues.

After some time, probably a day or two (yeah, i come back to the AI when i had time, to it spent long hours waiting for my inputs) i had some new code that AI assured me fixed the bugs. Well, in some way it did, but still more was not working and some different stuff broke as well.

So i gave up on this approach. Wasted about a week of loose experiments and a few KWh of power (my rig pulls 250w under heavy AI inference).

Lesson learned: do not let AI tackle big changes autonomously. Sloppy code is guaranteed, and you cannot sanely debug that, not even with AI.

Step 3: Identify where AI could be usefull

My next approach was different. I don’t need AI to write my code, not my C++ code at least. I know i can do a good job, but i have a problem: i don’t know shit about RTSP. Zero, nada. That was also an issue in the previous attempt, i could not judge if what the AI was coding was correct or not.

So i changed approach. I asked AI suggestions on how to implement RTSP in a C++ program, and it gave me a few ideas. One, i loved. The idea is not to implement RTSP inside the backend, but to leverage existing tools for the job. So i asked to list possible tools, and AI came with a couple of suggestions. I did my parallel research on those suggestions and decided to go along with go2rtc, which is a very lightweight Go RTSP streaming server capable of already doing everything i needed with very small modifications in LazyNVR backend.

At this point, i decided the backend modification and change of architecture and coded it myself, without AI assistance, i didn’t need it. During this coding, i came across a few bugs of my existing process-execution class utility so i worked with the AI to find out a couple of pretty obscure bugs in my utility class. For example, LazyNVR would start go2rtc itself, but after shutdown, go2rtc would not close. AI helped me find out the reasons, just by reviewing my class code, that i copy-pasted to OpenWebUI. I took the suggestions and actuallt rewrote myself the utility class code, because i didn’t really liked AI approach.

I also asked AI details on go2rtc API and URL schemes, which cut drastically down time needed to implement the go2rtc - LazyNVR communication interface. And AI got it wrong, the URLs where apprently correct but would not work out of the box due to a typo AI hallucitaned about. I have to say, this is the only time AI allucinated over the entire process, and i should have probably formulated my prompt better (search on the web for… instead of just tell me how…).

So far i was impressed. I managed to implement RTSP support blazing fast thanks to the AI initial suggestion, my choice of the tool to use, and AI support in filling the gaps where i would have spent much longer browsing on the web and looking for information. Yeah, every AI output still needs to be checked out and trusted only after testing properly.

Step 4: the frontend

Ok, so the backend was now pretty much shaped up (by me, with AI suggestions) and was working. Now it was time to add RTSP support also on the frontend, and here i decided to give AI a bit more control, since my JS skills are limited, and my brain refuses to spent too much time inside a Javascript file without a headache.

This time i decided to try something different. AI would code it, but under strict instructions and surveillance. So started asking AI very small and limited tasks, focusing on specific instructions and reviewing (with git diff) every step, and testing on my real home instance every step.

At first it was a very simple request: “add theming capabilities: dark and light themes, to the frontend. Do not alter code structure or organization, be as little invasive as possible”. The result was astounding. It added some CSS lines, did some magick i did not even know it was possible, and it worked! Granted, it was not perfect by far: icons visibility was often messed up, a toolbar to change theme was missing and a few more details.

But i pressed on, following the same style: “replace this and that icon because they are not visible on dark theme. Modify that icon with bolder lines because it’s not discerable on light theme” and so on. Step by step, it quickly come into shape. I also asked to add a toolbar: “add a toolbar on top with buttons to selct theme: dark, light, automatic” then asked to move that toolbar to the side, and so on. You get the picture. Every step was tested by me, committed or amended as needed.

Every step i was pushing to my devlelopment entironment, testing it, reviewing the code and learning tons from techniques and approaches i didn’t even knew existed in Javascript (i told you, it’s not my bread…).

Overall, it took me a few days to do, with AI assistance, a work that would have taken me a few weeks instead. And i can still understand and recognize all the written javascript, html and css code. In these tasks, the AI never missed a beat, hallucinated or wrote broken code once.

Lesson learned: AI can code, but you need to give precise instruction and guide the entire process step by step how you want it done. And you still must test and check every step as well!

Step 5: yes, there is more

So what else can AI help me with? But of course, documentation! So here it comes the final round: i asked, in several steps, to study the Makefile (build environment), the command line parameters of LazyNVR, and write a README file (actually, modify the existing one) to document all this. I had also scattered many information previously on Codeberg wiki pages, so for consistency i also asked AI to collect all of that and put it back into the README, everything inside the repository.

All of this worked remarkably well. I preferred to edit some of what AI wrote, it can be a bit too pedantic at times. It also identified more than one typo i wrote, and also a few inconsistencies (LazyNVR or Lazynvr? and such). Funny how i had a contraddictory AI statement (in a place i wrote “no AI was used” and in another place i wrote “AI was used for suggestions”) and AI pointed it out and suggested to add a more detailed statement because both where incorrect. At that point, i manually added the currently visible AI statement at the top of the README because, well, having AI correct me in AI use was kind of annoying.

No, it’s not over. One last thing… I gave AI the real URL of my LazyNVR instance and asked it to take screenshots to show the key UI areas, blur any sensitive information (it was my home after all) and add the screenshots into the README and the repository.

It did all of this pretty well in minutes. I would have taken much longer to do it myself, specially the blurring…

Conclusions

Yeah, within days i shipped so many upgrades both in functionalities and quality of life upgrades that blow my mind. Ok, this was some simple stuff, without significant security implications (LazyNVR must be hosted privately, or using a properly setup reverse proxy with SSO and HTTPS in front of it).

It would have taken be months to do the same amount of work and the frontend quality would have been much worse overall even after months. Maybe the overall look and feel of the UI is not that AI-style because it started from some UI code i wrote manually, or maybe not, i don’t really care.

But you need to learn how to properly use AI, and never become too confidend in accepting it’s reuslts out of the box, it will bite you.

The main risk is delegating to AI what you don’t understand: this is bad practice. Using AI to learn faster something you don’t know, and using it’s output to understand it is a much better approach: you need to maintain the result in any case, and AI doesn’t seems yet good enough at that. You need to maintain full control.

You need to provide specific and detailed instructions to AI, so you need to learn how to do that. But once you do, there is good potential to do stuff faster and, in my case, focus on the parts you like the most (C++, architecture) and be more efficient on the parts you hate the most (JS, CSS, yucks). I do it for fun, afterall. LazyNVR is free both as in beer and speech, written for fun by a single dev, who does it for fun and not to grind trough CSS shenanigans (/rant).

Cost

Using a local AI means i didn’t care for how many tokens i wasted in experiments or reworking. The only cost was elecricity, and no i didn’t measured that. But as i wrote before, my rig uses about 250W while running AI, and i can guess it did run for at least two or three hours for a week / ten days. Let’s say 1KWh per day, for ten days: 10KWh -> more or less 2.5€ at current prices in my country. It’s an excess figure.

Future

I will maybe edit or add to this page later on.

I will fiddle with test cases. I will see which is the best approach to provide LazyNVR with a proper test harness both for the backend and frontend. I will ask AI again, because as well as documentation, testing is not fun, but well worth more experimentation with AI.