# Concepts

Source: https://docs.anetos.dev/main/concepts/

How Anetos works, and why.


## The app

- [Glossary](https://docs.anetos.dev/main/concepts/glossary/index.md): The words these pages use, what each means in Anetos, and the words other frameworks use for the same thing when they differ. Anetos uses the word Go developers already know for Go-shaped things, and the word web frameworks share for framework concepts. A new word appears only for a new idea, and is listed here.
- [Application lifecycle](https://docs.anetos.dev/main/concepts/application-lifecycle/index.md): An Anetos application goes through five phases: **New → Register → Boot → Run → Shutdown**. Knowing which code runs in which phase tells you where to put configuration, wiring, connections and cleanup.
- [Runtime supervisor](https://docs.anetos.dev/main/concepts/runtime-supervisor/index.md): Every Anetos application runs its long-lived work (HTTP servers, queue workers, pub/sub listeners, the scheduler, background tasks) as goroutines inside one process, managed by a **supervisor**. It decides what runs, what happens when something fails, and how everything stops.
- [Commands and the app binary](https://docs.anetos.dev/main/concepts/commands/index.md): Your app builds to one binary that is both the server and its maintenance tool. `app.Execute()` reads the first argument and runs that command: `run` by default, or `serve`, `migrate`, `route:list` and commands of your own. Code generation lives elsewhere, in the `anetos` developer tool, because it writes source code rather than running the app.
- [Configuration](https://docs.anetos.dev/main/concepts/configuration/index.md): Where settings come from, how they become typed Go structs, and why a bad setting stops the app before it serves a single request.
- [Code generation](https://docs.anetos.dev/main/concepts/code-generation/index.md): Queries in Anetos name columns with typed Go values, such as `PostCols.Title`, that `anetos generate` writes from your model structs. The compiler checks every column name and every value's type, and nothing has to look a column up at query time.
- [How testing works](https://docs.anetos.dev/main/concepts/testing/index.md): What `anetostest` builds for a test, how it keeps tests from seeing each other's data, how its client imitates a browser, and where a test run differs from production.
- [Performance](https://docs.anetos.dev/main/concepts/performance/index.md): What a request costs in Anetos, where the time goes in a real page, and how the framework is kept from getting slower. The numbers come from the repository's benchmarks, with their method and code: [docs/benchmarks/v0.3.md](https://github.com/anetos-dev/anetos/blob/main/docs/benchmarks/v0.3.md).

## Web

- [HTTP request lifecycle](https://docs.anetos.dev/main/concepts/http-request-lifecycle/index.md): What happens between a request arriving and a response leaving, and where your code can hook in.
- [Server-rendered HTML](https://docs.anetos.dev/main/concepts/server-rendered-html/index.md): How pages are rendered, how a visitor's state travels in an encrypted cookie, and how a failed form finds its way back to the page it came from.
- [Validation](https://docs.anetos.dev/main/concepts/validation/index.md): How rules in struct tags become a cached plan, what `web.H` does with the result, and why validation works the way it does.
- [Internationalization](https://docs.anetos.dev/main/concepts/internationalization/index.md): How Anetos finds the words to show a user: where messages come from, how a request's language is chosen, and how the language travels with work done for the user later.
- [Frontends](https://docs.anetos.dev/main/concepts/frontends/index.md): Anetos serves a frontend three ways: pages rendered on the server with templ and htmx; pages written as React, Svelte or Vue components that Inertia renders, with the Go side unchanged; and a JSON API with a frontend of its own, a single-page app or a mobile app. This page is how each works, what each keeps in Go, and how to choose.

## Data

- [The data layer](https://docs.anetos.dev/main/concepts/data-layer/index.md): How the db package finds its connection, turns method calls into SQL, and why it works the way it does.
- [Migrations](https://docs.anetos.dev/main/concepts/migrations/index.md): Migrations are Go values compiled into your binary. The runner applies them in ID order, records each one in the `migrations` table with the batch it ran in, and wraps each in a transaction where the database allows it. A database lock keeps two instances from migrating at once.

## Accounts and security

- [Authentication and authorization](https://docs.anetos.dev/main/concepts/authentication/index.md): How Anetos knows who is making a request, and what they may do.
- [Roles and permissions](https://docs.anetos.dev/main/concepts/roles-and-permissions/index.md): How package `auth/rbac` decides what a user may do, and where it keeps what it needs.
- [The audit log](https://docs.anetos.dev/main/concepts/audit-log/index.md): How package `audit` records every change of the models an app tracks, and why its entries can be trusted to match the data.

## Working with AI

- [AI](https://docs.anetos.dev/main/concepts/ai/index.md): How package `ai` connects language models to the app, and what it leaves to the providers.
