### Run Starlight Blog and Docs Source: https://context7_llms Installs dependencies and starts the development server for the Starlight-based blog and documentation section. This involves navigating to the `blog` directory and running npm commands. ```shell cd ../blog npm install npm run dev ``` -------------------------------- ### Start Wasp Application Source: https://context7_llms Installs project dependencies and starts both the client and server components of the Wasp application. Ensure the database is running in a separate terminal session. This command is run from the `app` directory. ```shell cp .env.server.example .env.server wasp start ``` -------------------------------- ### GitHub Actions Workflow for E2E Tests Source: https://context7_llms This example demonstrates a GitHub Actions workflow file for running end-to-end tests. It outlines the steps to set up the environment, install dependencies, build the application, and execute the Playwright tests. It also mentions the need to configure environment variables as GitHub secrets. ```yaml # Example content for .github/workflows/e2e-tests.yml name: E2E Tests on: [push, pull_request] jobs: e2e: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Setup Node.js uses: actions/setup-node@v3 with: node-version: '18' - name: Install dependencies run: npm install - name: Build the app run: npm run build # Or your specific build command - name: Start app and DB (example) run: node ./e2e-tests/ci-start-app-and-db.js - name: Run Playwright tests run: npx playwright test env: # Example environment variables that need to be set in GitHub secrets DATABASE_URL: ${{ secrets.DATABASE_URL }} OTHER_ENV_VAR: ${{ secrets.OTHER_ENV_VAR }} ``` -------------------------------- ### Start Wasp Database Source: https://context7_llms Initializes and connects a Postgres database for your Wasp application using Docker. Requires Docker to be installed and running. This command should be run from the `app` directory. ```shell cd app wasp start db ``` -------------------------------- ### Install Wasp CLI (Linux/macOS/WSL2) Source: https://context7_llms Installs the Wasp CLI using a curl script. This command downloads and executes the installer script for Wasp. Ensure you have curl installed. ```shell curl -sSL https://get.wasp.sh/installer.sh | sh ``` -------------------------------- ### Start Wasp Development Server Source: https://context7_llms Command to start the Wasp development server. This is a prerequisite for exposing the local server using ngrok and testing payments. ```sh wasp start ``` -------------------------------- ### Launch Wasp DB Studio Source: https://context7_llms Starts Prisma's DB Studio GUI, allowing you to view and manage your Wasp project's database. ```shell wasp db studio ``` -------------------------------- ### Multer File Upload Example (Wasp) Source: https://context7_llms This code snippet, provided as a GitHub Gist, illustrates how to set up file uploads using the Multer middleware within a Wasp application (version 0.12 and higher). It's a practical example for handling incoming files on the server. ```javascript ``` -------------------------------- ### Example Lemon Squeezy Webhook Callback URL Source: https://docs.opensaas.sh/llms-full.txt An example of a webhook callback URL generated by ngrok, which you will provide to Lemon Squeezy. Remember to append '/payments-webhook' to the ngrok forwarding address. ```sh https://.ngrok-free.app/payments-webhook ``` -------------------------------- ### Install and Use Node Version Manager (nvm) Source: https://docs.opensaas.sh/llms-full.txt Instructions for installing and using nvm to manage Node.js versions. This is a prerequisite for using Wasp, which requires Node.js version >= 22.12. It covers installation via package managers or script, and commands to install, use, and check Node.js versions. ```shell nvm install 20 nvm use 20 node -v ``` -------------------------------- ### Verify Wasp Installation Source: https://context7_llms Checks if the Wasp CLI has been installed correctly by displaying its version. This command should be run in the terminal after installation. ```shell wasp version ``` -------------------------------- ### Example Lemon Squeezy Webhook Callback URL Source: https://context7_llms An example of a public URL generated by ngrok, with the '/payments-webhook' path appended. This URL is used as the Callback URL in your Lemon Squeezy webhook settings to receive event notifications. ```sh https://89e5-2003-c7-153c-72a5-f837.ngrok-free.app/payments-webhook ``` -------------------------------- ### Install Rosetta on macOS (Apple Silicon) Source: https://context7_llms Installs Rosetta on Macs with Apple Silicon (M1, M2, etc.) to run x86-based binaries like Wasp. This command is run in the macOS terminal. ```bash softwareupdate --install-rosetta ``` -------------------------------- ### View Server Logs for Email Verification Link (Shell) Source: https://context7_llms During development, new user sign-ups trigger an email verification process where the verification link is written to the server logs instead of being sent via email. This snippet shows an example of what these server logs look like, allowing developers to find and use the verification link to complete the registration process. ```shell [ Server ] [ Server ] Dummy email sender [ Server ] [ Server ] From: Open SaaS App [ Server ] To: vinny@wasp.sh [ Server ] Subject: Verify your email [ Server ] Text [ Server ] Click the link below to verify your email: http://localhost:3000/email-verification?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6InZpbm55QHdhc3Auc2giLCJleHAiOjE3MTg5NjUyNTB9.PkRGrmuDPuYFXkTprf7QpAye0e_O9a70xbER6LfxGJw [ Server ] HTML [ Server ]

Click the link below to verify your email

[ Server ] Verify email [ Server ] ``` -------------------------------- ### Send Email using Wasp's Email Module Source: https://context7_llms Demonstrates sending an email using the `send` function from Wasp's `email` module. This example shows sending a notification email to a customer upon subscription cancellation. ```typescript //... if (subscription.cancel_at_period_end) { await emailSender.send({ to: customer.email, subject: 'We hate to see you go :(', text: 'We hate to see you go. Here is a sweet offer...', html: 'We hate to see you go. Here is a sweet offer...', }); } ``` -------------------------------- ### Configure App Name and Title in main.wasp Source: https://context7_llms This snippet shows how to set the application's name and title within the `main.wasp` configuration file. Changing the app name will trigger a database reset, requiring `wasp db start` and `wasp db migrate-dev` to be rerun. ```wasp app YourAppName { wasp: { version: "^0.13.2" }, title: "Your App Name", ``` -------------------------------- ### Start Stripe CLI Webhook Forwarding Source: https://context7_llms Initiates Stripe CLI webhook forwarding to your local Node.js server running on port 3001. This command is essential for testing webhook functionality by relaying events from Stripe to your development environment. Ensure your server is configured to listen on the specified path. ```sh stripe listen --forward-to localhost:3001/payments-webhook ``` -------------------------------- ### Deploy Blog to Netlify (Production) Source: https://context7_llms Deploys the Astro Starlight blog to Netlify production. This command should be run after staging and confirming the deployment. ```sh netlify deploy --prod ``` -------------------------------- ### Deploy Blog to Netlify (Staging) Source: https://context7_llms Deploys the Astro Starlight blog to Netlify for staging. It prompts the user to select the 'dist' directory as the deploy path. ```sh netlify deploy ``` -------------------------------- ### Build and Deploy Astro Starlight Blog to Netlify Source: https://docs.opensaas.sh/guides/deploying Build your Astro Starlight blog for deployment and deploy it to Netlify. This involves running `npm run build` in the blog directory, followed by `netlify deploy` to select the distribution directory and `netlify deploy --prod` for production deployment. ```bash npm run build netlify deploy netlify deploy --prod ``` -------------------------------- ### Create New Open SaaS Project Source: https://context7_llms Initializes a new Wasp project and selects the 'saas' template. This command is run from the directory where you want to create your project. ```shell wasp new ``` -------------------------------- ### Build Blog for Netlify Deployment Source: https://context7_llms Builds the Astro Starlight blog for deployment. This command generates the static site in the 'blog/dist' directory, ready for Netlify deployment. ```sh npm run build ``` -------------------------------- ### Configure Dummy Email Provider (Local Dev) Source: https://context7_llms Sets up the 'Dummy' email provider for local development. No emails are actually sent; verification tokens are found in server logs. This provider prevents app builds and must be replaced for production. ```tsx app SaaSTemplate { // ... emailSender: { provider: Dummy, defaultFrom: { name: "Open SaaS App", email: "me@example.com" }, }, ``` -------------------------------- ### Install Specific Stripe NPM Package Version (Bash) Source: https://docs.opensaas.sh/guides/deploying This command demonstrates how to install a specific version of the Stripe NPM package. This is useful when your Stripe account's default API version does not match the latest available Stripe API version, and you need to align your client with an older version. ```bash npm install stripe@x.x.x // e.g. npm install stripe@13.11.0 ``` -------------------------------- ### Build Frontend for Manual Deployment Source: https://docs.opensaas.sh/guides/deploying Build your frontend application for manual deployment by running the build command, ensuring any necessary client-side environment variables are passed. ```bash REACT_APP_CLIENT_ENV_VAR_1=<...> npm run build ``` -------------------------------- ### Stripe CLI Login Command Source: https://context7_llms Command to log in to the Stripe CLI. Ensure you have the Stripe CLI installed and follow the on-screen prompts to authenticate your account. ```shell stripe login ``` -------------------------------- ### Create Wasp Database Migration Source: https://context7_llms Generates the initial database schema migration for a Wasp project. This command installs necessary dependencies and applies schema changes. It should be run whenever the Prisma schema (Entities) is modified. ```shell wasp db migrate-dev ``` -------------------------------- ### App Folder Structure Overview (Shell) Source: https://context7_llms This snippet provides a detailed view of the 'app' folder's structure within the Open SaaS project. It lists key files and subdirectories, including the Wasp config file ('main.wasp'), public assets directory, source code ('src') organized by feature (admin, auth, client, etc.), server-specific code, shared utilities, and environment/configuration files. ```shell . main.wasp # Wasp Config file. You define your app structure here. .wasp/ # Output dir for Wasp. DON'T MODIFY THESE FILES! public/ # Public assets dir, e.g. www.yourdomain.com/public-banner.webp src/ # Your code goes here. admin/ # Admin dashboard related pages and components. analytics/ # Logic and background jobs for processing analytics. auth/ # All auth-related pages/components and logic. client/ # Shared components, hooks, landing page, and other client code (React). demo-ai-app/ # Logic for the example AI-powered demo app. file-upload/ # Logic for uploading files to S3. landing-page # Landing page related code messages # Logic for app user messages. payment/ # Logic for handling payments and webhooks. server/ # Scripts, shared server utils, and other server-specific code (NodeJS). shared/ # Shared constants and util functions. user/ # Logic related to users and their accounts. .env.server # Dev environment variables for your server code. .env.client # Dev environment variables for your client code. .prettierrc # Prettier configuration. tailwind.config.js # TailwindCSS configuration. package.json package-lock.json .wasproot ``` -------------------------------- ### Deploy App with Wasp CLI to Fly.io Source: https://context7_llms Deploys a full-stack application (DB, server, client) to Fly.io using the Wasp CLI. This command handles setting up essential server-side environment variables. ```sh REACT_APP_CLIENT_ENV_VAR_1=<...> REACT_APP_CLIENT_ENV_VAR_2=<...> wasp deploy ``` -------------------------------- ### Implement User-Specific Authorization Logic (TypeScript) Source: https://context7_llms Grant or deny access to page content based on user properties like subscription status. This example demonstrates how to conditionally render content using the `User` object passed to the component. ```typescript export default function Example({ user }: { user: User }) { if (user.subscriptionStatus === 'past_due') { return (Your subscription is past due. Please update your payment information.) } if (user.subscriptionStatus === 'cancel_at_period_end') { return (Your susbscription will end on 01.01.2024) } if (user.subscriptionStatus === 'active') { return (Thanks so much for your support!) } } ``` -------------------------------- ### AWS S3 CORS Configuration Example Source: https://docs.opensaas.sh/guides/file-uploading Define the Cross-Origin Resource Sharing (CORS) configuration for your S3 bucket to allow file uploads from your application. Ensure 'AllowedOrigins' includes your development and production domains. ```json [ { "AllowedHeaders": [ "*" ], "AllowedMethods": [ "POST", "GET" ], "AllowedOrigins": [ "http://localhost:3000", "https://" ], "ExposeHeaders": [] } ] ``` -------------------------------- ### Set Google Analytics ID in .env.client Source: https://docs.opensaas.sh/guides/analytics This snippet shows how to configure the Google Analytics ID in the `.env.client` file. This ID is obtained from the Google Analytics installation instructions and is necessary for the Cookie Consent Modal to function correctly. ```env REACT_APP_GOOGLE_ANALYTICS_ID= # e.g. G-1234567890 ``` -------------------------------- ### Configure .env.server for Lemon Squeezy Product IDs Source: https://context7_llms This snippet shows how to add Lemon Squeezy product variant IDs to your .env.server file. These IDs are crucial for linking your application's subscription plans or one-time payment products to their corresponding entries in Lemon Squeezy. ```dotenv PAYMENTS_HOBBY_SUBSCRIPTION_PLAN_ID=your_hobby_plan_id PAYMENTS_PRO_SUBSCRIPTION_PLAN_ID=your_pro_plan_id PAYMENTS_CREDITS_10_PLAN_ID=your_credits_plan_id ``` -------------------------------- ### Configure Mailgun Email Sender in Wasp Source: https://docs.opensaas.sh/guides/email-sending This snippet illustrates the configuration for using Mailgun as the email provider in your `main.wasp` file. It includes setting the provider and the default sender's email, which needs to align with your Mailgun account setup. ```wasp emailSender: { provider: Mailgun, defaultFrom: { name: "Open SaaS App", email: "me@example.com" // <--- same email address you configured your Mailgun account to send emails with! }, } ``` -------------------------------- ### Project Directory Structure (Shell) Source: https://context7_llms This snippet displays the top-level directory structure of the Open SaaS project. It outlines the main folders: 'app' for the Wasp project (React, NodeJS, Prisma), 'blog' for the Astro Starlight template, and 'e2e-tests' for Playwright end-to-end tests. ```shell . app blog e2e-tests ``` -------------------------------- ### Deploy Astro Starlight Blog to Netlify (Staging) Source: https://docs.opensaas.sh/llms-full.txt Command to deploy the Astro Starlight blog to Netlify for review. It prompts for the deploy path, which should be the 'dist' directory. ```sh netlify deploy ``` -------------------------------- ### Send Email using Wasp's email Module (TypeScript) Source: https://docs.opensaas.sh/llms-full.txt Demonstrates sending an email using the `emailSender.send` function from Wasp's email module. This example shows sending a notification email to a customer upon a subscription cancellation event, utilizing customer email, subject, and body content. ```typescript //... if (subscription.cancel_at_period_end) { await emailSender.send({ to: customer.email, subject: 'We hate to see you go :(', text: 'We hate to see you go. Here is a sweet offer...', html: 'We hate to see you go. Here is a sweet offer...', }); } ``` -------------------------------- ### Configure Lemon Squeezy Webhook Source: https://docs.opensaas.sh/guides/deploying Set up a production webhook for Lemon Squeezy by providing your server's callback URL and selecting relevant event updates. Ensure the signing secret is added to your server's production environment variables.