Gateway Tech Stack
The DeployStack Gateway is built with a carefully selected set of Node.js packages that prioritize developer experience, security, and performance.
Core Framework
Commander.js
Our CLI framework of choice for building the gateway's command-line interface.
Why Commander?
- Battle-tested by major CLIs (Vue CLI, Create React App)
- Excellent TypeScript support
- Simple yet powerful API
- Extensive documentation and community
Fastify
High-performance HTTP server framework for the proxy server implementation.
Why Fastify?
- Excellent TypeScript support with built-in type definitions
- High performance with low overhead
- Rich plugin ecosystem for middleware
- Built-in JSON schema validation
- Comprehensive logging and error handling
UI and Feedback
Chalk
Terminal string styling for colorful and readable output.
Features:
- Semantic color methods for different message types
- Support for 256 colors and Truecolor
- Auto-detects color support
- Respects NO_COLOR environment variable
Ora
Elegant terminal spinners for long-running operations.
Use Cases:
- Authentication flows
- Configuration syncing
- Process spawning feedback
- Network operations
CLI-Progress
Customizable progress bars for detailed operation feedback.
Features:
- Single and multi-bar support
- Customizable formats and styles
- Ideal for file operations and bulk processing
Interactive Components
Inquirer.js
Interactive command line prompts for user input.
Prompt Types:
- Text input for credentials
- Password input with masking
- Selection lists for configuration options
- Confirmations for destructive operations
Development Tools
TypeScript
Full TypeScript support for type safety and better developer experience.
Benefits:
- Type safety catches errors at compile time
- Better IDE support with autocomplete
- Self-documenting code through types
- Easier refactoring
tsx
Run TypeScript files directly without compilation during development.
Build Tool - tsup
Fast TypeScript bundler powered by esbuild.
Why tsup?
- Lightning fast builds using esbuild
- Zero config with sensible defaults
- Built-in TypeScript support
- Generates CommonJS and ESM outputs
Configuration Example:
export default defineConfig({
entry: ['src/index.ts'],
format: ['cjs'],
target: 'node16',
clean: true,
sourcemap: true,
});
Utility Libraries
File System Operations
fs-extra
Enhanced file system module with promise support and extra methods.
- Includes all standard fs methods
- Adds useful methods like
copy
,remove
,ensureDir
- Promise-based API for cleaner async code
- Essential for team-aware tool caching system
glob
File pattern matching using shell-style wildcards.
- Find files matching patterns like
*.ts
orsrc/**/*.js
- Essential for batch operations
Process Management
execa
Better child process execution for spawning MCP servers.
- Improved error handling
- Promise-based interface
- Better Windows support
- Automatic escaping of arguments
ps-tree
Process tree management for proper cleanup.
- Find all child processes of a parent
- Ensure clean shutdown of spawned MCP servers
Configuration
cosmiconfig
Flexible configuration file loader.
- Searches for config in multiple formats (.json, .yml, .js)
- Supports
.deploystackrc
,deploystack.config.js
, package.json - Follows common patterns used by ESLint, Prettier, etc.
dotenv
Environment variable loading from .env files.
- Load configuration from
.env
files - Support for different environments (.env.local, .env.production)
Security
keytar
Native OS keychain integration for secure credential storage.
- macOS: Keychain Access
- Windows: Credential Manager
- Linux: Secret Service API
- No plain text passwords on disk
crypto-js
Additional encryption for sensitive data.
- AES encryption for config files
- Secure hashing for verification
crypto (Node.js built-in)
Native cryptographic functionality for session management.
- Cryptographically secure random bytes generation
- Session ID generation with 256-bit entropy
- Base64url encoding for URL-safe session identifiers
Networking
axios
Feature-rich HTTP client for cloud API communication.
- Interceptors for auth token injection
- Automatic retry logic
- Request/response transformation
http-proxy
HTTP proxy for routing MCP requests to appropriate servers.
- Route requests based on MCP server name
- Inject authentication headers
- Handle stdio-to-HTTP translation
Testing Stack
vitest
Fast unit testing framework with native TypeScript support.
- Compatible with Jest API
- Built-in TypeScript support
- Extremely fast execution
supertest
HTTP assertion library for testing the proxy server.
- Test HTTP endpoints
- Assert response status, headers, and body
- Works seamlessly with vitest
msw (Mock Service Worker)
API mocking for integration tests.
- Mock cloud API responses
- Test error scenarios
- Intercept HTTP requests
Why This Stack?
1. Developer Experience
- Commander provides intuitive command structure
- Chalk + Ora + CLI-Progress create rich, informative output
- TypeScript ensures type safety and better IDE support
2. Security First
- Keytar integrates with OS keychains (macOS Keychain, Windows Credential Manager, Linux Secret Service)
- Crypto-js for additional encryption layers
- No plain text credential storage
3. Performance
- tsup/esbuild for fast builds
- Minimal dependencies for quick startup
- Lazy loading of heavy operations
4. Cross-Platform
- All packages support Windows, macOS, and Linux
- Platform-specific features handled gracefully
5. Enterprise Ready
- Comprehensive error handling
- Detailed logging capabilities
- Extensible architecture
Installation
All dependencies are managed through npm:
cd services/gateway
npm install
Development Workflow
# Development with hot reload
npm run dev
# Run TypeScript directly
npm run start:dev
# Build for production
npm run build
# Run tests
npm test
Package Selection Criteria
When adding new packages, we consider:
- Security: Regular updates, no known vulnerabilities
- Maintenance: Active development, responsive maintainers
- Size: Minimal impact on CLI startup time
- Compatibility: Works across all target platforms
- TypeScript: First-class TypeScript support preferred
This tech stack provides a solid foundation for building a secure, performant, and user-friendly CLI that meets enterprise requirements while maintaining excellent developer experience.