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)

Back to index

No Comments