DIRECTORY_STRUCTURE - nself-org/cli GitHub Wiki
This document outlines the directory structure for nself v0.3.9, designed for maintainability, modularity, and clear separation of concerns.
nself/
โโโ README.md # Project overview and quick start
โโโ CHANGELOG.md # Version history and release notes
โโโ LICENSE # MIT License
โโโ install.sh # Installation script for system-wide setup
โโโ .gitignore # Git ignore patterns
โโโ bin/ # Executable entry points
โโโ src/ # Source code and implementation
โโโ docs/ # Documentation and guides
src/
โโโ VERSION # Current version (v0.3.9)
โโโ cli/ # Command-line interface implementations
โโโ lib/ # Shared libraries and utilities
โโโ services/ # Service management modules
โโโ templates/ # Configuration and Docker templates
โโโ tools/ # Development and maintenance tools
All command implementations following consistent patterns:
cli/
โโโ nself.sh # Main CLI dispatcher and router
โโโ help.sh # Help system and documentation
โโโ init.sh # Project initialization
โโโ build.sh # Infrastructure generation
โโโ start.sh # Service startup management
โโโ stop.sh # Service shutdown management
โโโ restart.sh # Service restart management
โโโ status.sh # Service status monitoring
โโโ logs.sh # Log viewing and management
โโโ doctor.sh # System diagnostics
โโโ backup.sh # Backup and restore operations
โโโ db.sh # Database operations
โโโ email.sh # Email service configuration
โโโ ssl.sh # SSL certificate management
โโโ urls.sh # Service URL display
โโโ prod.sh # Production configuration
โโโ trust.sh # SSL certificate installation
โโโ validate.sh # Configuration validation
โโโ exec.sh # Container command execution
โโโ scale.sh # Resource scaling management
โโโ metrics.sh # Metrics and monitoring
โโโ clean.sh # Docker cleanup operations
โโโ diff.sh # Configuration difference analysis
โโโ reset.sh # Project reset operations
โโโ rollback.sh # Version rollback management
โโโ monitor.sh # Real-time monitoring
โโโ scaffold.sh # Service scaffolding
โโโ update.sh # nself version updates
โโโ version.sh # Version information
โโโ admin.sh # Admin UI management (v0.3.9)
โโโ search.sh # Search service management (v0.3.9)
โโโ deploy.sh # VPS deployment (v0.3.9)
โโโ wizard/ # Interactive setup wizard (v0.3.9)
โโโ init-wizard.sh # Main wizard controller
โโโ detection.sh # Project framework detection
โโโ prompts.sh # Interactive UI components
โโโ templates.sh # Project template definitions
Reusable functionality organized by purpose:
lib/
โโโ utils/ # Common utilities
โ โโโ display.sh # Output formatting and colors
โ โโโ env.sh # Environment file handling
โ โโโ docker.sh # Docker operations
โ โโโ network.sh # Network utilities
โ โโโ validation.sh # Input validation helpers
โโโ config/ # Configuration management
โ โโโ constants.sh # System constants
โ โโโ smart-defaults.sh # Intelligent default values
โ โโโ validation.sh # Configuration validation
โโโ hooks/ # Command lifecycle hooks
โ โโโ pre-command.sh # Pre-execution hooks
โ โโโ post-command.sh # Post-execution hooks
โโโ ssl/ # SSL certificate management
โ โโโ auto-ssl.sh # Automatic SSL generation
โ โโโ auto-renew.sh # Certificate renewal
โโโ monitoring/ # System monitoring
โ โโโ health.sh # Health check utilities
โ โโโ metrics.sh # Metrics collection
โ โโโ alerts.sh # Alert management
โโโ backup/ # Backup operations
โ โโโ core.sh # Core backup functionality
โ โโโ s3.sh # S3 integration
โโโ deployment/ # Deployment utilities
โ โโโ ssh.sh # SSH deployment helpers
โ โโโ validation.sh # Deployment validation
โโโ wizard/ # Wizard system (v0.3.9)
โโโ environment-manager.sh # Multi-environment management
Service-specific logic and configurations:
services/
โโโ postgres/ # PostgreSQL management
โโโ redis/ # Redis configuration
โโโ minio/ # MinIO object storage
โโโ hasura/ # Hasura GraphQL engine
โโโ auth/ # Authentication service
โโโ nginx/ # Nginx reverse proxy
โโโ docker/ # Docker Compose generation
โโโ monitoring/ # Monitoring stack
Configuration templates and examples:
templates/
โโโ .env.example # Complete environment reference
โโโ docker-compose/ # Docker Compose templates
โโโ nginx/ # Nginx configuration templates
โโโ ssl/ # SSL certificate templates
โโโ certs/ # Pre-generated certificates
โโโ localhost/ # Local development certificates
โโโ nself-org/ # nself.org domain certificates
Comprehensive documentation for users and developers:
docs/
โโโ COMMANDS.md # Complete command reference
โโโ v0.3.9.md # v0.3.9 release notes
โโโ ARCHITECTURE.MD # System architecture overview
โโโ ENVIRONMENT_CONFIGURATION.MD # Environment setup guide
โโโ TROUBLESHOOTING.MD # Common issues and solutions
โโโ API.MD # API documentation
โโโ CHANGELOG.MD # Version history
โโโ ROADMAP.md # Future development plans
โโโ CONTRIBUTING.MD # Contribution guidelines
โโโ RELEASES.MD # Release information
โโโ EXAMPLES.MD # Usage examples
โโโ README.MD # Getting started guide
Simple wrappers for system-wide installation:
bin/
โโโ nself # Main nself command wrapper
โโโ urls # Direct URL display
โโโ [other-commands] # Additional command aliases
- Each command is self-contained in its own file
- Shared functionality is centralized in
lib/ - Clear separation between CLI, logic, and templates
- All commands follow the same structure and patterns
- Consistent naming conventions throughout
- Standardized help and error handling
- New commands can be added easily in
src/cli/ - Service modules are pluggable and independent
- Template system supports customization
- Clear file organization by functionality
- Documented interfaces between modules
- Comprehensive testing structure
- Existing command structure preserved
- New v0.3.9 features are additive
- Legacy functionality remains unchanged
-
Commands:
command-name.sh(kebab-case with .sh extension) -
Libraries:
module-name.sh(descriptive, organized by directory) -
Templates:
template-name.ext(matches target file extension) -
Documentation:
TOPIC.MD(uppercase .MD for main docs, lowercase .md for version-specific)
-
Entry Point:
bin/nselfโsrc/cli/nself.sh -
Command Routing:
nself.shidentifies and sources appropriate command file -
Library Loading: Commands source required libraries from
src/lib/ -
Template Processing: Commands use templates from
src/templates/ -
Service Integration: Commands interact with services via
src/services/
This structure supports nself's evolution from a simple CLI tool to a comprehensive backend platform while maintaining clarity and ease of development.