hm-nodejs-project-structure

Defines module-based folder structure and conventions for Node.js Fastify TypeScript projects.

Updated Apr 26, 2026
One-click install
npx skills add https://github.com/ArkhiMuttaqina/publisher-for-campuss --skill hm-nodejs-project-structure-arkhimuttaqina
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: hm-nodejs-project-structure
Source: https://github.com/ArkhiMuttaqina/publisher-for-campuss/tree/main/skills/hm-nodejs-project-structure
Command: npx skills add https://github.com/ArkhiMuttaqina/publisher-for-campuss --skill hm-nodejs-project-structure-arkhimuttaqina

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Setting up a new Node.js backend often leads to inconsistent folder layouts, unvalidated environment variables, and tangled entry points. This Skill provides a canonical module-based project structure for Fastify + TypeScript so every file has a clear, conventional home. ## Core Features & Use Cases - Canonical Folder Layout: Organizes code by business domain under src/modules/, with shared plugins, hooks, and utilities in src/shared/ and BullMQ workers in src/queues/. - Configuration Standards: Provides a strict tsconfig.json (Node16 modules, path aliases), Zod-validated environment config, and separated buildApp()/start() entry points. - Module Creation Checklist: Gives a step-by-step checklist and sizing guide for adding new modules with controller, service, repository, schema, and route files. - Use Case: When scaffolding a new Fastify API or adding an order module, follow the checklist to generate correctly named files, register the module in app.ts, and validate env config at startup. ## Quick Start Use the hm-nodejs-project-structure skill to scaffold a new Fastify TypeScript project with a module-based folder layout and validated environment configuration.

Frequently Asked Questions about hm-nodejs-project-structure

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure a Node.js Fastify TypeScript project?▼

Organize code by business domain under src/modules/, where each module contains its own controller, service, repository, schema, and route files. Place shared plugins, hooks, and utilities in src/shared/ and BullMQ workers in src/queues/.

How to validate environment variables in Node.js with Zod?▼

Define a Zod schema in src/config/env.ts describing every variable with types and defaults, then call envSchema.parse(process.env) at startup. The app crashes immediately with a clear error if any variable is missing or invalid.

What tsconfig module setting should Node.js projects use?▼

Use module: Node16 with moduleResolution: Node16 for Node.js projects, not commonjs or esnext. Combine with strict: true, target ES2022, and paths aliases without baseUrl, which is deprecated in TypeScript 5.9+.

Why separate app.ts from index.ts in Fastify?▼

Separating the buildApp() factory from the server start lets tests call app.inject() without binding to a port. The index.ts file only handles listening, while app.ts registers plugins, error handlers, and modules.

When should I split a Fastify service into multiple files?▼

Split a service when it exceeds roughly 150 lines of code, dividing by business capability such as order.service.ts and order.fulfillment.service.ts. Controllers over 100 lines split by feature or auth level, and large schemas split by operation.