Save weeks of time and build your React + Node.js SaaS application in minutes

Gravity is a SaaS boilerplate template for React & Node.js that has all the features you need in a single install.
Buy Now View Demo
Gravity Dashboard

147 Startups & Developers Trust Gravity

Features

If it takes you 4 weeks to build all these features. At $75 per hour that's a whopping $12,000.
You save $11,603

Read the Full Spec

Need a feature that we haven’t listed?

Gravity can be customised to include additional features that fit your project requirements.

Customise Gravity

Products Built With Gravity

Founders and freelancers use Gravity to test new ideas and build fully-loaded market-ready products

How it Works

Download the codebase and run the setup wizard – in less than two minutes, you’ll have a fully-functioning web application.

Examples

  • /*
    * account.create()
    * create a new account and stripe customer
    * process the payment and create a new recurring monthly subscription
    */
    
    exports.create = async function(req, res){
    
      const signup = req.body;
      let stripeData = {};
    
      // check if the account already exists
      const exists = await account.get(null, signup.email);
    
      if (exists)
        throw ({ inputError: "email", message: "You're already registered" });
    
      // create a stripe customer and subscribe them to a plan
      stripeData.customer = await stripe.customer.create(signup.email, signup.source);
      stripeData.subscription = await stripe.customer.subscribe(stripeData.customer.id, signup.plan);
    
      // create the account and user
      const accountId = await account.create(signup, stripeData);
      const userId = await user.create(signup.name, signup.email, signup.password, accountId, "owner");
    
      // send welcome email
      mail.send(signup.email, "Welcome to Gravity!", "welcome-account", {
        name: signup.name, plan: signup.plan, price: stripeData.subscription.price
      });
    
      // autheticate user
      authController.signin(req, res);
    
    };
    
    
  • /*
    * verify the api token
    */
    
    exports.verify = function(permission){
    
      return async function(req, res, next){
    
        try {
    
          const token = req.headers['authorization'];
          if (!token) throw new Error();
    
           // decode the json token
          let bearer = token.split(" ");
          const decode = jwt.verify(bearer[1], settings.token.secret);
    
          // verify user
          if (decode.accountId && decode.userId && decode.permission){
    
            // now verify the permission
            const userPermissions = getPermission(req);
    
            if (userPermissions[permission]){
    
              req.account = decode.accountId;
              req.user = decode.userId;
              next();
    
            }
            else
              throw new Error();
    
          }
          else
            throw new Error();
    
        }
        catch (err){
    
          res.status(401).send({ message: "You do not have permission to perform this action. Please try logging in again" });
    
        }
      }
    }
    
    

Powered By

Stripe Logo Mailgun Logo

Why Use Gravity?

As a founder and startup mentor, I've watched an endless number of businesses blowing huge budgets and wasting weeks of time creating standard features like login forms and billing.

I created Gravity to help developers and businesses to slash development costs and build products faster, empowering them to focus on building features that truly matter – the ones that generate revenue.

For a small fee, you'll have a market-ready web application that will save you weeks of time and thousands of dollars in in software development.

Get a head start on your Node.js SaaS app today

Buy Now