Concepts
Concepts
How Anetos works, and why.
- AI: How package
aiconnects language models to the app, and what it leaves to the providers. - Application lifecycle: 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.
- Authentication and authorization: How Anetos knows who is making a request, and what they may do.
- Code generation: Queries in Anetos name columns with typed Go values, such as
PostCols.Title, thatanetos genwrites 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. - Configuration: Where settings come from, how they become typed Go structs, and why a bad setting stops the app before it serves a single request.
- HTTP request lifecycle: What happens between a request arriving and a response leaving, and where your code can hook in.
- Internationalization: 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.
- Migrations: Migrations are Go values compiled into your binary. The runner applies them in ID order, records each one in the
migrationstable 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. - One binary: 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:runby default, orserve,migrate,routes:listand commands of your own. Code generation lives elsewhere, in theanetosdeveloper tool, because it writes source code rather than running the app. - Roles and permissions: How package
auth/rbacdecides what a user may do, and where it keeps what it needs. - Runtime supervisor: 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.
- Server-rendered HTML: 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.
- Testing model: What
anetostestbuilds 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. - The data layer: How the db package finds its connection, turns method calls into SQL, and why it works the way it does.
- Validation: How rules in struct tags become a cached plan, what
web.Hdoes with the result, and why validation works the way it does.