As you know, React, Vue and other frontend techs (Angular, Svelte) are becoming more and more popular nowadays.
In most cases, when people use the above techs, Django will work as an API server, for example, expose data to JSON API using
Django REST framework.
However, some people (including me) do not like the above approach, and they want a simple solution:
- They like to use classic Django form, Django templates, Django standard auth.
- Do not split the frontend and backend to keep infrastructure simple.
Why I recommend Hotwire
If you do some research, you will see there are already some solutions such as:
I prefer Hotwire because:
- It is the official frontend solution in Rails and is very popular in the PHP community.
- It has healthy ecosystem, there are many tutorials, blog, videos and open source projects on Github for us to use directly and learn.
- Hotwire can help you keep frontend code clean and easy to maintain.
- Hotwire can even help you to build
hybridmobile apps, it gives you a complete solution across all platforms.
You can go to Hotwire official Doc to learn more about it.
Considering there are no good tutorials about Hotwire and Django.
I decided to write a book to help people to learn Hotwire with Django in a systematic way and now it is published.
After reading this book, you will be able to:
- Learn Howtwire includes
Stimulus, and what problem they can help solve.
- Jump start frontend project bundled by Webpack.
- Use Tailwind CSS as your theme solution.
- Setup Turbo and Stimulus.
- Learn how page navigation works in
- Understand what is cache in Turbo Drive and how preview works.
- Learn what is
Turbo Frameand how it works.
Inline Editingfeature with
- Learn what is
- What is Stimulus
- Use Stimulus to build a Datetime picker and improve form submission process.
- Understand how to use events to do communication among Stimulus controllers
Type as searchfeature with Stimulus, Turbo and Django.
- Learn what is
Turbo Streamand how it works.
- How to build
Collaborative Editingbased on Websocket and
- Django channels
- Tailwind CSS
What is included
- A PDF ebook which contains about 40 chapters.
- The source code of the project.
The demo is available on http://hotwire-django.herokuapp.com/
Table of contents
- Create Project
- Setup Turbo
- Create Task App
- Render Django Form with Tailwind CSS Style
- Explore Turbo Drive (Page Navigation)
- Explore Turbo Drive (Cache)
- Turbo Drive and Django form validation
- Prepare to Learn Turbo Frame
- Turbo Frame Basics
- Turbo Frame and Django Form
- Inline Editing with Turbo Frames
- Prepare Django app to learn Stimulus Basics
- Stimulus Controller Basics
- Stimulus Controller (Actions, Values)
- Stimulus Controller (Targets, CSS classes)
- Stimulus Controller (Lifecycle)
- Stimulus Controller (3-party Resources)
- Stimulus Controller (Date Picker)
- Stimulus Controller (Form Submission)
- Prepare Django app to learn Stimulus and Turbo Frame
- Stimulus Controller (Flash Message)
- Build Stimulus Controller for Modal
- Load Form in the Modal
- Handle Form Submission in Modal
- Full Page Redirect in Modal
- Communication Among Stimulus Controllers Via Events
- Prepare Django app to learn Stimulus Stream
- Import Turbo Frame
- Turbo Stream Basics
- Use Turbo Stream to improve inline editing
- Filtering on the List Page
- Auto Search
- RealTime Update based on Websocket (Part 1)
- RealTime Update based on Websocket (Part 2)
- Next Steps