nodejs-project-arch
Health Gecti
- License รขโฌโ License: MIT
- Description รขโฌโ Repository has a description
- Active repo รขโฌโ Last push 0 days ago
- Community trust รขโฌโ 21 GitHub stars
Code Uyari
- Code scan incomplete รขโฌโ No supported source files were scanned during light audit
Permissions Gecti
- Permissions รขโฌโ No dangerous permissions requested
Bu listing icin henuz AI raporu yok.
๐๏ธ AI-friendly Node.js project architecture standards. Keep files <400 lines for AI agents. Covers H5 games, data tools, APIs, SDKs. 70-93% token savings. OpenClaw skill.
nodejs-project-arch
Node.js project architecture standards for AI-assisted development.
An OpenClaw / AI agent skill that enforces modular file structures, keeping every file small enough for AI to read and edit without blowing the context window.
โจ Why?
When AI agents work with large single-file codebases, things go wrong fast:
| Scenario | Tokens per read | Context usage (200K) |
|---|---|---|
3000-line server.js |
~40K | 20% |
| 200-line module | ~2.7K | 1.3% |
Result: Splitting files means 10-15 productive rounds before context compression, vs 3-5 with monolithic files. That's 70-93% token savings per file read.
๐ Core Rules
- Single file โค 400 lines /
index.htmlโค 200 lines /server.jsentry โค 100 lines - All tunable values in
config.jsonโ loaded at runtime, editable via admin dashboard - Backend:
routes/by domain,services/for shared logic,db.jsfor database init - Frontend: HTML skeleton only, JS/CSS in separate files under
public/ - Every project gets
admin.html+routes/admin.jsfor config hot-reload + stats
๐ฎ Supported Project Types
| Type | Signals | Reference |
|---|---|---|
| H5 Game | Canvas, Phaser, Matter.js, game loop, sprites | references/game.md |
| Data Tool | Crawler, scraper, scheduler, data sync, analytics | references/tool.md |
| Content/Utility | Generator, library, publisher, file processing | references/tool.md |
| Dashboard/Monitor | Charts, real-time, alerts, metrics | references/tool.md |
| API Service | REST endpoints, middleware, microservice | references/tool.md |
| SDK/Library | Shared module, build step, multi-consumer | references/sdk.md |
๐ Typical Structure
project-name/
server.js โ Entry point, only mounts routes (<100 lines)
config.json โ All tunable values (admin dashboard can edit)
db.js โ Database init + helpers
routes/
auth.js โ Authentication routes
game.js โ Core game/business routes
admin.js โ Admin API (config CRUD, stats)
services/ โ Shared business logic
public/
index.html โ Pure HTML skeleton (<200 lines)
admin.html โ Admin dashboard
css/style.css
js/ โ Split by responsibility, each <400 lines
assets/
๐ Installation
For OpenClaw users
Copy the skill to your agents skill directory:
# Clone and copy
git clone https://github.com/abczsl520/nodejs-project-arch.git
cp -r nodejs-project-arch ~/.agents/skills/
# Or if you have clawhub:
# clawhub install nodejs-project-arch
The skill auto-activates when you ask your AI agent to:
- Create a new Node.js project
- Refactor a large single-file codebase
- Split oversized files
For manual reference
Browse the reference docs directly:
- Game Architecture โ H5 games with Canvas/Phaser
- Tool Architecture โ Data tools, dashboards, API services
- SDK Architecture โ Shared libraries and SDKs
๐ Documentation
Full documentation is available on the Wiki:
- Home โ Overview
- Installation โ Setup guide
- Game Architecture โ H5 game standards
- Tool Architecture โ Non-game project standards
- SDK Architecture โ Library/SDK standards
- Config Pattern โ Universal config.json pattern
- Admin Dashboard โ Admin panel standards
- Token Savings โ Token savings analysis
๐ง Quick Example: config.json Pattern
// server.js โ load and serve config
const config = JSON.parse(fs.readFileSync('./config.json', 'utf8'));
app.get('/api/config', (req, res) => {
const safe = { ...config };
delete safe.admin;
res.json(safe);
});
// Admin hot-reload
app.post('/admin/config', requireAdmin, (req, res) => {
fs.writeFileSync('./config.json.bak', fs.readFileSync('./config.json'));
fs.writeFileSync('./config.json', JSON.stringify(req.body, null, 2));
Object.assign(config, req.body);
res.json({ ok: true });
});
๐ Real-World Token Savings
| Scenario | Before | After | Savings |
|---|---|---|---|
| Read game feature code | ~40K tokens | ~2.7K tokens | 93% |
| One dev round (readโeditโverify) | ~52K tokens | ~4K tokens | 92% |
| 4-round SDK session | ~196K tokens | ~69K tokens | 65% |
| Large data tool module | ~84K tokens | ~8K tokens | 90% |
๐งฌ Part of the project-arch Family
This skill implements the Node.js-specific patterns from project-arch-core โ the language-agnostic architecture principles for AI-assisted development.
| Skill | Language | Status |
|---|---|---|
| project-arch-core | Universal principles | โ Foundation |
| nodejs-project-arch (this) | Node.js / Express | โ Available |
| react-project-arch | React / Vite | โ Available |
| python-project-arch | Python | ๐ฒ Community welcome |
| go-project-arch | Go | ๐ฒ Community welcome |
License
MIT
Yorumlar (0)
Yorum birakmak icin giris yap.
Yorum birakSonuc bulunamadi