Skip to content

aayushmau5/phoenix.aayushsahu.com

Repository files navigation

phoenix.aayushsahu.com

Internally called Accumulator

Local Setup

Requires: Elixir, PostgresSQL.

This application uses PostgresSQL. You can either install it manually or through docker. If the port is different, you need to make changes to the config/dev.exs file.

To start your Phoenix server:

  • Clone the repo
  • 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.

Ready to run in production? Please check our deployment guides.

Learn more

Internals

Dashboard

All the data is stored on Postgres. The first render shows dummy data. As soon as liveview connection is established, we fetch data from postgres, and current user on the website count(using Presence) and update the client. Liveview also subscribes(through Phoenix PubSub) to a particular topic(with "update:" prefix) to get some updates.

Whenever data is updated(a new user visits my website/blog), we send a pubsub message to a that "update:" topic. The liveview gets a message on this topic, fetches latest data from redis and presence count, and updates the liveview.

High overview on how everything fits together:

Illustration