Skip to content

Manual Setup

The quickest way to create a new Saasfly site is using create saasfly as shown in the Installation guide.

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. Manual Installation

To manually create a new Saasfly app, just need a few steps:

Fork & Clone Repository From GitHub

Please open https://github.com/saasfly/saasfly , and fork this repository.

A fork is a copy of a repository. Forking a repository allows you to freely experiment with changes without affecting the original project.

Clone the forked repository (please replace <your_username> to your account name of GitHub) :

Terminal window
git clone https://github.com/<your_username>/saasfly.git

You will see the procedure of cloning:

remote: Enumerating objects: 402, done.
remote: Counting objects: 100% (402/402), done.
remote: Compressing objects: 100% (298/298), done.
remote: Total 402 (delta 77), reused 386 (delta 65), pack-reused 0
Receiving objects: 100% (402/402), 963.18 KiB | 130.00 KiB/s, done.
Resolving deltas: 100% (77/77), done.

Install The Dependencies

For better experience, please use Bun ( How to install Bun ) , instead of npm or yarn.

Using bun to install the dependencies:

Terminal window
bun i

It may cost several minutes, and then you will see:

+ @saasfly/api@workspace:packages/api
+ @saasfly/auth@workspace:packages/auth
+ @saasfly/common@workspace:packages/common
+ @saasfly/db@workspace:packages/db
+ @saasfly/eslint-config@workspace:tooling/eslint-config
+ @saasfly/nextjs@workspace:apps/nextjs
+ @saasfly/prettier-config@workspace:tooling/prettier-config
+ @saasfly/stripe@workspace:packages/stripe
+ @saasfly/tailwind-config@workspace:tooling/tailwind-config
+ @saasfly/typescript-config@workspace:tooling/typescript-config
+ @saasfly/ui@workspace:packages/ui
+ @turbo/[email protected] (v1.12.4 available)
+ [email protected] (v1.12.4 available)
1296 packages installed [1133.89s]

Generate Prisma Types

Please ensure your in saasfly folder, then using bun to generate Prisma types:

Terminal window
cd packages/db/
bun db:generate

Output:

✔ Generated Kysely types(1.7.1) to./ prisma in 1.32s

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:

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