### Install Wasp on Linux/macOS Source: https://docs.opensaas.sh/start/getting-started Installs the Wasp CLI tool by downloading and executing an installation script. This command should be run in the terminal on Linux and macOS systems. ```bash curl -sSL https://get.wasp.sh/installer.sh | sh ``` -------------------------------- ### Verify Wasp Installation Source: https://docs.opensaas.sh/start/getting-started Checks if the Wasp CLI has been installed correctly by displaying its current version. This command should be run after completing the installation steps. ```bash wasp version ``` -------------------------------- ### Define Blog Post Frontmatter for SEO with Astro Source: https://docs.opensaas.sh/guides/seo This example demonstrates the frontmatter structure used in Astro for markdown files, which is leveraged for SEO. Properties like `title`, `pubDate`, `description`, and `image` are automatically injected into the HTML by Astro, enhancing the discoverability of your blog content. ```markdown --- title: 'My First Blog Post' pubDate: 2022-07-01 description: 'This is the first post of my new Astro blog.' author: 'Astro Learner' image: url: 'https://docs.astro.build/assets/full-logo-light.png' alt: 'The full Astro logo.' tags: ["astro", "blogging", "learning in public"] --- ``` -------------------------------- ### Install Node.js Version with NVM Source: https://docs.opensaas.sh/start/getting-started Installs a specific version of Node.js using the Node Version Manager (nvm). This is a prerequisite for using Wasp. Ensure Node.js version is >= 22.12. ```bash nvm install 20 ``` -------------------------------- ### Example Product IDs in .env.server Source: https://docs.opensaas.sh/llms-full Stores example product and variant IDs for Lemon Squeezy in the server environment variables. These IDs are used to identify specific products and pricing tiers within your Lemon Squeezy account. ```env PAYMENTS_HOBBY_SUBSCRIPTION_PLAN_ID=your_hobby_subscription_plan_id PAYMENTS_PRO_SUBSCRIPTION_PLAN_ID=your_pro_subscription_plan_id PAYMENTS_CREDITS_10_PLAN_ID=your_credits_10_plan_id ``` -------------------------------- ### Example Callback URL for Lemon Squeezy Source: https://docs.opensaas.sh/llms-full An example of a public URL generated by ngrok that you would provide to Lemon Squeezy as your webhook callback URL. This URL is dynamic and depends on your ngrok session. ```sh https://89e5-2003-c7-153c-72a5-f837.ngrok-free.app/payments-webhook ``` -------------------------------- ### Start Stripe CLI Webhook Forwarding Source: https://docs.opensaas.sh/guides/payment-integrations/stripe Starts the Stripe CLI to forward webhook events to a specified local port. Ensure your Node.js server is running on the target port. The webhook signing secret generated should be added to your `.env.server` file. ```bash stripe listen --forward-to localhost:3001/payments-webhook ``` -------------------------------- ### Create New Open SaaS Project Source: https://docs.opensaas.sh/start/getting-started Initializes a new Open SaaS project by cloning the template. After running this command, you will be prompted to select the 'saas' template. ```bash wasp new ``` -------------------------------- ### Send Email using Wasp's emailSender Module Source: https://docs.opensaas.sh/guides/email-sending Demonstrates how to send an email using the `send` function from the `emailSender` module provided by Wasp. This function can be used in server-side code, for example, within webhook handlers. ```javascript import { emailSender } from "wasp/server/email"; //... 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...', }); } ``` -------------------------------- ### Deploy Astro Starlight Blog to Netlify Source: https://docs.opensaas.sh/guides/deploying Deploys the Astro Starlight blog to Netlify. After building the blog, this command initiates the deployment process. You will be prompted to select the `dist` directory as the deploy path. ```bash netlify deploy ``` -------------------------------- ### GitHub Actions Workflow for e2e Tests Source: https://docs.opensaas.sh/guides/tests An example of a GitHub Actions workflow file used to run e2e tests as part of a CI pipeline. This workflow requires specific environment variables to be set as GitHub secrets. ```yaml # Example content of .github/workflows/e2e-tests.yml # This file would contain the actual workflow definition. # Ensure WASP_VERSION is updated and necessary environment variables are configured in GitHub Secrets. ``` -------------------------------- ### Build Astro Starlight Blog Source: https://docs.opensaas.sh/guides/deploying Builds the Astro Starlight blog, generating static assets for deployment. This command should be run from the `blog` directory and prepares the blog content into the `blog/dist` directory. ```bash npm run build ``` -------------------------------- ### Build Frontend with Client Environment Variables Source: https://docs.opensaas.sh/guides/deploying Builds the frontend of the application, ensuring that client-side environment variables are included in the build process. This is typically used when deploying manually or when specific client configurations are required. ```bash REACT_APP_CLIENT_ENV_VAR_1=<...> npm run build ``` -------------------------------- ### Deploy Astro Starlight Blog to Netlify Production Source: https://docs.opensaas.sh/guides/deploying Deploys the Astro Starlight blog to Netlify's production environment. This command should be used after verifying the deployment in a draft state. Ensure you have successfully run `netlify deploy` previously. ```bash netlify deploy --prod ``` -------------------------------- ### Deploy SaaS App with Wasp CLI to Fly.io Source: https://docs.opensaas.sh/guides/deploying Deploys the full-stack SaaS application to Fly.io using the Wasp CLI. This command handles setting up the database, server, and client. It automatically configures essential server-side environment variables like DATABASE_URL and JWT_SECRET. Client-side environment variables must be explicitly passed. ```bash REACT_APP_CLIENT_ENV_VAR_1=<...> REACT_APP_CLIENT_ENV_VAR_2=<...> wasp deploy ``` -------------------------------- ### Netlify CLI Login Source: https://docs.opensaas.sh/guides/deploying Logs you into the Netlify CLI, which is required for deploying your blog or other projects to Netlify. This command will typically open a browser window for authentication. ```bash netlify login ``` -------------------------------- ### Install Specific Stripe NPM Package Version Source: https://docs.opensaas.sh/guides/deploying Installs a specific version of the Stripe NPM package to match your default API version if it's not the latest. This is useful for maintaining compatibility with existing projects. Replace 'x.x.x' with the desired version number. ```bash npm install stripe@x.x.x # e.g. npm install stripe@13.11.0 ``` -------------------------------- ### Install Rosetta on macOS (Apple Silicon) Source: https://docs.opensaas.sh/start/getting-started Installs Rosetta translation software on Macs with Apple Silicon (M1, M2, etc.). This is necessary if you encounter a 'Bad CPU type in executable' error, as the Wasp binary is built for x86. ```bash softwareupdate --install-rosetta ``` -------------------------------- ### Wasp Configuration for Full-Stack Authentication Source: https://docs.opensaas.sh/blog/2024-12-10-turboreel-os-ai-video-generator-built-with-open-saas This Wasp configuration file demonstrates how to define full-stack authentication methods, including email and GitHub, along with email verification and password reset options for a SaaS application. It specifies user entities and redirection for failed authentication attempts. ```javascript app myApp { wasp: { version: "^0.15.0" }, title: "My App", auth: { // 1. Specify the User entity userEntity: User, methods: { // 2. Enable Github Auth gitHub: {}, email: { // 3. Specify the email from field fromField: { name: "My App Postman", email: "hello@itsme.com" }, // 4. Specify the email verification and password reset options emailVerification: { clientRoute: EmailVerificationRoute }, passwordReset: { clientRoute: PasswordResetRoute }, }, }, onAuthFailedRedirectTo: "/login" }, } ```