Optimizing Dockerfile for Phoenix mixed with Node, Rust & Tailwind
Heyplay is a game creation platform powered by Phoenix coupled with Node and Rust — an ultimate web development stack that deploys in seconds thanks to using Docker multi-staging to the fullest. Here’s the secret sauce plus extra hints for those into Tailwind or Umbrellas.
Read more on the Cloudless Studio blog.
How to handle map types in a Phoenix form ?
just a suggestion on how to handle map types in Phoenix forms https://blog.jasonkaniekete.fr/how-to-handle-map-type-in-a-phoenix-form/
Log all the things - blog post about features and possibilities of current Logger
This post was for a long time on “ready to publish” list, but finally I managed to do it. Here I try to describe all the features and capabilities of current Logger implementation that is backed by the Erlang logger.
https://hauleth.dev/post/log-all-the-things/
Enjoy
Fly.io Deploy Elixir Phoenix LiveView ~> 1.6 with Bulma and Tailwind CSS
This project is scaffold bulma and tailwind boilerplate code to project Elixir Phoenix ~> 1.6 that now uses esbuild.
Thanks to fly.io
Running
To start your Phoenix server:
-
Install dependencies with
mix deps.get -
Start Phoenix endpoint with
mix phx.serveror inside IEx withiex -S mix phx.server
Now you can visit localhost:4000 from your browser.
Testing
-
Enter
localhost:4000/to bulmacss and admin template. -
Enter
localhost:4000/tailwindto tailwindcss admin template.
Production
Ready to run in production? Please check our deployment guides.
NOW => How this project was made :D
-
Creating
mix phx.new phx_scaffold_bulma_tailwind –live –no-ecto - Install and configure dart_css.
- Install and configure bulma.
- Install and configure tailwind
-
Configure
mix.exs -
Configure
dev.exs
Follow complete steps:
1. Creating Phoenix 1.6 LiveView project
mix phx.new phx_scaffold_bulma_tailwind --live --no-ecto
2. Install dart_css
Follow instructions here.
3. Install bulma
npm i -D --prefix assets bulma
Import bulma.sass file into css/app.scss with:
@import "../node_modules/bulma/bulma.sass";
4. Install tailwindcss
npm i -D --prefix assets tailwindcss autoprefixer postcss postcss-loader
Create file assets/tailwind.config.js with:
module.exports = {
content: [
"../lib/**/*.html.eex",
"../lib/**/*.html.leex",
"../lib/**/*.html.heex",
],
theme: {
extend: {},
},
plugins: [],
}
Create file assets/postcss.config.js with:
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {}
}
}
Create file assets/css/tailwind.css with:
/* This file is for your main application CSS */
@tailwind base;
@tailwind components;
@tailwind utilities;
Import css/tailwind.css into assets/css/app.scss after css styles:
Here is last line of the file
@import "./tailwind.css";
Configure mix.exs into function aliases with:
# $ mix setup
#
# See the documentation for `Mix` for more info on aliases.
defp aliases do
[
setup: ["deps.get"],
"assets.deploy": [
"cmd npm --prefix assets install",
"tailwindcss --postcss --minify --input=css/tailwind.css --output=../priv/static/assets/tailwind.css",
"esbuild default --minify",
"sass default --no-source-map --style=compressed",
"phx.digest"
]
]
end
Configure dev.exs into watchers with npx instructions:
# For development, we disable any cache and enable
# debugging and code reloading.
#
# The watchers configuration can be used to run external
# watchers to your application. For example, we use it
# with esbuild to bundle .js and .css sources.
config :fvideen_platform, FvideenPlatformWeb.Endpoint,
# Binding to loopback ipv4 address prevents access from other machines.
# Change to `ip: {0, 0, 0, 0}` to allow access from other machines.
http: [ip: {127, 0, 0, 1}, port: 4000],
check_origin: false,
code_reloader: true,
debug_errors: true,
secret_key_base: "q8icUmJfcHI8LF9Ajh+WKBaIXlxER5k7Hdwu845pJO45MBjL8eg5bJ8o9cJyverv",
watchers: [
# Start the esbuild watcher by calling Esbuild.install_and_run(:default, args)
npx: [
"tailwindcss",
"--input=css/tailwind.css",
"--output=../priv/static/assets/tailwind.css",
"--postcss",
"--watch",
cd: Path.expand("../assets", __DIR__)
],
esbuild: {
Esbuild,
:install_and_run,
[:default, ~w(--sourcemap=inline --watch)]
},
sass: {
DartSass,
:install_and_run,
[:default, ~w(--embed-source-map --source-map-urls=absolute --watch)]}
]
TIL: Log SQL generated by Ecto migration
Understanding exactly what SQL commands are running is helpful to ensure safe migrations. By default, Ecto does not log the raw SQL. However, we can change it.
Check more on: https://bartoszgorka.com/log-sql-generated-by-ecto-migration
ThinkingElixir 079: Collaborative Music in LiveView with Nathan Willson
In episode 79 of Thinking Elixir, we talk with Nathan Willson about GEMS, his collaborative music generator written in LiveView. He explains how it’s built, the JS sound library integrations, what could be done by Phoenix and what is done in the browser. Nathan shares how he deployed it globally to 10 regions using Fly.io. We go over some of the challenges he overcame creating an audio focused web application. It’s a fun open-source project that pushes the boundaries of what we think LiveView apps can do!
Opensourse Bonfire social network got awarded from the European Cultural foundation
Based on Phoenix Framework and Phoenix LiveView, opensourse platform Bonfire social network got awarded from the European Cultural foundation https://bonfirenetworks.org/posts/bonfire_cos/
Building a simple Calendly clone with Phoenix LiveView (pt. 6)
👋🏼Here’s part six of the Building a simple Calendly clone with Phoenix LiveView series, in which we will start managing event types.
https://bigardone.dev/blog/2021/12/20/building-a-simple-calendly-clone-with-phoenix-live-view-pt-6
Happy coding!
json formatter plugin
Just published a mix format plugin for json. It works with jason sigils (v1.3+) and json file extension. https://hex.pm/packages/json_formatter
Suggestions are very welcome.
The Best Log Management Tools for Elixir Phoenix
We’ve done the testing and these are the best Elixir log management tools to give you insight into your production system logs.
ThinkingElixir 078: Logflare with Chase Granberry
In episode 78 of Thinking Elixir, we talk with Chase Granberry about Logflare. We learn why Chase started the company, what Logflare does, how it’s built on Elixir, about their custom Elixir logger, where the data is stored, how it’s queried, and more! We talk about dealing with the constant stream of log data, how Logflare is collecting and displaying metrics, and talk more about Supabase acquiring the company!
Creating Reusable Ecto Code
Creating a highly reusable Ecto API is one of the ways we can create long-term sustainable code for ourselves, while growing it with our application to allow for infinite combination possibilites and high code reusability. If we write our Ecto code correctly, we can not only have a very well defined split between query definition and combination/execution using our context but also have the ability to re-use the queries we design individually, together with others to create larger complex queries.
Cross-Cutting Elixir in Teams
Alex McClain helps us dig into what it means to use Elixir to replace pretty much every part of a typical stack. There are some very interesting potential advantages.
https://underjord.io/guest-feature-amclain-cross-cutting-elixir.html
What You Need to Know About Logging in Elixir with Logger
If you have bug or you app is not working as expected, your log files may be critical to fixing the issue. We discuss what you need know about logging in your Elixir Phoenix application.
Elixir Wizards S7E7 Casting Spells with Brooklin Myers
The latest episode of the Elixir Wizards podcast released this morning! Check it out: http://www.smartlogic.io/podcast/elixir-wizards/s7e7-myers/
DevChat.tv's #ElixirMix episode with Miguel Cobá
Check out this week’s episode of #ElixirMix with @MiguelCoba_. Learn all about the ins and outs of Deploying Elixir, its origins and different ways to deploy your applications
Elixir 1.13 released: The developer’s point of view
Let’s check what has changed in the latest version of Elixir. Most interesting, from my perspective, will be improving compilation time. However, that’s not all! New map support, information logging level and changes inside Inspect are waiting for you.
ThinkingElixir 077: EMPEX Mtn and Starting Knock with Chris Bell
In episode 77 of Thinking Elixir, we talk with Chris Bell, host of the Elixir Talk podcast and EMPEX conference organizer. Chris tells us about a new EMPEX chapter in the US Western states. EMPEX MTN will be in Salt Lake City, Utah. Chris started a new company called Knock using Elixir. We hear what problems it helps solve and more about his startup journey. A fun discussion with some tech insights, architecture overviews, and more on the roller coaster of starting your own thing!
TIL: How to remove unused dependencies from mix.lock
What if a dependency is no longer needed? One library less is potentially one place of conflict between different versions of dependencies less.
You can do it with one command, and clear your lock file.
Check on: https://bartoszgorka.com/clear-mix-lock
Elixir 1.13.0 New Features
https://blackode.medium.com/new-improvements-in-elixir-1-13-0-elixir-releases-80c8fe4a02ee
New Features in Elixir 1.13.0
This article comprises
- Different ways of using the new function Enum.slide/3
- Getting to know the IEX Autocompletion on sigils and structs and struct fields in an iex session
- Experiencing the improvement on Syntax Error Report
- Experiencing the Power operator ** from Kernel module
- How to use the new function Keyword.validate/2
- Newly added functions Task.ignore/1 and Task.completed/1
