Skip to content

Installation

Ready to install Saasfly? Follow this guide to using the create saasfly CLI to get started.

System Requirements

  • Node.js - 18.17 or later.
  • Bun - 1.0 or later.
  • OS - macOS, Windows (including WSL), and Linux are supported.

By the way, we recommend using NVM (Node Version Manager) to run different versions of Node.js.

1. Run the Setup Wizard

Run the following command in your terminal to start our handy install wizard:

Terminal window
bun create saasfly

On installation, you’ll see the following prompts:

  1. Clone the saasfly repository into the specified folder.
  2. Remove git history
  3. Install dependencies
  4. Generate prisma type

After the prompts, create saasfly will create a folder with your project name and install the required dependencies.

2. Start Saasfly

You should do below lists to run the server.

Set Up The Environment Variables

Enter the saasfly folder, duplicate the .env.example file, rename it to .env.local , and enter your variables.

Terminal window
cd saasfly
cp .env.example .env.local

Make sure you have a Postgres DB (If you don’t have a Postgres, click here) and have created a new database.

POSTGRES_URL must in your .env.local file:

# Format Example
# POSTGRES_URL="postgres://{USER}:{PASSWORD}@{DB_HOST}:{DB_PORT}/{DATABASE}"
POSTGRES_URL="postgres://postgres:[email protected]:5432/saasfly"

Then, use bun to create database tables:

Terminal window
bun db:push

Output:

🚀 Your database is now in sync with your Prisma schema. Done in 151ms
┌─────────────────────────────────────────────────────────┐
│ Update available 5.9.1 -> 5.10.2 │
│ Run the following to update │
│ npm i --save-dev prisma@latest │
│ npm i @prisma/client@latest │
└─────────────────────────────────────────────────────────┘

If something went wrong, you can talk to us on Discord , we are glad to answer anything about Saasfly.

Run Build First

Because some basic components are compile-time needed, you should run build first.

Terminal window
bun run build

Run The Development Server

Use bun run to start your web server:

Terminal window
bun run dev:web
@saasfly/nextjs:dev: cache bypass, force executing ad8bea47f156e113
@saasfly/nextjs:dev: $ bun with-env next dev
@saasfly/nextjs:dev: $ dotenv -e ../../.env.local -- next dev
@saasfly/nextjs:dev: ▲ Next.js 14.1.0
@saasfly/nextjs:dev: - Local: http://localhost:3000
@saasfly/nextjs:dev:
@saasfly/nextjs:dev: automatically enabled Fast Refresh for 1 custom loader
@saasfly/nextjs:dev: ✓ Ready in 12.1s

If all goes well, Saasfly should now be serving your project on http://localhost:3000, and you can see the result:

Installation

Congratulations! Now you can start coding to build your SaaS.

If you’re new to Saasfly, see the project structure docs for an overview of all the possible files and folders in your application.

Run With Stripe

Please read the article Stripe. And then use bun dev to run with Stripe:

Terminal window
bun dev