We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
Level: Medium
Napkin-math based on lines added — not a strict rule. Tests, guides, and lockfiles are omitted for better accuracy (closer to SLOC than raw diff).
17
422
36
37 downloads
Related
Jump to file
- ∟ mix.exs
- ∟ assets/css/hosted.css
- ∟ assets/js/hosted.js
- ∟ config/config.exs
- ∟ config/dev.exs
- ∟ lib/my_app_hosted_web.ex
- ∟ lib/my_app_hosted_web/components/core_components.ex
- ∟ lib/my_app_hosted_web/components/layouts.ex
- ∟ lib/my_app_hosted_web/components/layouts/root.html.heex
- ∟ lib/my_app_hosted_web/controllers/error_html.ex
- ∟ lib/my_app_hosted_web/controllers/page_controller.ex
- ∟ lib/my_app_hosted_web/controllers/page_html.ex
- ∟ lib/my_app_hosted_web/controllers/page_html/show.html.heex
- ∟ lib/my_app_hosted_web/router.ex
- ∟ lib/my_app_web/controllers/hosted_controller.ex
- ∟ lib/my_app_web/endpoint.ex
- ∟ lib/my_app_web/routers/hosted_router.ex
Asset build tasks
The
assets.build and assets.deploy aliases are extended to compile both my_app and hosted profiles. The deploy alias minifies both CSS and JS bundles before running phx.digest.
|
|
|
|
|
|
|
|
| - |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
|
|
|
|
| + |
|
|
|
| + |
|
|
|
|
|
|
Hosted CSS
A separate Tailwind entry point for hosted sites. Uses
source(none) to disable automatic content detection, then explicitly sources from assets/css, assets/js, and lib/my_app_hosted_web — so it only includes classes actually used by hosted site code. No daisyUI plugin is included.
|
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
Hosted JavaScript
A minimal LiveSocket setup for hosted sites. Includes only the essentials: Phoenix HTML, LiveSocket with CSRF and long-poll fallback, and topbar for loading indicators. No admin-specific hooks, uploaders, or JavaScript are included.
|
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
Build configuration
Adds a
hosted profile to both esbuild and tailwind configurations. The esbuild config bundles js/hosted.js into priv/static/assets/js/hosted.js. The tailwind config compiles assets/css/hosted.css into priv/static/assets/css/hosted.css. Both run alongside the existing my_app profiles.
|
|
|
|
|
|
|
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
|
|
|
|
|
Dev watchers
Adds
esbuild_hosted and tailwind_hosted watchers so hosted assets rebuild on change during development. Also adds a live reload pattern for lib/my_app_hosted_web so changes to hosted components, controllers, and LiveViews trigger browser reloads.
|
|
|
|
|
|
|
|
| - |
|
| + |
|
| + |
|
| + |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| - |
|
| + |
|
| + |
|
|
|
|
|
|
MyAppHostedWeb module
The
MyAppHostedWeb module mirrors the structure of MyAppWeb but is completely independent. It defines its own controller, live_view, live_component, html, and router macros, all wired to MyAppHostedWeb-specific components and layouts.
Key differences from
MyAppWeb:
-
Imports
MyAppHostedWeb.CoreComponentsinstead of the admin components -
Uses
MyAppHostedWeb.Layoutsfor layout aliases -
Routes through
MyAppHostedWeb.Routerfor verified routes -
Shares the same endpoint (
MyAppWeb.Endpoint) and Gettext backend
This separation means hosted sites won't inherit any admin-specific UI (daisyUI, admin nav, etc.) and can be styled completely independently.
|
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
Core components
A minimal set of UI components for hosted sites using plain Tailwind CSS (no daisyUI). Includes only what's needed:
flash/1 for notifications, icon/1 for Heroicons, show/2 and hide/2 JS commands, and error translation helpers.
This is intentionally bare — hosted sites start with a clean slate and you add components as needed, rather than inheriting the full admin component library.
|
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
Layouts
The hosted layouts module provides a simple
app/1 layout with a centered content area and flash message group. The flash_group/1 component handles info/error flashes plus client-error and server-error reconnection states.
|
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
Root layout
The root HTML template loads
hosted.css and hosted.js instead of the admin's app.css and app.js. This is what makes the asset separation work — hosted sites get their own CSS and JS bundles with no admin code included.
|
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
Error HTML
A standalone error handler for hosted sites that returns plain status messages. Hosted sites get their own error rendering so they don't accidentally show admin error pages.
|
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
Page controller and templates
|
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
Page controller and templates
|
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
Page controller and templates
A simple page controller that renders the hosted site landing page. It passes the
current_site assign (set by the ServeHostedSite plug) to the template, which displays the site name. This is the starting point — replace this with whatever your hosted sites should render.
|
|
| + |
|
| + |
|
| + |
|
Hosted router
The hosted router replaces the previous
MyAppWeb.HostedRouter that lived inside the main app. It uses MyAppHostedWeb instead of MyAppWeb, giving it a clean browser pipeline without fetch_current_scope_for_user or any admin auth plugs. The root layout points to MyAppHostedWeb.Layouts instead of the admin layouts.
Currently has a single route:
GET / renders the site's landing page via PageController.
|
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
| + |
|
|
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
Endpoint update
The
ServeHostedSite plug now dispatches to MyAppHostedWeb.Router instead of MyAppWeb.HostedRouter. This is the only change needed in the endpoint — the plug already handles intercepting hosted requests before they reach the main router.
|
|
|
|
|
|
|
|
| - |
|
| + |
|
|
|
|
|
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
Install with Claude Code
Have Claude implement this feature in your project, along with anything it requires. Requires Claude Code to be installed.
With the elixir-saas skill
With the Claude Code skill installed, run this inside Claude Code:
/elixir-saas dns-hosting
Without the skill
Write instructions to implement this feature to your project directory in a LLM-friendly format, then have Claude take care of the rest:
curl "https://elixir-saas.com/llms/p/dns-hosting.md?v=1.8.3&f=impl" > dns_hosting.md;claude "Implement the feature that is documented in: dns_hosting.md." --allowedTools "Write Edit Bash(mix:*) Bash(mkdir:*)";