Concepts
Concepts
How Anetos works, and why.
The app
- Glossary: 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: 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: 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: 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,route:listand commands of your own. Code generation lives elsewhere, in theanetosdeveloper tool, because it writes source code rather than running the app. - 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.
- Code generation: Queries in Anetos name columns with typed Go values, such as
PostCols.Title, thatanetos generatewrites 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: 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. - Performance: 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.
Web
- HTTP request lifecycle: What happens between a request arriving and a response leaving, and where your code can hook in.
- 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.
- Validation: How rules in struct tags become a cached plan, what
web.Hdoes with the result, and why validation works the way it does. - 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.
Data
- The data layer: How the db package finds its connection, turns method calls into SQL, and why it works the way it does.
- 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.
Accounts and security
- Authentication and authorization: How Anetos knows who is making a request, and what they may do.
- Roles and permissions: How package
auth/rbacdecides what a user may do, and where it keeps what it needs. - The audit log: How package
auditrecords every change of the models an app tracks, and why its entries can be trusted to match the data.
Working with AI
- AI: How package
aiconnects language models to the app, and what it leaves to the providers.