| name | nodejs-fullstack-setup |
| description | Complete Node.js fullstack development assistant. Scaffolds Express.js applications, sets up real-time features with WebSockets, integrates databases, implements authentication, and provides best practices for building production-ready Node.js backends. Specialized for Express + Node.js with proper MVC structure. |
Node.js Fullstack Setup Skill
Expert assistance for building, structuring, and maintaining Node.js fullstack applications with Express.js, real-time features, and production-ready patterns.
When to Use This Skill
Use this skill when the user requests:
- Creating a new Node.js/Express.js project from scratch
- Setting up WebSocket or Socket.io for real-time features
- Implementing authentication with Passport.js or JWT
- Configuring databases (MongoDB, PostgreSQL, MySQL)
- Setting up scheduled jobs with node-cron
- Creating RESTful APIs with Express
- Implementing middleware patterns
- Setting up project structure and architecture
- Configuring build tools and development workflow
- Deploying Node.js applications
Quick Start Workflow
- Scaffold - Use
scaffold_express_app.pyto create project structure - Configure - Set up database connections and environment variables
- Add features - Use scripts to add routes, middleware, models
- Test - Run tests with Jest or Mocha
- Deploy - Follow deployment guide in references
Scripts
scaffold_express_app.py
Creates a complete Express.js application structure with all boilerplate code.
What it creates:
- Express application with MVC structure
- Route handlers and controllers
- Database models (Mongoose or Sequelize)
- Authentication setup (Passport.js or JWT)
- Middleware configuration
- Environment configuration with dotenv
- Testing setup (Jest or Mocha)
- Package.json with dependencies
- Docker and docker-compose files
- README with setup instructions
Command line usage:
# Create minimal Express app
python scripts/scaffold_express_app.py my-app
# Create app with MongoDB
python scripts/scaffold_express_app.py my-app --db mongodb
# Create app with PostgreSQL
python scripts/scaffold_express_app.py my-app --db postgres
# Full-featured app with auth and WebSockets
python scripts/scaffold_express_app.py my-app --db mongodb --auth jwt --websocket
Options:
--db: Database type (mongodb, postgres, mysql, sqlite)--auth: Auth type (passport, jwt, none)--websocket: Include Socket.io setup--typescript: Use TypeScript instead of JavaScript--docker: Include Docker files--eslint: Include ESLint configuration
Output structure:
my-app/
├── src/
│ ├── config/
│ │ ├── database.js
│ │ └── passport.js
│ ├── controllers/
│ │ └── userController.js
│ ├── models/
│ │ └── User.js
│ ├── routes/
│ │ ├── index.js
│ │ └── users.js
│ ├── middleware/
│ │ ├── auth.js
│ │ └── errorHandler.js
│ ├── services/
│ │ └── userService.js
│ └── app.js
├── tests/
│ └── user.test.js
├── .env.example
├── .gitignore
├── package.json
├── README.md
└── server.js
add_route.py
Generates a new route with controller, service, and tests.
Command line usage:
# Add a new resource route
python scripts/add_route.py products
# Add route with CRUD operations
python scripts/add_route.py products --crud
# Add route with authentication
python scripts/add_route.py products --auth
# Add WebSocket route
python scripts/add_route.py notifications --websocket
What it creates:
- Route definition in routes/
- Controller with methods
- Service layer for business logic
- Model if using database
- Test file with example tests
setup_realtime.py
Sets up real-time features with Socket.io or WebSockets.
Command line usage:
# Setup Socket.io
python scripts/setup_realtime.py --type socketio
# Setup native WebSockets
python scripts/setup_realtime.py --type websocket
# Setup with Redis adapter for scaling
python scripts/setup_realtime.py --type socketio --redis
What it creates:
- Socket.io or WebSocket server setup
- Connection manager
- Room/namespace configuration
- Event handlers
- Client-side connection examples
Reference Guides
Architecture Patterns (references/patterns.md)
Best practices for structuring Node.js applications:
- MVC pattern implementation
- Service layer pattern
- Repository pattern for data access
- Middleware patterns
- Error handling strategies
- Real-time communication patterns
- Async/await patterns
Best Practices (references/best_practices.md)
Production-ready Node.js development:
- Security best practices (helmet, rate limiting)
- Performance optimization
- Error handling and logging
- Testing strategies
- Code organization
- Environment configuration
- Deployment considerations
Advanced Topics (references/advanced_topics.md)
Deep dive into advanced features:
- Clustering and worker threads
- Microservices architecture
- Message queues (Bull, RabbitMQ)
- Caching strategies (Redis)
- GraphQL with Apollo Server
- gRPC services
- Performance monitoring
Troubleshooting (references/troubleshooting.md)
Common issues and solutions:
- Database connection problems
- Memory leaks
- Performance bottlenecks
- CORS issues
- Authentication errors
- WebSocket connection problems
Common Workflows
Workflow 1: Create New API
# 1. Scaffold application
python scripts/scaffold_express_app.py my-api --db mongodb --auth jwt
# 2. Navigate to project
cd my-api
# 3. Install dependencies
npm install
# 4. Configure environment
cp .env.example .env
# Edit .env with your settings
# 5. Start development server
npm run dev
# 6. Add new routes as needed
python ../scripts/add_route.py products --crud --auth
Workflow 2: Add Real-time Features
# 1. Setup Socket.io
python scripts/setup_realtime.py --type socketio
# 2. Install dependencies
npm install socket.io
# 3. Start server
npm run dev
# 4. Test with client example
# Open client example in browser
Workflow 3: Add Authentication
# 1. Add auth route
python scripts/add_route.py auth
# 2. Configure Passport or JWT
# Edit src/config/passport.js or jwt.js
# 3. Add auth middleware
# Middleware auto-generated in src/middleware/auth.js
# 4. Protect routes
# Use middleware in routes: router.get('/protected', auth, controller)
Templates
express_app_template.js
Complete Express application boilerplate with best practices
route_template.js
RESTful route with controller and service layer
middleware_template.js
Custom middleware examples
socketio_template.js
Socket.io setup with room management
test_template.js
Jest/Mocha test examples
Decision Trees
Which Database Should I Use?
What type of data?
├─ Documents/JSON → MongoDB
├─ Relational/structured → PostgreSQL
├─ Simple key-value → Redis
└─ Local/embedded → SQLite
Which Auth Strategy?
What type of auth?
├─ Stateless/scalable → JWT
├─ Traditional sessions → Passport.js + sessions
├─ Social login → Passport.js with strategies
└─ API keys → Custom middleware
WebSocket vs Socket.io?
Requirements?
├─ Browser compatibility + fallbacks → Socket.io
├─ Native performance + control → WebSocket
├─ Room/namespace features → Socket.io
└─ Minimal overhead → WebSocket
Integration with Other Skills
- testing-infrastructure: Use for comprehensive testing setup
- git-workflow-automation: Use for commit conventions
- fastapi-backend-builder: Compare Python vs Node.js approaches
Best Practices Summary
Before Starting
- Plan your data model
- Choose appropriate database
- Define authentication strategy
- Consider real-time requirements
During Development
- Use environment variables for config
- Implement proper error handling
- Write tests for business logic
- Use middleware for cross-cutting concerns
- Follow MVC or similar pattern
Before Deployment
- All tests pass
- Environment config documented
- Security headers configured
- Rate limiting implemented
- Logging configured
Example Use Cases
This skill handles queries like:
- "Create a Node.js API with MongoDB"
- "Add Socket.io to my Express app"
- "Set up JWT authentication"
- "Add a new route for products"
- "Configure PostgreSQL with Sequelize"
- "Set up scheduled jobs with node-cron"
- "Add WebSocket support"
- "Create a real-time chat application"
Metrics to Track
Monitor these metrics for your Node.js application:
- Response time - Should be < 200ms for most routes
- Memory usage - Watch for memory leaks
- CPU usage - Optimize hot paths
- Error rate - Track and fix errors
- Active connections - For WebSocket apps