Clone this wiki locally
In this tutorial we will build an interesting pedestal-app application together. During this process you will be exposed to all of the major pedestal-app concepts in the context of solving some (almost) real problems. This will help you to see not only how things work, but why they work the way they do.
By the end of Part 2 of this tutorial, you will have created an interactive game and learned how to wield pedestal-app in your own projects. We also hope that you will know enough about how pedestal-app works and what its goals are so that you can give useful feedback and contribute to the project.
Each section of the tutorial will describe a few key concepts of pedestal-app while making a small improvement to the application. Part 1 will start very slowly with small code changes and lots of explanation. Each section of Part 2 will contain more code and move a lot faster.
To get the most out of this tutorial, you must follow along. The finished code for each section is tagged--if you're starting somewhere other than the first section, check out the tag for the previous section first.
Some sections of the tutorial are marked Designer and Back-end. If you are interested in all of Pedestal then go through each section. If you don't care about making templates, skip the Designer sections. If you don't care about back-end development then skip the Back-end section. Just remember, each section builds on code from the previous section, so if you skip one, make sure to check out the tag for the last section you skipped before continuing.
A version of Leiningen >= 2.2.0 is required for this tutorial.
Build a very simple application while learning the basics of pedestal-app.
- Creating a new pedestal-app project
Making a Counter
- Transform functions
- Dataflow definitions
- The input queue
- The Data UI
- Testing behavior code
- Sharing Clojure and ClojureScript code
Increment the Counter
- The default emitter
- Application model deltas
Simulating Service Push
- How pedestal-app applications communicate with the outside world
- Simulating services
- Effect functions
- Consuming effects from the effect queue
- Derive functions
- Working with dataflow inputs
- Monitoring dataflow performance
- Composing dataflow definitions
Making an HTML Template
- Compiling SCSS
- Static vs Dynamic Templates
- Template Slicing
- Recording interactions
- Playing recordings
- Writing rendering code
- Avoiding "callback hell"
Making the Service
- Creating a Pedestal service
- Using Server Sent Events
- Testing a service with
Connecting to the Service
- Communicating with a service
- Integrating application and service projects
- Development while running against the real service
Transform the application created in Part 1 into an interactive game while learning advanced pedestal-app concepts.
- Changing Requirements
Integrating the new Design
Rendering the Game
- Messages with parameters
- Timed events
Rendering the Login Screen
- Static templates
Start a Game
- Changing focus based on state changes
- Continue functions
- Generating new messages for the input queue
Rendering the Wait Screen
End a Game
Update Wait Template
Rendering End of Game
- Using Web Workers to run dataflow in parallel with rendering
- Query the application model tree
Post Tutorial Changes
Some changes and improvements have been made after the tutorial was finished. In most cases these changes have been integrated into the tutorial text but not into the source code. Use the diff below to view these changes.
- Describe what is included in the generated files
- Starting from scratch - show how to get started without using the generated files
- Using pedestal-app with lein cljs-build