@beaulewis/saas-cli
v1.0.2
Published
A unified CLI tool for Flutter SaaS development with live documentation, code generation, and backend integration
Maintainers
Readme
saas-cli
A unified CLI for Flutter SaaS development
Live documentation · AI-powered assistance · Code generation · Backend integrations
Table of Contents
- Features
- Requirements
- Installation
- Quick Start
- Commands
- Environment Variables
- Configuration
- Security Notes
- Contributing
- License
- Author
Features
| Feature | Description | |---------|-------------| | Live Documentation | Query Flutter, Dart, and package docs via Context7 | | AI-Powered Questions | Ask technical questions with Perplexity AI | | Code Generation | Generate Riverpod, Drift, GoRouter, Freezed, and more | | Supabase Management | RLS policies, migrations, types, functions | | Backend Services | Redis, Cloudflare Workers, OneSignal, PostHog | | Video Processing | FFmpeg-based video operations |
Requirements
Core Requirement
- Node.js 20+ - Download
External CLI Dependencies
Some commands require external CLIs to be installed. The table below shows which CLIs are needed for each command:
| Command | Required CLI | Installation |
|---------|--------------|--------------|
| saas init flutter | Flutter SDK | flutter.dev/get-started/install |
| saas init add | Flutter SDK | flutter.dev/get-started/install |
| saas init worker | Wrangler CLI | npm install -g wrangler |
| saas init supabase | Supabase CLI | npm install -g supabase or brew install supabase/tap/supabase |
| saas video * | FFmpeg | brew install ffmpeg (macOS) or apt install ffmpeg (Linux) |
| saas cf * | Wrangler CLI | npm install -g wrangler |
| saas supabase * | Supabase CLI | npm install -g supabase or brew install supabase/tap/supabase |
Commands Without External Dependencies
These commands work out of the box with just Node.js:
saas docs- Documentation lookup (requiresCONTEXT7_API_KEY)saas ask- AI questions (requiresPERPLEXITY_API_KEY)saas gen- Code generationsaas redis- Redis management (requiresREDIS_URL)saas push- Push notifications (requires OneSignal keys)saas flags- Feature flags (requires PostHog keys)
Installation
# Global install via npm
npm install -g @beaulewis/saas-cli
# Global install via pnpm
pnpm add -g @beaulewis/saas-cli
# Run without installing
npx @beaulewis/saas-cli --helpVerify installation:
saas --versiongit clone https://github.com/Beaulewis1977/saas-cli.git
cd saas-cli
pnpm install
pnpm build
pnpm link --globalQuick Start
# Look up Flutter documentation
saas docs flutter "ListView.builder with pagination"
# Ask AI a question
saas ask "best practices for offline-first Flutter apps"
# Generate a Riverpod notifier
saas gen riverpod notifier UserList --state "List<User>"Commands
docs - Documentation Lookup
Query live documentation via Context7.
saas docs flutter "widget lifecycle"
saas docs dart "async streams"
saas docs package riverpod "provider family"
saas docs widget "TextField decoration"ask - AI-Powered Questions
Ask technical questions using Perplexity AI.
saas ask "how to implement pull-to-refresh in Flutter"
saas ask --model sonar-pro "explain Flutter rendering pipeline"
saas ask --model sonar-reasoning "debug this riverpod error"
saas ask --model sonar-deep-research "compare state management solutions"Available Models:
| Model | Use Case |
|-------|----------|
| sonar | Fast, general queries (default) |
| sonar-pro | Enhanced responses |
| sonar-reasoning | Complex problem solving |
| sonar-deep-research | In-depth research |
gen - Code Generation
Generate Flutter code scaffolds.
# Riverpod
saas gen riverpod notifier UserList --state "List<User>"
saas gen riverpod provider AuthService --async
saas gen riverpod family UserProfile --param userId
# Drift (SQLite)
saas gen drift table users --columns "id:int,name:text,email:text"
saas gen drift dao Users --table users
# GoRouter
saas gen gorouter route /profile --name profile
saas gen gorouter shell MainShell --routes home,profile,settings
# Freezed
saas gen freezed model User --fields "id:int,name:String,email:String?"
saas gen freezed union AuthState --variants loading,authenticated,unauthenticated
# PowerSync
saas gen powersync schema --from supabase
saas gen powersync sync-rules users,profiles
# Repository Pattern
saas gen repository User --methods "getById,getAll,create,update,delete"supabase - Database Management
Manage Supabase backend.
# View schema
saas supabase schema
saas supabase schema --table users
# Create table
saas supabase create-table profiles --columns "user_id:uuid,avatar:text,bio:text"
# RLS policies
saas supabase rls recipes --policy user-owned --column user_id
saas supabase rls posts --policy public-read
# Migrations
saas supabase migration "add_avatar_to_profiles" --sql "ALTER TABLE..."
# Generate TypeScript types
saas supabase types
# Database functions
saas supabase fn get_user_stats --returns jsonredis - Cache Management
Manage Redis cache and queues.
saas redis ping
saas redis info
saas redis keys "user:*"
saas redis get "session:abc123"
saas redis set "cache:data" '{"key":"value"}' --ttl 3600
saas redis del "cache:data"
saas redis queue add jobs '{"task":"process"}'
saas redis queue pop jobscf - Cloudflare Workers
Manage Cloudflare Workers and KV.
# Workers
saas cf worker list
saas cf worker deploy ./worker.js --name my-worker
saas cf worker logs my-worker
# KV
saas cf kv list
saas cf kv get MY_NAMESPACE key123
saas cf kv put MY_NAMESPACE key123 "value"push - Push Notifications
Send notifications via OneSignal.
saas push send --title "Hello" --message "World" --segments "All"
saas push schedule --title "Reminder" --time "2025-01-15T10:00:00Z"
saas push template list
saas push template create welcome --title "Welcome!" --message "Thanks for joining"flags - Feature Flags
Manage feature flags via PostHog.
saas flags list
saas flags get dark-mode
saas flags set dark-mode --enabled --percent 50
saas flags add-user dark-mode user123
saas flags remove-user dark-mode user123video - Video Processing
FFmpeg-based video operations.
saas video info input.mp4
saas video thumbnail input.mp4 --time 00:00:05 --output thumb.jpg
saas video resize input.mp4 --width 1280 --height 720
saas video compress input.mp4 --quality medium
saas video trim input.mp4 --start 00:00:10 --end 00:00:30
saas video combine video1.mp4 video2.mp4 --output merged.mp4init - Project Scaffolding
Initialize new projects.
saas init flutter my-app --template saas
saas init supabase --project my-app
saas init worker my-edge-function
saas init add riverpod,drift,freezedEnvironment Variables
The CLI reads environment variables for API keys and service credentials. You have two options:
Option 1: Project .env File (Recommended)
Create a .env file in your project directory. This allows different API keys per project.
# Create .env in your project root (add to .gitignore!)
touch .envCopy this template into your .env file:
# Documentation (Context7)
CONTEXT7_API_KEY=
# AI Questions (Perplexity)
PERPLEXITY_API_KEY=
# Supabase
SUPABASE_PROJECT_REF=
SUPABASE_ACCESS_TOKEN=
# Redis
REDIS_URL=
# Cloudflare Workers
CF_API_TOKEN=
# Push Notifications (OneSignal)
ONESIGNAL_APP_ID=
ONESIGNAL_API_KEY=
# Feature Flags (PostHog)
POSTHOG_API_KEY=
POSTHOG_PROJECT_ID=Add .env to your .gitignore to avoid committing secrets:
.envOption 2: Shell Exports (Global)
Add these to your ~/.bashrc, ~/.zshrc, or shell config for system-wide access:
# Documentation (Context7)
export CONTEXT7_API_KEY="your-key-here"
# AI Questions (Perplexity)
export PERPLEXITY_API_KEY="pplx-your-key-here"
# Supabase
export SUPABASE_PROJECT_REF="your-project-ref"
export SUPABASE_ACCESS_TOKEN="your-access-token"
# Redis
export REDIS_URL="redis://localhost:6379"
# Cloudflare Workers
export CF_API_TOKEN="your-cloudflare-token"
# Push Notifications (OneSignal)
export ONESIGNAL_APP_ID="your-app-id"
export ONESIGNAL_API_KEY="your-api-key"
# Feature Flags (PostHog)
export POSTHOG_API_KEY="your-posthog-key"
export POSTHOG_PROJECT_ID="your-project-id"After adding, reload your shell: source ~/.bashrc or source ~/.zshrc
Note: Shell-exported environment variables take precedence over
.envfile values. If you have both, the shell export wins.
Variable Reference
| Variable | Description | Required For |
|----------|-------------|--------------|
| CONTEXT7_API_KEY | Context7 API key | docs |
| PERPLEXITY_API_KEY | Perplexity API key | ask |
| SUPABASE_PROJECT_REF | Supabase project reference | supabase |
| SUPABASE_ACCESS_TOKEN | Supabase access token | supabase |
| REDIS_URL | Redis connection URL | redis |
| CF_API_TOKEN | Cloudflare API token | cf |
| ONESIGNAL_APP_ID | OneSignal app ID | push |
| ONESIGNAL_API_KEY | OneSignal API key | push |
| POSTHOG_API_KEY | PostHog API key | flags |
| POSTHOG_PROJECT_ID | PostHog project ID | flags |
Global Options
--json Output results as JSON
-v, --verbose Enable verbose output
--debug Enable debug output
-V, --version Display version number
-h, --help Display helpConfiguration
The CLI stores configuration in ~/.config/saas-cli/:
~/.config/saas-cli/
├── config.yaml # CLI settings
└── cache/ # Response cache for faster lookupsSecurity Notes
This CLI executes external tools (FFmpeg, Wrangler, Flutter, Supabase CLI) via shell commands. Ensure you trust the input you provide, especially for:
- Project names in
initcommands - File paths in
videocommands - Custom arguments passed to backend CLIs
Contributing
Contributions are welcome! See CONTRIBUTING.md for development guidelines.
- Bug reports: Open an issue
- Feature requests: Start a discussion
- Pull requests: Fork, create a branch, and submit a PR
# Clone and install
git clone https://github.com/Beaulewis1977/saas-cli.git
cd saas-cli
pnpm install
# Run in development
pnpm dev
# Run tests
pnpm test
# Build
pnpm buildLicense
MIT License - see LICENSE file for details.
Author
Beau Lewis
Support This Project
If you find this tool useful and want to support continued development:
