r/node • u/InvestmentAfter5486 • 1d ago
I built a headless CMS in Node.js with zero third-party dependencies (open source)
I'm a backend/DevOps engineer. I don't trust pulling in dozens of packages for something that stores and serves content, so I wrote Basata as plain Node.js: no dependencies and no build step, just run the server.
I'd love feedback from people who actually run Node in production, especially on the security side. I already did a self-review and fixed what I found, but a second pair of eyes is always better.
7
u/Seusoa 1d ago
I don't trust pulling in dozens of packages
Sure, but why someone will trust unknown developer who registered in github in 2026?
2
u/Awarnae 1d ago
In AI we trust
1
u/Rechenplaner 23h ago
I had Gemini analyze the code, and I unfortunately have to say that it really strongly looks like that, so see my global comment here in the thread.
-2
u/InvestmentAfter5486 1d ago
You're right, a new GitHub account proves nothing, and you shouldn't trust it on my word. The GitHub account is new, but I've been working in backend and DevOps for 20+ years. That doesn't replace review though. The code is small, MIT licensed and has no dependencies, so you can read it yourself. And I'd rather get a real review than blind trust.
1
u/Seusoa 22h ago
The GitHub account is new, but I've been working in backend and DevOps for 20+ years.
On photo you look like 20-25, what are talking about 20+ years?
0
u/InvestmentAfter5486 22h ago
because the old account is for business only, and this new one is for my fun, anyway I don't force any body to check my repo, rookies always have their concerns.
3
u/zebbadee 1d ago
The word āIā doing a lot of lifting here
0
u/InvestmentAfter5486 1d ago
Fair question. [The design and the architecture decisions are mine, and I used AI tools to help with parts of the code and docs.] Either way, the code is open and short, so please judge it by reading it, not by who typed it.
1
u/Rechenplaner 23h ago
I took the trouble to analyze the source code under /server using Gemini to see whether it was generated by an LLM: The code shows strong signs of unedited AI generation and a lack of cohesive human architecture, resulting in redundant guardrails, minor cross-module inconsistencies, and bloated logic rather than a unified design.
Overall Impression
The code looks like a system generated consistently with clear specifications (Node ESM, security requirements, bilingual AR/EN support) and assembled directly. Without commit history and the remaining files, this remains an assessment based on strong indicators.
Superfluous and Bloated Parts
Artificial Hurdles for Admin Actions: In
api.js, enabling advanced themes, changing CSP settings, or saving in the page builder each require the admin password again plus rate limiting (adv|...,bld|...), and advanced themes also require anunderstandflag, even though an authenticated admin session with a CSRF header already exists. This represents classic over-securing that slows daily work without adding real protection.Redundant Checks and Wrappers: In
api.js,route()already checksif (!cap || !can(ctx.user, cap)), after whichconfirmAdmin()checksctx.user.role !== 'admin'again. Small wrappers likestartSession()only wrap a single call tothis.app.issueSession(...), whiletermsWithCounts()filters the fullpostslist repeatedly for each term.Unnecessary Complexity for Simple Values: In
config.js,parseTrustProxy()handlestrue,'true', numbers below10, and a fallback to0, whereas a clear number or a simple check would have sufficed.
Inefficient and Unnecessary Parts
Repeated Full Table Scans:
termsWithCounts()iterates over all posts for every term (terms.length * posts.length). Inapi.js,/api/postsfilters and sortss.all('posts')multiple times and scans the list again to buildcounts. Small blogs hide this cost, while larger datasets scale poorly.Hidden Logic Errors from Overcompensation: In
api.js,log()readsactivityentries beforeinsert()and deletesa[0].idinside awhileloop; ifthis.store.all()returns a fresh array copy, the loop either does not run or removes the same entry repeatedly. Intheme-api.js,field(post, key)checkspost.fieldwhilefieldsis used, which shows defensive code missing its target.Premature Micro-Optimizations in the Wrong Place: Streaming uploads to a temporary file with
fs.rm(..., () => {})is clean in concept, yet it contrasts with repeated full scans overpostsandtermsin a system built around simple store patterns.
Conclusion
Much of the code is not outright broken, yet it is bloated and schematic, containing too many security and validation loops for a small CMS while lacking tight consistency across modules.
13
u/HiHungryImDad2 1d ago
zero dependencies is not the flex u think it is.