Skip to content

Quick Start

Get started with the pfy CLI in minutes.

Prerequisites

1. Authenticate

Login to your ProductifyFW Manager:

bash
pfy login \
  --server https://manager.example.com \
  --token your-personal-access-token

This saves your credentials to ~/.pfy/config.yaml for future commands.

Creating a Personal Access Token

Generate a PAT from the Manager UI:

  1. Navigate to SettingsPersonal Access Tokens
  2. Click Create Token
  3. Copy the token (it won't be shown again)

2. Initialize Your Project

Initialize a new project with auto-detected configuration:

bash
# Create a new project directory
mkdir my-project && cd my-project

# Initialize with auto-detection (Go or Node.js)
pfy init --name my-project

This creates project.yaml with:

  • Project name and ID
  • Initial version (0.1.0)
  • Auto-detected CI configuration (GitHub/GitLab, Go/Node.js)
  • Base environment settings

Example project.yaml:

yaml
project_name: my-project
project_id: proj_abc123
version: 0.1.0
ci:
  type: github
  language: go
  registry: ghcr.io
  image_name: my-project
environments:
  - name: development
    domain: dev.example.com

3. Sync from Manager (Optional)

If your project already exists in Manager, sync its configuration:

bash
pfy sync --project-id <project-id>

This pulls project metadata and updates project.yaml automatically.

4. Manage Version

Use semantic versioning for your project:

bash
# Check current version
pfy version show
# Output: 0.1.0

# Bump patch version (0.1.0 → 0.1.1)
pfy version bump

# Bump minor version (0.1.1 → 0.2.0)
pfy version bump --part minor

# Set specific version
pfy version set --version 1.0.0

5. Generate CI/CD Templates

Create CI/CD pipelines that use your project configuration:

bash
# Generate GitHub Actions workflow
pfy ci update

# Or for GitLab CI
# (detected automatically from project.yaml)
pfy ci update

This creates .github/workflows/ci.yml or .gitlab-ci.yml with:

  • Docker build using from project.yaml
  • Auto-versioning on main branch pushes
  • Multi-platform builds (linux/amd64, linux/arm64)

6. List Projects

View all projects in your Manager:

bash
pfy project list

Example output:

Projects:
  - My SaaS Platform (my-saas): A multi-tenant SaaS application
  - E-commerce Store (ecommerce): Online retail platform

7. Create a Tenant

Add a tenant to your project:

bash
# First, get the project ID
pfy project get --slug my-project

# Create the tenant using the project ID
pfy tenant create \
  --project-id <project-id> \
  --slug my-tenant \
  --name "My Tenant" \
  --description "First tenant"

8. Create an Application

Deploy an application for your tenant:

bash
# Get the tenant ID
pfy tenant list --project my-project

# Create the application
pfy application create \
  --tenant-id <tenant-id> \
  --slug my-app \
  --name "My Application" \
  --version "1.0.0" \
  --description "Production application"

9. List Applications

View all applications in a tenant:

bash
pfy application list --tenant my-tenant

Common Workflows

New Project from Scratch

bash
# 1. Initialize project with auto-detection
cd my-new-project
pfy init --name my-saas

# 2. Review generated configuration
cat project.yaml

# 3. Bump version for first release
pfy version bump --part minor  # 0.1.0 → 0.2.0

# 4. Generate CI/CD pipeline
pfy ci update

# 5. Commit and push
git add project.yaml .github/workflows/ci.yml
git commit -m "Initialize project with pfy"
git push

Existing Project Setup

bash
# 1. Get project ID from Manager
pfy project list

# 2. Sync configuration
pfy sync --project-id <project-id>

# 3. Update CI templates with synced config
pfy ci update

# 4. Verify version
pfy version show

Development to Production Workflow

bash
# 1. Initialize project
pfy init --name my-saas

# 2. Create Manager resources
PROJECT_ID=$(pfy project create --slug my-saas --name "My SaaS Platform" | grep "ID:" | awk '{print $2}')

# 3. Sync Manager metadata to local config
pfy sync --project-id $PROJECT_ID

# 4. Create development tenant
pfy tenant create \
  --project-id $PROJECT_ID \
  --slug dev \
  --name "Development Environment"

# 5. Create production tenant
pfy tenant create \
  --project-id $PROJECT_ID \
  --slug prod \
  --name "Production Environment"

# 6. Create application in dev using project version
DEV_TENANT_ID=$(pfy tenant list --project my-saas | grep "dev" | awk '{print $1}')
VERSION=$(pfy version show)
pfy application create \
  --tenant-id $DEV_TENANT_ID \
  --slug web-app \
  --name "Web Application" \
  --version $VERSION

# 7. Bump version for release
pfy version bump --part minor

# 8. Promote to production with new version
APP_ID=$(pfy application list --tenant dev | grep "web-app" | awk '{print $1}')
PROD_TENANT_ID=$(pfy tenant list --project my-saas | grep "prod" | awk '{print $1}')
pfy application promote \
  --application-id $APP_ID \
  --target-tenant-id $PROD_TENANT_ID
  # Uses version from project.yaml automatically

CI/CD with Auto-Versioning

bash
# 1. Initialize and configure
pfy init --name my-app
pfy ci update

# 2. Push to main branch
git add .
git commit -m "Initial commit"
git push origin main

# 3. CI automatically:
#    - Bumps patch version (0.1.0 → 0.1.1)
#    - Builds Docker image (my-app:0.1.1)
#    - Commits version change with [skip ci]
#    - Pushes version tag (v0.1.1)

# 4. For feature releases, bump manually:
pfy version bump --part minor  # 0.1.1 → 0.2.0
git add project.yaml
git commit -m "Bump to v0.2.0 for new features"
git push

# CI uses the manual version (0.2.0) for the build

Using Environment Variables

Instead of flags, use environment variables:

bash
export PFY_MANAGER_URL="https://manager.example.com"
export PFY_MANAGER_TOKEN="your-token"

# Commands now use these automatically
pfy project list

Verbose Output

Get detailed information about what's happening:

bash
pfy --verbose project list

Example verbose output:

Connecting to ProductifyFW manager...
Fetching projects list...
Found 2 project(s)
Projects:
  - My SaaS Platform (my-saas): A multi-tenant SaaS application
    ID: 01234567-89ab-cdef-0123-456789abcdef
  - E-commerce Store (ecommerce): Online retail platform
    ID: 12345678-9abc-def0-1234-56789abcdef0

Quiet Mode

Minimize output for scripting:

bash
pfy --quiet project create --slug prod --name "Production"

Next Steps

Getting Help

Get help for any command:

bash
# General help
pfy --help

# Command-specific help
pfy project --help
pfy project create --help