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.
* requires an API key
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:
assets/js/cloud.setup.js
file using sails run scripts/rebuild-cloud-sdk
.await Cloud.doSomething.with({…})
If you're unsure, click here.
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/
.
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
.
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.
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.
To disable Bootstrap:
assets/dependencies/bootstrap/
tasks/pipeline.js
, delete 'dependencies/bootstrap/dependencies/**/*.js',
from jsFilesToInject
To disable FontAwesome:
<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:
api/helpers/send-template-email.js
to use the email service of your choice.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:
User
model definition at api/models/User.js
, remove the stripeCustomerId
, billingCardBrand
, billingCardLast4
, billingCardExpMonth
, and billingCardExpYear
attribute definitions.api/controllers/entrance/signup.js
:
User.create()
, remove the stripeCustomerId
property.api/controllers/entrance/confirm-email.js
:
api/account/update-billing-card.js
.config/routes.js
, delete the route configuration for 'PUT /api/v1/account/update-billing-card'
.assets/js/cloud.setup.js
, delete the updateBillingCard
method.assets/js/pages/account/my-account.page.js
, remove the clickStripeCheckoutButton
method.views/pages/account/my-account.ejs
, remove the HTML related to billing.api/hooks/custom/index.js
, remove the warnings related to Stripe.api/hooks/custom/index.js
, remove sails.config.custom.enableBillingFeatures = !isMissingStripeConfig;
.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.