frontal-cli
v0.1.2
Published
Frontal CLI
Downloads
32
Readme
Frontal CLI
The official command-line interface for Frontal.
Quick Start
Installation
# Install globally
npm install -g frontal-cli
# Or use with bun
bun install frontal-cli
# Or install with Homebrew
brew tap frontal-labs/cli
brew install frontal-cliAuthentication
# Login to your Frontal account
frontal auth login
# This will open a browser for authentication
# or provide an API key optionBasic Usage
# List all available commands
frontal --help
# Check current configuration
frontal config show
# Deploy a project
frontal deploy
# List your projects
frontal projects listCommands
Authentication
frontal auth login # Login to Frontal
frontal auth logout # Logout from current session
frontal auth status # Check authentication status
frontal auth whoami # Show current user infoProjects
frontal projects list # List all projects
frontal projects create # Create a new project
frontal projects info # Show project details
frontal projects delete # Delete a projectDeployment
frontal deploy # Deploy current directory
frontal deploy --prod # Deploy to production
frontal deploy --env staging # Deploy to specific environment
frontal deploy status # Check deployment statusFunctions
frontal functions list # List deployed functions
frontal functions deploy # Deploy a function
frontal functions logs # View function logs
frontal functions invoke # Invoke a functionStorage
frontal storage list # List storage buckets
frontal storage upload # Upload files
frontal storage download # Download files
frontal storage delete # Delete filesAPI Keys
frontal api-keys list # List API keys
frontal api-keys create # Create new API key
frontal api-keys revoke # Revoke an API keyConfiguration
frontal config show # Show current configuration
frontal config set # Set configuration value
frontal config unset # Remove configuration value
frontal config reset # Reset to defaultsConfiguration
Environment Variables
# Frontal API endpoint
export FRONTAL_API_URL="https://api.frontal.dev"
# Default project
export FRONTAL_PROJECT="my-project"
# Default environment
export FRONTAL_ENVIRONMENT="development"
# API key (alternative to auth login)
export FRONTAL_API_KEY="your-api-key-here"Configuration File
The CLI stores configuration in ~/.frontal/config.json:
{
"apiUrl": "https://api.frontal.dev",
"apiKey": "encrypted-api-key",
"defaultProject": "my-project",
"defaultEnvironment": "development",
"user": {
"id": "user-id",
"email": "[email protected]"
}
}Project Structure
The CLI works with standard Frontal project structures:
my-project/
├── frontal.json # Project configuration
├── functions/ # Serverless functions
│ └── my-function/
│ ├── index.js
│ └── package.json
├── storage/ # Static assets
├── config/ # Configuration files
└── tests/ # Test filesfrontal.json
{
"name": "my-project",
"version": "1.0.0",
"environments": {
"development": {
"functions": {
"my-function": {
"runtime": "nodejs18",
"memory": 256,
"timeout": 30
}
}
},
"production": {
"functions": {
"my-function": {
"runtime": "nodejs18",
"memory": 512,
"timeout": 60
}
}
}
}
}Examples
Deploying a Function
# Create a new function
mkdir my-function
cd my-function
# Initialize function
cat > index.js << 'EOF'
export async function handler(event) {
return {
statusCode: 200,
body: JSON.stringify({ message: 'Hello, World!' })
};
}
EOF
# Deploy
frontal functions deploy my-functionSetting Up Storage
# Upload files to storage
frontal storage upload ./public/* --bucket my-assets
# List uploaded files
frontal storage list --bucket my-assets
# Download files
frontal storage download my-assets/logo.pngManaging Projects
# Create a new project
frontal projects create --name "my-awesome-project"
# Set as default
frontal config set defaultProject "my-awesome-project"
# Deploy to the new project
frontal deployDevelopment
Building from Source
# Clone the repository
git clone https://github.com/frontal-labs/cli.git
cd cli
# Install dependencies
bun install
# Build the CLI
bun run build
# Run locally
./dist/bin/frontal.js --helpRunning Tests
# Run all tests
bun run test
# Run tests in watch mode
bun run test:watch
# Generate coverage report
bun run test:coverageCode Quality
# Lint code
bun run lint
# Format code
bun run format
# Type check
bun run type-checkTroubleshooting
Common Issues
Authentication Problems
# Check auth status
frontal auth status
# Clear cached credentials
frontal auth logout
# Re-authenticate
frontal auth loginDeployment Failures
# Check deployment logs
frontal deploy status --verbose
# Validate project structure
frontal validate
# Check configuration
frontal config showNetwork Issues
# Set custom API endpoint
frontal config set apiUrl "https://api.frontal.dev"
# Use proxy if needed
export HTTPS_PROXY="http://proxy.example.com:8080"Debug Mode
Enable debug logging:
# Set log level
export FRONTAL_LOG_LEVEL=debug
# Or use flag
frontal --verbose deployGetting Help
# General help
frontal --help
# Command-specific help
frontal deploy --help
# Show version
frontal --versionHomebrew Management
Installation
# Add the tap
brew tap frontal-labs/cli
# Install the CLI
brew install frontal-cliUpdates
# Update to latest version
brew upgrade frontal-cli
# Or update all packages
brew upgradeUninstallation
# Remove the CLI
brew uninstall frontal-cli
# Remove the tap
brew untap frontal-labs/cliTroubleshooting
# Reinstall if issues occur
brew reinstall frontal-cli
# Force upgrade to latest
brew upgrade frontal-cli --forceContributing
We welcome contributions! Please see our Contributing Guide for details.
Development Workflow
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
License
MIT License - see LICENSE file for details.
Support
- Documentation: docs.frontal.dev
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: [email protected]
Changelog
See CHANGELOG.md for version history and changes.
