r/node • u/InvestmentAfter5486 • 3d 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.
0
Upvotes
13
u/HiHungryImDad2 3d ago
zero dependencies is not the flex u think it is.
7
u/Seusoa 3d ago
Sure, but why someone will trust unknown developer who registered in github in 2026?
3
u/zebbadee 3d ago
The word āIā doing a lot of lifting here
1
u/Rechenplaner 2d 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
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.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.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
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.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.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.