Capstone Projects
Escript with argparse; tasks stored with file:consult/file:write_file or the json module.
Project 1 — Command-line todo app (beginner)
Escript with argparse; tasks stored with file:consult/file:write_file or the json module. *Concepts: records/maps, lists, file I/O, escript.*
Project 2 — Bank account simulator (beginner/intermediate)
Accounts as processes; deposits, withdrawals, transfers via messages; monitors for crash detection. *Concepts: spawn, send/receive, refs, monitors.*
Project 3 — Key-value store with OTP (intermediate)
gen_server + ETS for storage, supervisor, application, EUnit + Common Test suites, specs + Dialyzer. *Concepts: gen_server, supervisor, application, ETS, testing.*
-module(kv).
-behaviour(gen_server).
-export([start_link/0, put/2, get/1]).
-export([init/1, handle_call/3, handle_cast/2]).
start_link() -> gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).
put(K, V) -> gen_server:call(?MODULE, {put, K, V}).
get(K) ->
case ets:lookup(?MODULE, K) of % reads bypass the server: no bottleneck
[{K, V}] -> {ok, V};
[] -> not_found
end.
init([]) ->
?MODULE = ets:new(?MODULE, [named_table, protected, {read_concurrency, true}]),
{ok, #{}}.
handle_call({put, K, V}, _From, S) -> true = ets:insert(?MODULE, {K, V}), {reply, ok, S}.
handle_cast(_Msg, S) -> {noreply, S}.Project 4 — TCP chat server (intermediate/advanced)
Ranch or gen_tcp acceptors, one process per client, rooms via pg, nicknames, private messages. *Concepts: networking, supervision, process groups, protocols.*
Project 5 — HTTP JSON API with Cowboy (advanced)
REST endpoints, PostgreSQL via pgo, JSON with json, WebSocket notifications, release + Docker. *Concepts: Cowboy, REST, DB pools, releases.*
Project 6 — Distributed job queue (advanced)
Jobs stored in Mnesia replicated across 3 nodes; workers on every node; automatic failover on nodedown. *Concepts: distribution, Mnesia, global/pg, gen_statem for job lifecycle.*
Project 7 — MQTT-like pub/sub broker (expert)
Binary protocol parsing with bit syntax, topic trie in ETS, QoS acknowledgements, back-pressure. *Concepts: binaries, ETS, gen_statem per connection, performance tuning.*
Project 8 — Hot-upgradable game server (expert)
A multiplayer game server (e.g., tic-tac-toe lobby) upgraded live with appup/relup while games keep running. *Concepts: releases, code_change, gen_statem, sys tracing.*