← All series

Series contents

Log in to track your progress

  1. 1. Simple Phoenix LiveView App: Setup Episode
  2. 2. Simple Phoenix LiveView App: Planning DB Schemas Episode
  3. 3. Simple Phoenix LiveView App: Upgrade to LiveView 0.5.1 Episode
  4. 4. Simple Phoenix LiveView App: Socket Session info, CSRF & .leex Episode
  5. 5. Simple Phoenix LiveView App: Scaffolding Users & Content Episode
  6. 6. Simple Phoenix LiveView App: PubSub & Index Episode
  7. 7. Simple Phoenix LIveView App: Show & Edit Pages Episode
  8. 8. Simple Phoenix LiveView App: Upgrade LiveView to v0.8.1 Episode
  9. 9. Simple Phoenix LiveView App: Fonts, logos and sass Episode
  10. 10. Simple Phoenix LiveView App: Markdown show notes Episode
  11. 11. Simple Phoenix LiveView App: The Podcast Listing Page Episode
  12. 12. Simple Phoenix LiveView App: Upgrade LiveView to v0.12.1 Episode
  13. 13. How I add auth to Phoenix LiveView apps Episode
  14. 14. Simple Phoenix LiveView App: planning comments Episode
  15. 15. Showing comment counts on the index page (Simple Phoenix LiveView App) Episode
  16. 16. Simple Phoenix LiveView app: Embedded comments form Episode
  17. 17. Passing redirect URLs + fragments Episode
  18. 18. Simple Phoenix LiveView App: Series Complete! Episode

Simple Phoenix LiveView App: Scaffolding Users & Content

This episode we'll be following our plan from our DB planning earlier.

We'll generate the needed contexts, schemas, migrations, controllers, views, and templates for users, podcast episodes and comments. We'll also set up a few basic validations.

Generating our schemas

mix phx.gen.html Accounts User users name email:unique is_verified:boolean password_hash website

yes | mix phx.gen.html Content Podcast podcasts audio_url is_published:boolean notes_html:text notes_md:text subtitle title:unique

yes | mix phx.gen.html Content Comment comments is_published:boolean is_flagged:boolean html:text markdown:text podcast_id:references:podcasts user_id:references:users

yes | mix phx.gen.context Content Topic topics name:unique

yes | mix phx.gen.context Content PodcastTopic podcast_topics podcast_id:references:podcasts topic_id:references:topics

Next up, we'll fully replace the User Controller and templates with LiveView and live templates!

(Source code available for premium members)

Open standalone page ↗

No Comments