This guide explains how to deploy and customize StackCode for your organization, including setting up private instances and customizing the tool for your specific development workflow.
Self-hosting StackCode provides several benefits for organizations:
- Customization: Tailor templates and workflows to your company's standards
- Security: Keep your development processes within your infrastructure
- Control: Manage updates and features according to your timeline
- Integration: Integrate with internal tools and services
- Compliance: Meet specific regulatory or security requirements
For development and testing purposes:
# Clone the repository
git clone https://github.com/YagoBorba/StackCode.git
cd StackCode
# Install dependencies
npm install
# Build the project
npm run build
# Link for global usage
cd packages/cli
npm linkFor organizations with private NPM registries:
-
Fork the Repository
git clone https://github.com/your-org/StackCode.git cd StackCode -
Customize Package Configuration
// In packages/cli/package.json { "name": "@your-org/stackcode-cli", "publishConfig": { "registry": "https://your-npm-registry.com" } }
-
Build and Publish
npm run build npm publish --registry https://your-npm-registry.com
Create a containerized version for consistent deployments:
# Dockerfile
FROM node:18-alpine
WORKDIR /app
COPY . .
RUN npm install && npm run build
RUN npm link packages/cli
ENTRYPOINT ["stc"]# Build and use
docker build -t your-org/stackcode .
docker run -it your-org/stackcode init-
Add Custom Templates
# Create your organization's templates mkdir packages/core/src/templates/your-org-stack # Add template files with .tpl extension # Use {{variableName}} for replacements
-
Modify Existing Templates
# Edit existing templates in packages/core/src/templates/ # Update package.json dependencies # Modify folder structures
-
Update Type Definitions
// In packages/core/src/types.ts export type SupportedStack = "node-js" | "react" | "your-custom-stack"; // Add your stack
StackCode supports a simple .stackcoderc.json configuration file to set project defaults:
// .stackcoderc.json (in project root)
{
"features": {
"commitValidation": true
}
}This configuration currently supports:
commitValidation: Enable/disable conventional commit validation
Add support for your organization's languages:
# Add new locale files
echo '{"welcome": "Bienvenido"}' > packages/i18n/src/locales/es.json
echo '{"welcome": "Willkommen"}' > packages/i18n/src/locales/de.json- Fork and Review: Always fork the repository and review changes
- Dependency Scanning: Regularly scan dependencies for vulnerabilities
- Access Control: Restrict who can modify templates and configurations
-
Permission Errors
# Fix NPM permissions sudo chown -R $(whoami) ~/.npm npm config set prefix ~/.npm-global
-
Template Not Found
# Verify template location ls packages/core/src/templates/ # Check build output ls packages/core/dist/templates/
-
Build Issues
# Check if templates are properly copied npm run build ls packages/core/dist/templates/ # Verify build output npm test
- Repository forked and customized
- Custom templates created and tested
- Build process completed successfully
- Tests passing
- Documentation updated for customizations
Consider contributing improvements back to the main StackCode project:
- Generic Features: Submit features that benefit all users
- Bug Fixes: Report and fix bugs found during self-hosting
- Documentation: Improve documentation based on your experience
For self-hosting support:
- Community: GitHub Discussions
- Issues: GitHub Issues
- Documentation: Main Documentation
For more information about StackCode architecture and development, see the Architecture Guide.