Build, Market, and Manage your SaaS

Follow this guide to quickly build a SaaS MVP in a few days with SaasRock.

SaasRock is more than a boilerplate, it's a SaaS Building Framework. Follow these steps to launch a SaaS MVP in less than a week (or watch me build one in 3 days).


Build your SaaS

Set up Environment

  1. Clone the saasrock repo and set up the upstream for updates.

  2. Initialize git and deploy to a new GitHub repository.

  3. Duplicate .env.example, rename it to .env, and set your variables (APP_NAME, DOMAIN_NAME, and DATABASE_URL).

  4. Run npx prisma db push, and npx prisma db seed to prepare your local database.

  5. Run npm run dev, and visit your app at localhost:3000.

Start with one Feature

  1. Think of the most important feature.

  2. Create a module under at app/modules/{yourFeature} with the following files:

  3. .../components - Lists, Forms, Badges...

  4. .../db - Custom database models for this feature.

  5. .../dtos - Data transfer objects.

  6. .../services - Server-side logic.

  7. .../utils - Client & Server-side helper functions.

  8. Create the routes under the app.$tenant directory using this module.

Set up Pricing plans

  1. Set up your default plans and feature limits at plans.server.ts. Preview them at /pricing.

  2. Create a Stripe account and set the STRIPE_SK environment variable.

  3. Go to /admin/settings/pricing and click "Click here to generate plans".

  4. Create a test account at /register or /pricing.

Set up Transactional Emails

  1. Create a Postmark account and grab your server token.

  2. Set the POSTMARK_SERVER_TOKEN and POSTMARK_FROM_EMAIL env variables.

  3. Go to /admin/settings/transactional-emails and click "Create all".


Market your SaaS

Set up i18n

  1. Open locale/i18n.ts, set the languages in supportedLngs, and the fallbackLng.

  2. Visit the landing page and test it by adding ?lng=en or ?lng=yourLocale to the URL.

Brand

  1. Update the theme color by setting the color inside colors { theme: {.

  2. Replace the logo and icon files under app/assets/img/: icon-dark.png, icon-light.png, logo-dark.png, logo-light.png.

  3. Generate your favicon files, and add them under public/.

Landing Page

  1. Open app/modules/pageBlocks/utils/defaultPages/defaultLandingPage.ts to set up your landing page blocks.

Contact Page (optional)

You have two options to receive submissions:

  1. Create a Formspree form, and set the INTEGRATIONS_CONTACT_FORMSPREE env variable.

  2. Or go to /admin/entities/templates/manual, click "Default: CRM", and create them. Contact submissions will be at /admin/crm/submissions.

Newsletter Page (optional)

Similarly, you have two options to get newsletter subscribers:

  1. Create a Convertkit form, and set the CONVERTKIT_APIKEY and CONVERTKIT_FORM variables.

  2. Or use the CRM entities, your newsletter subscribers will be at /admin/crm/contacts?marketingSubscriber=true.

Blog Page (optional)

  1. Go to /admin/blog/new and write your first blog post.

  2. All your posts will be available at /blog.

Knowledge Bases (optional)

  1. Create as many knowledge bases as you need at /admin/knowledge-base.

  2. You can use the slugs /docs or /help/{customSlug}.


Deploy your SaaS

  1. Create a Supabase project and set the SUPABASE_API_URL and SUPABASE_KEY environment variables.

  2. Set your DATABASE_URL variable to use the production database for a moment, run npx prisma db push, and seed your database with npx prisma db seed. Important: When seeding a production database, go to app/utils/db/seed/SeedService.ts and change the default email and password (default is admin@email.com). Once you've successfully seeded the database, change the DATABASE_URL back to your local database.

  3. To deploy on Fly.io, open fly.toml and set your app name, and its primary_region. Important: The region must match the one used in your database provider (in this case supabase).

  4. Create the app using fly CLI: fly apps create YOUR_APP_NAME.

  5. Set your secrets: You can see the examples at .env.fly.example. Important: Use a live STRIPE_SK key to create live plans, and change other important secrets such as SESSION_SECRET, JWT_SECRET and CRYPTO_SECRET (you can use random values for these three).

  6. Deploy: fly deploy --remote-only.

  7. Scale (recommended): fly scale vm shared-cpu-2x --app YOUR_APP_NAME.

  8. Your app should be deployed under a fly.dev domain, similar to https://saasrock.fly.dev. Use this URL to set SERVER_URL in the production secrets, and do the same for DOMAIN_NAME (in this case: saasrock.fly.dev).

  9. Custom domain

Run the following command to get the IPv4 and IPv6 addresses:

flyctl ips list -a YOUR_APP_NAME

Head over to your DNS provider and add A and AAAA records for example.com with the IPv4 and IPv6 values.

Now you can create a certificate for your custom domain:

flyctl certs create -a custom-quartz example.com

Your app should be available at your domain. It may take a few minutes for the certificate to be issued.


Manage your SaaS

  1. Go to /admin/analytics/overview to analyze your traffic.

We respect your privacy.

TLDR: We use cookies for language selection, theme, and analytics. Learn more.