Skip to main content

The TODO Application


Please make sure that you've completed and are comfortable with the quickstart before moving on to any of these guides.

This guide will walk you through building a TODO application and host it in your Cosmonic constellation.

About the Application

TODO is nearly as ubiquitous in the world of samples as "Hello World". We see it used to illustrate how to build user interfaces, how to design databases and, of course, how to build backends and RESTful services.

This application allows a user to define items in a TODO list. They can indicate when these tasks are due and they can update tasks to indicate their completion. Finally, users can also delete items from the list. There are some slightly more complex variants of this application, but we decided to keep to the basics for this version.

Architecture and Design

RESTful TODO Architecture

This application accepts requests over HTTP. Some of these requests may be to pull UI elements like HTML, JavaScript, and CSS. Other requests may go to an API resource that the UI relies upon for queries and mutations. Unlike traditional implementations of this example, we don't need to create multiple services. We can, instead, build 3 simple actors and deploy them to a single host, or scale them horizontally to meet any demand.

API Gateway

The API gateway actor is bound to a single capability provider, a web server. This HTTP server provider handles opening a port and managing HTTP requests. Our actor needs only to respond to incoming requests and then return the appropriate response. Depending on the request, it could respond by consulting the UI actor or it could respond by making requests of the core TODO actor.

UI Actor

The UI actor is essentially a holder of static assets. For this example, to keep things simple, we've embedded the static assets for the TODO UI directly in the WebAssembly module. However, in more scalable scenarios, we could easily use a blob store like S3 to retrieve our static assets or integrate with a CDN, for that matter.

TODO Actor

The TODO actor is responsible for the basic read/write (aka CRUD) operations applied to todo items and lists. This will be accomplished by virtue of a link to a SQL capability provider. In a classic microservices world, this would be a microservice that deploys tightly coupled to a specific database like PostgreSQL or MS-SQL. Using actors, we can build against the contract and bind to whichever database suits our needs in whichever environment we're operating.

Implementation Walkthrough

The following guide will walk you through building and deploying the TODO example from start to finish.

Until the walkthrough is complete, you can see other variants of the TODO application in the wasmCloud GitHub repository.