To start your Phoenix server:
- Run
mix setupto install and setup dependencies - Start Phoenix endpoint with
mix phx.serveror inside IEx withiex -S mix phx.server
Now you can visit localhost:4000 from your browser.
Ready to run in production? Please check our deployment guides.
- Implemented a mocked price fetcher for development
- Created
CryptoTracker.Fetcherto fetch live prices from CoinMarketCap API - Added environment variable support for API key via
.envfiles - Implemented a
PriceTrackerGenServer per coin - Introduced
CoinTrackerSupervisor(DynamicSupervisor) to manage coin processes - Set up
Registryto uniquely identify each coin GenServer - Price fetching and database insertion works correctly
- Handled
:utc_datetimemicroseconds issue with DB inserts
- Switch from
Process.send_afterto:timer.send_intervalfor fixed update intervals - Add retry/backoff logic for API failures to prevent temporary outages from crashing the GenServer
- Decouple fetching from database writes for better fault tolerance
- Introduce telemetry events to track fetch success, latency, and errors
- Configure an in-memory cache (ETS or
:persistent_term) for fast price reads - Enable dynamic addition of new coins at runtime
- Implement global rate limiting to respect CoinMarketCap API quotas
- Create a mock/stub Fetcher for tests to avoid hitting the real API
- Add logging/alerts for repeated GenServer crashes or failed fetches