Blog App: Create the Backend

Deployment Type:

Author: Stitch Documentation Team

When completed, you will have a Stitch backend app fully built and configured to handle the basic requirements of a blog.

Time required: 15 minutes

What You’ll Need

  • A MongoDB Atlas account.
  • A MongoDB cluster hosted on Atlas. You can create an M0 Atlas cluster for free. To get up and running with a free M0 cluster, follow the MongoDB Atlas Getting Started guide.



Create a Stitch Application

We need to set up a Stitch application to connect the blog to MongoDB.

To create a new Stitch application:

  1. Log in to Stitch.
  2. Click Stitch Apps in the left-hand navigation of the MongoDB Atlas console.
  3. Click Create New Application.
  4. Give the application a name (e.g. BlogTutorial) and click Create.
  5. Wait for your application to initialize. Upon creation of your app, you will be redirected to the Stitch UI.

Turn on Anonymous Authentication

We need to enable an authentication provider so that users can log in and query MongoDB.

From the Getting Started page of the Stitch UI, enable Anonymous Authentication under the Turn On Authentication heading.


This tutorial uses anonymous authentication, but you can configure your app to let users authenticate with another method, such as email/password, Google OAuth, or a custom authentication system based on JSON Web Tokens.

See the Authentication Providers Overview for more information, including a complete list of available authentication providers.


Configure the blog.comments MongoDB Collection

We need to configure rules for the comments collection before Stitch will allow users to query it.

To configure the collection:

  1. Click Rules under MongoDB Atlas in the left-hand navigation of the Stitch UI.
  2. Click Add Collection.
  3. Enter blog for the Database Name.
  4. Enter comments for the Collection Name.
  5. Select No Template
  6. Click Add Collection.

You should now see the Permissions tab of the rules for the comments collection. The default role doesn’t allow any user to read or write to the collection.

To enable reading and writing to the comments collection:

  1. Click the Read and Write checkboxes for the default role.
  2. Click Save.


Congratulations! You have set up the Stitch backend app and are now ready to build a client.

What’s Next

Use the Blog App: Create a Web Client guide to step through the process of building the web front-end.