Build and Deploy Web Applications

With the Wolfram Language, you can quickly and easily turn programs into interactive web applications.

Cloud Deployment

Cloud Deployment

The Wolfram Language makes it easy to turn your code into a standalone interactive webpage so you can share your program with others. Using the CloudDeploy function, your code will be published to Wolfram Research servers and be made accessible to either everyone or to whomever you grant permission.

In this example, an interactive program for recognizing an image of a molecule is turned into a public webpage:

1. Make the content to be published:
LabelMoleculeDrawing[image_]:=MoleculePlot[MoleculeRecognize[image],<|"Carbonyl"->Bond[{"C","O"},"Double"],"Ring carbons"->Atom["C","RingAtomQ"->True]|>]
2. Use the CloudDeploy function to publish to the cloud:
CloudDeploy[FormFunction[{"molecule" -> "Image"}, LabelMoleculeDrawing[#image] &,"JPEG", AppearanceRules -> {"Title" -> "Molecule recognizer"}], Permissions -> "Public"]



In addition to deploying interactive webpages, you can also turn your code into an API (application program interface), which will allow other websites or programming languages to use your code.

1. Create an APIFunction:

Create an APIFunction that returns the distance between two cities.

In this example, TravelDistance returns a Quantity. Applying QuantityMagnitude to that result extracts just the numeric value, which is easier for an external program to process than a Quantity.

cityDistance = APIFunction[{"city1"->"City","city2"->"City"}, QuantityMagnitude@TravelDistance[#city1,#city2]&]
2. Deploy the APIFunction to the Wolfram Cloud:

Deploy the function to the cloud with Permissions → "Public" to make the API available to anyone.

cityDistance = APIFunction[{"city1"->"City","city2"->"City"}, QuantityMagnitude@TravelDistance[#city1,#city2]&] co=CloudDeploy[cityDistance,Permissions->"Public"]
3. Test the API from a browser:

Verify that the API works as you expect it to by calling it from a browser. To construct a URL that calls the API, right-click the URL in the CloudObject output of CloudDeploy and choose Copy Address.

Paste the URL into your browser, and specify the API arguments using a query string-for example, "?city1=Chicago&city2=Miami"

4. Call the API from a non-Wolfram language:

Get the code for calling the API from Python.

cityDistance = APIFunction[{"city1"->"City","city2"->"City"}, QuantityMagnitude@TravelDistance[#city1,#city2]&] co=CloudDeploy[cityDistance,Permissions->"Public"] EmbedCode[co, "Python"]

Get Started

Learning Resources

Learning Paths

Try it now, learn later

Want to just try it out? Get a feel for what the Wolfram Language is like while trying out real code samples focused on building and deploying web applications.

Try these instantly! Access with a free Wolfram Cloud account
Get certified for free in the Wolfram Language

We've made it easy to learn the Wolfram Language your way. Try our free interactive course and earn a certification.

Start the interactive online course now! About 20 hours for completion
Try these instantly! Access with a free Wolfram Cloud account
Start the interactive online course now! About 20 hours for completion

Go Further with Web Applications

Want to keep exploring web applications?

If you want to see more of what Wolfram offers for web operations, head to the Web Operations guide page. You'll find:

  • Specialized web operations functions
  • Information about interacting with APIs
  • Functions for setting up cloud-based web services
  • Related documentation
Learn more

Recommended Product