npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

create-strapi-fly

v1.6.0

Published

Interactive CLI tool to create and deploy Strapi instances on Fly.io with Cloudflare R2 storage

Downloads

33

Readme

create-strapi-fly

🚀 Interactive CLI tool to create and deploy Strapi instances on Fly.io with Cloudflare R2 storage

npm version License: MIT

🎯 Features

  • One-command setup - Create a production-ready Strapi instance with a single npx command
  • 🔐 Secure by default - Automatically generates all required secrets and tokens
  • ☁️ Cloudflare R2 integration - File uploads stored in R2 with CDN support
  • 🚀 Fly.io deployment - Containerized deployment with persistent storage
  • 📦 Latest Strapi version - Uses Strapi 5 beta with AI features
  • 🎨 Interactive CLI - Guided setup with validation and helpful prompts
  • 🔄 Complete automation - Handles everything from project creation to deployment

📋 Prerequisites

Before running this tool, ensure you have:

Required Software

Accounts & Configuration

  • Fly.io account - Sign up at fly.io and run fly auth login
  • Cloudflare R2 setup:
    • Create an R2 bucket
    • Generate R2 API credentials (Access Key ID & Secret)
    • Note your R2 endpoint URL
    • Configure a custom domain for CDN (optional but recommended)

🚀 Quick Start

Create a New Instance

Run the following command in any directory:

npx create-strapi-fly

Or with yarn:

yarn create strapi-fly

The CLI will guide you through the entire setup process!

Uninstall/Cleanup

To remove all Fly.io resources (app, volumes, secrets) for an existing project:

cd your-strapi-project
npx create-strapi-fly uninstall

Aliases: cleanup, destroy

Warning: This permanently deletes your Fly.io app and all data. Your local files remain unchanged.

Create Tracker (For Orphaned Resources)

If you cancelled the setup early and have orphaned Fly.io resources:

cd your-strapi-project
npx create-strapi-fly create-tracker

This will fetch your Fly.io app info and create the tracker file so you can use the uninstall command.

📖 What It Does

Setup Process

The tool automates these steps:

  1. Creates a new Strapi application using the latest beta version
  2. Installs required dependencies including AWS S3 provider for R2
  3. Generates secure tokens for all authentication and encryption needs
  4. Configures Cloudflare R2 for file storage with CDN
  5. Creates Docker configuration for containerized deployment
  6. Sets up Fly.io resources:
    • Creates the application
    • Provisions persistent storage volume
    • Configures all environment secrets
  7. Saves resource tracker (.strapi-fly-resources.json) for easy cleanup
  8. Deploys to production (optional immediate deployment)

Cleanup Process

When you run npx create-strapi-fly uninstall:

  1. Reads resource tracker (.strapi-fly-resources.json)
  2. Confirms deletion (requires typing app name)
  3. Deletes Fly.io volumes (all persistent data)
  4. Destroys Fly.io app (deployments and secrets)
  5. Removes tracker file
  6. Keeps local files (your project remains intact)

💡 Usage Examples

Basic Usage

npx create-strapi-fly

Follow the interactive prompts to:

  • Name your application
  • Choose deployment region
  • Enter R2 credentials
  • Configure CDN domain
  • Deploy immediately or later

What You'll Need

During setup, have ready:

  • Fly.io region code (e.g., mia, lax, ord, iad)
  • R2 endpoint URL (e.g., https://accountid.r2.cloudflarestorage.com)
  • R2 bucket name
  • R2 Access Key ID
  • R2 Secret Access Key
  • CDN domain (e.g., https://cdn-myapp.mydomain.com)

🏗️ Project Structure

After running the tool, your project will have:

your-app-name/
├── .env                            # Environment variables (git-ignored)
├── .strapi-fly-resources.json     # Resource tracker (git-ignored)
├── Dockerfile                     # Multi-stage Docker build
├── .dockerignore                  # Docker build exclusions
├── fly.toml                       # Fly.io configuration
├── package.json                   # Dependencies
├── config/
│   ├── plugins.ts                 # R2/S3 upload configuration
│   ├── middlewares.ts             # Security & CSP settings
│   └── env/production/
│       └── database.ts            # Production database config
└── src/                           # Strapi application code

🔧 Configuration

Environment Variables

The tool automatically generates and configures:

  • APP_KEYS - Application encryption keys
  • ADMIN_JWT_SECRET - Admin authentication
  • JWT_SECRET - API authentication
  • API_TOKEN_SALT - API token generation
  • TRANSFER_TOKEN_SALT - Transfer token generation
  • ENCRYPTION_KEY - Database encryption
  • R2_* - Cloudflare R2 configuration
  • STRAPI_ADMIN_AI_API_KEY - Optional AI features

Deployment Configuration

  • Region: Choose any Fly.io region
  • Resources: 1GB RAM, 1 shared CPU (configurable)
  • Storage: 2GB persistent volume for SQLite database
  • Ports: HTTP (80) and HTTPS (443)

🚢 Deployment

Immediate Deployment

During setup, choose "yes" when prompted to deploy immediately.

Manual Deployment

If you chose to deploy later:

cd your-app-name
fly deploy --strategy immediate

After Deployment

Your Strapi instance will be available at:

  • Application: https://your-app-name.fly.dev
  • Admin Panel: https://your-app-name.fly.dev/admin

📚 Next Steps

After deployment:

  1. Create admin user - Visit /admin to set up your first admin account
  2. Configure content types - Use the Content-Type Builder
  3. Set permissions - Configure API access in Settings > Roles
  4. Test uploads - Verify R2 integration is working

🔧 CLI Commands

Main Commands

# Create new instance (interactive)
npx create-strapi-fly

# Uninstall Fly.io resources
npx create-strapi-fly uninstall
npx create-strapi-fly cleanup    # alias
npx create-strapi-fly destroy    # alias

# Create tracker for orphaned resources
npx create-strapi-fly create-tracker

# Show help
npx create-strapi-fly --help

Resource Tracker

The tool creates a .strapi-fly-resources.json file that tracks:

  • Fly.io app name
  • Region
  • Volume name
  • Creation timestamp

This file is used by the uninstall command to clean up resources. It's automatically added to .gitignore.

Important: Keep this file if you want to use the uninstall command later!

🐛 Troubleshooting

Common Issues

Fly CLI not found

# Install Fly CLI
curl -L https://fly.io/install.sh | sh

Not authenticated with Fly

fly auth login

R2 connection fails

  • Verify your R2 credentials
  • Check bucket exists and is accessible
  • Ensure CDN domain is configured correctly

Deployment fails

  • Check Fly.io dashboard for logs
  • Verify all secrets are set correctly
  • Ensure sufficient quota in Fly.io account

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

📮 Support

For issues and questions:

  • Open an issue on GitHub
  • Check existing issues for solutions
  • Ensure you have the latest version: npm update -g create-strapi-fly

Made with ❤️ for the Strapi community