CompanyAugust 8, 2020

Developer Newsletter: Run this new JAM Stack + Cassandra Demo in a few clicks

Jeffrey Carpenter
Jeffrey CarpenterSoftware Engineer - Stargate
Developer Newsletter: Run this new JAM Stack + Cassandra Demo in a few clicks

This issue edited by Séan Bogaard, Developer Learning @ DataStax

We’re seeing more and more interest in accessing Apache Cassandra from JavaScript applications. This is accelerating with the launch of Astra, our Cassandra as-a-service offering,  as well as the increasing popularity of applications using the JAM Stack (JavaScript, APIs and Markup). JAM Stack is an innovative approach that makes web applications easy to write, deploy, scale, and also maintain. Using this approach means that newly created content is rendered from a content API, while a static render of it is being built into the site for the future.

In this edition, we’ll focus on a sample JAM Stack application - it’s a “Todo List” app that uses ReactJS and the free tier of Astra. You can deploy your own copy to Netlify or Gitpod in just a few clicks, or run a local copy on your desktop. Access the example at: https://github.com/DataStax-Examples/todo-astra-jamstack-netlify.

How does it work?

To set up the application you’ll need a DataStax Astra account and free-tier Cassandra database. When you deploy the application, you’ll provide your Astra credentials and the application will create the necessary tables in the database. The web service will be available on port 8080 once the application has been deployed. You have three options for deploying which we’ll describe below, or watch our walkthrough video:

Option 1: Running on Gitpod

  1. Once you have created both an Astra account and database, click the 'Open in Gitpod' link:  “Open in Gitpod”
  2. Wait for your Gitpod workspace to start
  3. Set your Astra database details in the Gitpod terminal at the bottom of the screen
  4. Click the 'Open browser' button in the bottom right of the screen
  5. View your application

Option 2: Deploying to Netlify

  1. Once you have created both an Astra account and database, click the 'Deploy to Netlify' button: “Deploy in Netlify”
  2. Connect your GitHub account
  3. Fill in the Netlify environment variables with information on your Astra database
  4. Click 'Save and Deploy'
  5. Wait for your app to deploy (this will take a minute or two, the screen will auto-refresh when the deployment is complete)
  6. Click your Netlify app link to view your live app
  7. You've deployed your app to Netlify! 

Option 3: Running on your local machine

  1. Click 'Use this template' at the top of the README
  2. Enter a repository name and click 'Create repository from template'
  3. Clone the repository on your local machine
  4. cd to the cloned repository and install Node dependencies: npm install.
  5. Find the values for the Astra variables from the Astra database dashboard. One exception is the ASTRA_DB_ID variable. It is the string in the URL after https://astra.datastax.com/org/. Set ASTRA_DB_USERNAME, ASTRA_DB_PASSWORD, ASTRA_DB_KEYSPACE, ASTRA_DB_ID, and ASTRA_DB_REGION environment variables using the shell command export <ENV_VAR_NAME>=<value>.
  6. In the cloned repository, build the app: npm start.
  7. Open http://localhost:8080 to view your application

With the steps listed here, you can take this example and apply it to your personal application development. Our goal is to speed up your development lifecycle and showcase how to leverage Astra as an asset in your day to day focus.

Learning Updates 

  • DataStax for Developers - as you may recall, we launched our new developer site a few weeks back and we’re continuing to add content. Check out our new hands-on learning series on Cassandra Fundamentals and new pages on accessing Astra using REST and GraphQL APIs. 
  • We’ve also been working to modernize our DataStax Academy site and to streamline our certification process. Check out the developer site for more details, and email us at academy@datastax.com with any questions or issues. 

Upcoming Events 

  • Cassandra Workshop series - We’re in the homestretch of our 8 week series including  Cassandra basics, Cassandra data modeling, and application development with Cassandra. If you want to catch up on sessions from prior weeks, check out the recordings on the DataStax Devs YouTube channel.
  • New Cassandra.Link Jobs Section - Brand new section which aggregates and classifies jobs that ONLY relate to Cassandra. Give it a go! 
  • Data Engineering Nanodegree by Udacity - A very popular course on Udacity which covers several topics such as data modeling for Cassandra, Python, and Apache Spark. 
  • Deep Learning Wizard - Soup to nuts, everything you need to build scalable deep learning applications, with a special section on using Cassandra. 


Do you have a cool demo to share or a topic to suggest? We’d love your feedback: developer@datastax.com | @DataStaxDevs

Share

One-stop Data API for Production GenAI

Astra DB gives JavaScript developers a complete data API and out-of-the-box integrations that make it easier to build production RAG apps with high relevancy and low latency.