Skip to content

A self publishing platform and presentation framework on fire built with Elixir βš—οΈ & Phoenix LiveView πŸ¦β€πŸ”₯

License

Notifications You must be signed in to change notification settings

j4nk3e/alchemy_pub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

44 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AlchemyPub

AlchemyPub is a static site generator on fire built with Elixir & Phoenix LiveView.

It generates websites from markdown files. Changes to the source files are instantly published to all viewers. If no JavaScript is available on the client, it falls back gracefully to fully server-side rendered content. There is also an RSS feed generated from the articles.

Instead of saving generated pages as html files, they are rendered on startup and stored in memory using ETS. A file watcher picks up changes and broadcasts them using PubSub. Using the magic of Phoenix LiveView the change is immediately visible to all page viewers.

As a markdown parser, Earmark is used because of its possibilities to add custom transformers. This way, [[Wikilinks]]-style references are resolved and anchors are automatically generated for headers.

For styling, daisyUI allows easy change of themes and creation of your own style using Tailwind. The site is fully responsive for mobile and desktop resolutions, and supports themes for dark and light mode. Code blocks are automatically highlighted using highlight.js.

With LiveDeck, AlchemyPub comes with an interactive presentation framework. It can turn any markdown page into a dynamic, interactive presentation. You can see an example of LiveDeck running here.

LiveDeck example

Page visits are tracked anonymously. Thanks to Phoenix Presence, it can keep track of navigation and the duration of each page visit. This also powers the live online counter in the navigation bar. The tracking data is stored in a file based SQLite database using Ecto. No external database or configuration is required. The tracking data can be viewed through the Phoenix LiveDashboard.

Getting Started

To start your Phoenix server:

  • Run mix setup to install and setup dependencies
  • Start Phoenix endpoint with mix phx.server or inside IEx with iex -S mix phx.server

Now you can visit localhost:4000 from your browser.

Put your pages as markdown files in the priv/pages directory. You can read more on the Home page.

Ready to run in production? Please check the Phoenix deployment guides.

Release

mix assets.deploy
MIX_ENV=prod mix release
mix phx.digest.clean --all
PHX_SERVER=true PHX_HOST=localhost SECRET_KEY_BASE="{{ key }}" _build/prod/rel/alchemy_pub/bin/alchemy_pub start

Deployment on fly.io

Set an admin secret

flyctl secrets set ADMIN_SECRET=(openssl rand -base64 48)

And deploy

flyctl deploy

Credits

AlchemyPub is originally brought to you by j4nk.dev. It is published under the Apache License 2.0.

Roadmap

  • Add date support for articles
  • Use date for navigation
  • Menu generation & navigation
  • Title parsing from content header
  • Tags support
  • Toplevel pages
  • Icon support
  • Hidden pages
  • Write tests
  • Write documentation
  • Publish on Github
  • Live page add/remove support
  • Legal stuff
  • Deployment
  • Live viewer count
  • Live tracking
  • Slide support
  • Keyboard navigation
  • Tracker visualization
  • Static content updates (images)
  • LiveView patch tag navigation support

About

A self publishing platform and presentation framework on fire built with Elixir βš—οΈ & Phoenix LiveView πŸ¦β€πŸ”₯

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Contributors