Port 4000 — Jekyll & Phoenix

Port 4000 is shared by two frameworks from entirely different language ecosystems: Jekyll (Ruby static site generator, the engine behind GitHub Pages) and Phoenix Framework (Elixir, built for real-time web and high concurrency). If you're seeing localhost:4000, it's almost certainly one of these two — Jekyll if you're working on a blog or documentation site, Phoenix if you're building a backend application in Elixir.

Open port 4000: localhost:4000

Jekyll — GitHub Pages Static Sites

Jekyll converts Markdown files, Liquid templates, and front matter YAML into a complete static HTML website. It's the official generator behind GitHub Pages — push a Jekyll repository to GitHub and it automatically builds and deploys your site. Jekyll's development server runs on port 4000 with live reload.

Jekyll Quick Start

# Install Jekyll (requires Ruby 2.7+)
gem install jekyll bundler

# Create a new site
jekyll new my-blog
cd my-blog

# Start dev server with live reload
bundle exec jekyll serve
# → http://localhost:4000

# Build for production (outputs to _site/)
bundle exec jekyll build

Jekyll Project Structure

my-blog/
├── _config.yml       # Site config: title, baseurl, plugins
├── _posts/           # Blog posts: YYYY-MM-DD-title.md
├── _layouts/         # HTML layout templates
├── _includes/        # Reusable template fragments
├── _data/            # YAML/JSON data files
├── assets/           # CSS, JS, images
└── _site/            # Built output (git-ignored)

Changing Jekyll's Port

# Different port
bundle exec jekyll serve --port 4001

# Serve on all interfaces (for LAN access)
bundle exec jekyll serve --host 0.0.0.0

# In _config.yml
port: 4001

Common Jekyll Plugins

PluginPurpose
jekyll-feedAuto-generates RSS/Atom feed
jekyll-seo-tagAdds meta/OG tags for SEO
jekyll-sitemapAuto-generates sitemap.xml
jekyll-paginateBlog post pagination
jekyll-minifyMinify HTML/CSS/JS output

Phoenix Framework — Elixir Web Apps

Phoenix is Elixir's premier web framework — designed for building real-time, highly concurrent applications. Built on the BEAM VM (Erlang's virtual machine), Phoenix handles millions of simultaneous WebSocket connections with low memory. It's used for real-time chat, collaborative tools, live dashboards, and APIs that need to handle high traffic. Phoenix's dev server runs on port 4000.

Phoenix Quick Start

# Install Elixir and Phoenix generator
mix archive.install hex phx_new

# Create a new Phoenix app
mix phx.new my_app
cd my_app

# Install dependencies and set up database
mix deps.get
mix ecto.create

# Start dev server
mix phx.server
# → http://localhost:4000

# Interactive console with server
iex -S mix phx.server

Phoenix LiveView

Phoenix LiveView is Phoenix's standout feature — it enables real-time, reactive UIs without writing JavaScript. Updates happen server-side and are pushed to the browser over WebSocket. LiveView components render on first request as regular HTML (good for SEO), then establish a persistent WebSocket connection for live updates. All the real-time logic stays in Elixir on the server.

Changing Phoenix's Port

# config/dev.exs
config :my_app, MyAppWeb.Endpoint,
  http: [ip: {127, 0, 0, 1}, port: 4001],
  # ...

# Or via environment variable
PORT=4001 mix phx.server

Other Apps on Port 4000

AppNotes
Hasura GraphQL EngineAuto-generates a GraphQL API from your PostgreSQL database — default port 8080, sometimes configured to 4000
FoundationDBDistributed key-value database — uses 4000 for some coordination services
Gitbook (legacy CLI)Old Gitbook CLI served documentation at localhost:4000

Troubleshooting

ProblemFix
Jekyll: Address already in useAnother Jekyll or Phoenix instance is running — kill it with lsof -ti :4000 | xargs kill
Jekyll: livereload not workingAdd --livereload flag: bundle exec jekyll serve --livereload
Phoenix: Ecto (database) error on startRun mix ecto.create to create the database — Phoenix assumes PostgreSQL by default
Phoenix: can't access from phone on LANChange IP binding in dev.exs: ip: {0, 0, 0, 0} instead of {127, 0, 0, 1}