Other than Sails, what technologies, frameworks, or services does this app rely on?

This app includes several tools and integrations that we use frequently on top of Sails. They've worked well for us in the past; allowing us to focus on developing new features with minimal overhead. Some are files we've rolled ourselves, and the rest are 3rd party services and frameworks. While a couple of these will require you to make an account (or obtain an API key, etc.), we want to emphasize that we only included trusted, reliable tools that we feel comfortable using on our own projects, and our customers' projects.

  • Bootstrap 4 - Front-end component library
  • Font Awesome - Icons
  • Vue.js - Front-end framework
  • parasails.js - Thin layer of bundled conventions for using Vue.js with Sails.js (More info on usage below.)
  • cloud.js - SDK for handling requests from the front-end to the endpoints in your Sails app. (More info on usage below.)
  • Mailgun* - Emails
  • Stripe* - Payments

* requires an API key

How do I configure an endpoint to use with cloud.js?

Once you've created a controller action and added it to your routes (see the Sails.js docs for more info on how to do that), there are just a few simple steps to add it to your global Cloud SDK:

  • Rebuild the method definitions in your assets/js/cloud.setup.js file using sails run scripts/rebuild-cloud-sdk.
  • You can then call that method in your frontend code like so: await Cloud.doSomething.with({…})

If you're unsure, click here.

How do I register a new page with parasails.js?

To register a new page, make sure the top-level element of the view you wish to register has an id property (e.g. <div id="my-new-page">...</div>). Then, create a new javascript file, and include parasails.registerPage('my-new-page', { /* options for the Vue.js instance */ }). For more thorough examples, dig around in assets/js/pages/.

How do I deploy to Heroku?

In your heroku dashboard, configure your app to auto-deploy from the deploy branch of this project's GitHub repository. Then, from the command line, run sails run deploy.

How do I finish setting up Mailgun?

To use Mailgun, you'll need to sign up for an account here. (While this is a paid service at higher usage levels, you should be able to use Mailgun as much as you need to in development without having to provide any credit card information.)

After you've created an account, you'll need to add your Mailgun domain and API secret to your custom config. (In development, this will be either in config/custom.js, or in a local.js file you add to your config/ folder. For your production deployment, you'll want to set these using config variables.)

If you already own a domain for your app, you can follow Mailgun's instructions for configuring a sending domain.

Otherwise, to send emails from this app without configuring a sending domain, you can use the sandbox domain & test API secret that comes with your Mailgun account. Just be sure to configure the authorized recipents for your sandbox domain first, or there will be errors from the endpoints that attempt to send emails.

How do I finish setting up Stripe?

To use Stripe for your app's payment processing, you'll need to sign up for an account here.

Once you have an account, you'll need to include your publishable and secret keys in your app's custom config as sails.config.custom.stripePublishableKey and sails.config.custom.stripeSecret. In development, you can add your test keys to config/custom.js, or in a local.js file you add to your config/ folder.

In your production deployment, you'll want to set your API keys using config variables, and you will need ensure that your site meets Stripe's HTTPS requirements in order for Stripe Checkout to work. For more information, see Stripe's Detailed Checkout Guide.

How do I disable ___________?

To disable Bootstrap:

  • Delete the folder assets/dependencies/bootstrap/
  • In tasks/pipeline.js, delete 'dependencies/bootstrap/dependencies/**/*.js', from jsFilesToInject

To disable FontAwesome:

  • In the <head> of layouts/layout.ejs, delete the link labeled <!-- Font Awesome -->

To enable email address verification:

By default, email verification is not required for signup or for when an existing user changes their email address on their account page. To require an email verification step for these actions, open config/custom.js and change verifyEmailAddresses: false to verifyEmailAddresses: true.

To use an email service other than Mailgun:

Out-of-the box, if Mailgun is not configured for this app, the contact form and password recovery flow will fail outright unless an email address ending in "@example.com" is used. Luckily, if you wish to use another email service, the logic for sending emails is fairly contained. To switch to a service other than Mailgun, you'll need to make the following changes to your code:

  • Modify the code in api/helpers/send-template-email.js to use the email service of your choice.
  • In api/hooks/custom/index.js, remove the warnings related to Mailgun.

To remove Stripe integration:

Any features related to billing are automatically disabled if you don't have a Stripe publishable key & secret key in your custom config (sails.config.custom.stripePublishableKey and sails.config.custom.stripeSecret, respectively). Your app will not be negatively impacted or appear broken; it will merely have some extraneous code in places. If you don't anticipate integrating billing features into your app and want to remove this code entirely, you can make the following changes:

  • In the User model definition at api/models/User.js, remove the stripeCustomerId, billingCardBrand, billingCardLast4, billingCardExpMonth, and billingCardExpYear attribute definitions.
  • In the signup controller at api/controllers/entrance/signup.js:
    • Remove the line at the top requiring the Stripe dependency
    • Remove the block of code creating a Stripe customer. (If you have trouble finding where this happens, be sure to read the comments.)
    • In the call to User.create(), remove the stripeCustomerId property.
  • In the confirm email controller at api/controllers/entrance/confirm-email.js:
    • Remove the line at the top requiring the Stripe dependency.
    • Remove the block of code that handles creating/updating a Stripe customer. (If you have trouble finding where this happens, be sure to read the comments.)
  • Remove the update billing card endpoint and all references to it by doing the following:
    • Delete the file at api/account/update-billing-card.js.
    • In config/routes.js, delete the route configuration for 'PUT /api/v1/account/update-billing-card'.
    • In assets/js/cloud.setup.js, delete the updateBillingCard method.
    • In assets/js/pages/account/my-account.page.js, remove the clickStripeCheckoutButton method.
    • In views/pages/account/my-account.ejs, remove the HTML related to billing.
  • In api/hooks/custom/index.js, remove the warnings related to Stripe.
  • In api/hooks/custom/index.js, remove sails.config.custom.enableBillingFeatures = !isMissingStripeConfig;.

Where can I go for more help?

If you run into trouble, you can often find the answer in the Sails.js documentation. If you're stumped, be sure to check out the resources available on the support page.