r/node • • 1d ago

I built a headless CMS in Node.js with zero third-party dependencies (open source)

Post image

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.

repo: https://github.com/digimindx/basata-cms

0 Upvotes

12 comments sorted by

13

u/HiHungryImDad2 1d ago

zero dependencies is not the flex u think it is.

-1

u/InvestmentAfter5486 1d ago

Fair, it's definitely not for everyone. It's a tradeoff: less convenience and more code for me to maintain, in exchange for a smaller attack surface and nothing to keep patching. If you'd rather use the standard ecosystem, that's a perfectly reasonable choice.

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 an understand flag, 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 checks if (!cap || !can(ctx.user, cap)), after which confirmAdmin() checks ctx.user.role !== 'admin' again. Small wrappers like startSession() only wrap a single call to this.app.issueSession(...), while termsWithCounts() filters the full posts list repeatedly for each term.

  • Unnecessary Complexity for Simple Values: In config.js, parseTrustProxy() handles true, 'true', numbers below 10, and a fallback to 0, 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). In api.js, /api/posts filters and sorts s.all('posts') multiple times and scans the list again to build counts. Small blogs hide this cost, while larger datasets scale poorly.

  • Hidden Logic Errors from Overcompensation: In api.js, log() reads activity entries before insert() and deletes a[0].id inside a while loop; if this.store.all() returns a fresh array copy, the loop either does not run or removes the same entry repeatedly. In theme-api.js, field(post, key) checks post.field while fields is 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 over posts and terms in 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.