Skip to content

Instantly share code, notes, and snippets.

@opsb
Created April 19, 2017 16:46
Show Gist options
  • Save opsb/d0977bcb30b42302f3f2dc3daf0befec to your computer and use it in GitHub Desktop.
Save opsb/d0977bcb30b42302f3f2dc3daf0befec to your computer and use it in GitHub Desktop.
Elm SPA structure
AppState (Main.elm delegates to one of these)
LoggedIn
Context.elm
Init.elm
Model.elm
Msg.elm
Subscriptions.elm
Update.elm
UrlUpdate.elm
View.elm
LoggedOut
Context.elm
Init.elm
Model.elm
Msg.elm
Subscriptions.elm
Update.elm
UrlUpdate.elm
View.elm
Components (reusable view modules, may include any combination of view/update/Model but few have their own update/Model)
AvatarPicker.elm
MessageEditor.elm
UsersAutocomplete.elm
Data (records that synchronised from the server's database using the Store)
User.elm
Conversation.elm
Message.elm
Pages (mini Elm apps corresponding to pages)
PageOne
Sections (in complicated pages we split out mini apps for different parts of the page, they're all use the Store for data synchronisation locally and server side)
ConversationShow
Init.elm
Model.elm
Msg.elm
Subscriptions.elm
Update.elm
UrlUpdate.elm
View.elm
FeedShow
Init.elm
Model.elm
Msg.elm
Subscriptions.elm
Update.elm
UrlUpdate.elm
View.elm
Init.elm
Model.elm
Msg.elm
Subscriptions.elm
Update.elm
UrlUpdate.elm
View.elm
Services (reusable services, they're used in update functions and never have a view)
Debounce.elm
OneSignal.elm
ScrollTracker.elm
Store (responsible for data synchronisation over a websocket - the backend is elixir phoenix)
Channels/
Model.elm
State.elm
Status.elm
Subscriptions.elm
Main.elm
Utils/
Config.elm
Main.elm (delegates to AppState.LoggedIn or AppStage.LoggedOut)
Model.elm
Msg.elm
Ports.elm
Router.elm (responsible for mapping routes to/from the url)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment