# Elixir Level 7: GenServer

> Level 7: GenServer of the LoWisa Elixir course: Stateful Processes, Calls and Casts, Designing Reliable Servers. 3 lessons and 9 ideas, each explained in one line.

GenServer is level 7 of 16 of the [LoWisa Elixir course](/courses/elixir/). It has 3 lessons and 9 ideas. Below is every lesson and what it teaches, in one line each.

## Stateful Processes

- **GenServer.** A **GenServer** is the stateful-process behaviour: OTP’s battle-tested loop with your callbacks.
- **init and state.** **init** builds the initial state: threaded through every callback thereafter.
- **Process dictionary honestly.** State lives in the **callback** returns: not the process dictionary, which hides data from everyone.

## Calls and Casts

- **handle_call.** **call** is synchronous: the caller waits for a reply, with a timeout guarding it.
- **handle_cast.** **cast** is fire-and-forget: no reply, no confirmation, chosen deliberately.
- **handle_info.** **handle_info** receives everything else: monitors’ :DOWN, timers, raw messages.

## Designing Reliable Servers

- **Small state, clear API.** A good server owns **one** concern: its public API functions wrapping the message protocol.
- **Timeouts and hibernate.** Servers declare call **timeouts** and hibernate when idle: long-lived processes tuned by contract.
- **Avoid blocking the loop.** Slow work leaves the server: **tasks** do the waiting, the loop stays responsive.

## Before and after this level

- **Before:** [Level 6: Tasks & Agents](/courses/elixir/level-6-tasks-and-agents/): Tasks, Agents, Managing Concurrent Work.
- **Next:** [Level 8: Supervision & OTP](/courses/elixir/level-8-supervision-and-otp/): Supervisors, Supervision Trees, Fault-Tolerant Applications.

In the app each of these ideas is taught and then asked back, and the level ends with a checkpoint and flashcards. See [Checkpoints and flashcards](/help/checkpoints-and-flashcards/).

## Frequently asked questions

### What does Elixir Level 7: GenServer cover?

Stateful Processes, Calls and Casts, Designing Reliable Servers: 3 lessons and 9 ideas.

### What should I know before this level?

The level before it, Level 6: Tasks & Agents, which covers Tasks, Agents, Managing Concurrent Work.

## Learn Elixir on your phone

The first level is free. LoWisa is on Google Play and the App Store.

---

Source: https://lowisa.dev/courses/elixir/level-7-genserver/ · Updated 2026-11-25
