# Anetos docs > The documentation of Anetos, a batteries-included web framework for Go. This is the documentation of Anetos main (unreleased). Each link below is a page's Markdown copy; its HTML page is the same address without "index.md" (or without ".md"). Every page in one file: https://docs.anetos.dev/llms-full.txt. In an Anetos project, `go tool anetos docs` prints these pages at the project's version, and `go tool anetos docs --search ""` searches them. ## Getting started - [Getting started](https://docs.anetos.dev/getting-started/index.md): From nothing to an app with pages, accounts and tests, in the order you'd do it. About fifteen minutes; the tutorial then builds a whole app in an hour. ### Installation - [Installation](https://docs.anetos.dev/getting-started/installation/index.md) - [Install Anetos](https://docs.anetos.dev/getting-started/install/index.md): Anetos needs Go and its command-line tool, anetos, which creates projects and writes code. - [Set up your editor](https://docs.anetos.dev/getting-started/editor/index.md): An Anetos app's code is Go, and its pages are templ files (.templ): HTML with Go expressions, compiled to Go. Your editor needs to know both. - [Choose a database](https://docs.anetos.dev/getting-started/databases/index.md): Anetos apps run on SQLite, PostgreSQL, MySQL and MariaDB. Pick one when you create the project; you can switch later. - [Build with a coding agent](https://docs.anetos.dev/getting-started/coding-agents/index.md): Coding agents such as Claude Code, Codex, Cursor, Gemini CLI and GitHub Copilot can build an Anetos app with you. Every project anetos new makes is ready for … ### Your first app - [Your first app](https://docs.anetos.dev/getting-started/your-first-app/index.md) - [Create a project](https://docs.anetos.dev/getting-started/create-a-project/index.md): One command writes a working app: a home page in a styled layout, sessions, CSRF protection, migrations, a queue, email, a test, and the files to deploy it. - [Project structure](https://docs.anetos.dev/getting-started/project-structure/index.md): A project is a Go module. Its folders follow what each part of the app does; the generators (make:crud, make:auth…) add their files in the same places. - [Add pages for a model](https://docs.anetos.dev/getting-started/crud/index.md): make:crud writes a model with its table, and the pages to list, show, create, edit and delete its rows, made of your app's UI components, with their routes and … - [Add accounts](https://docs.anetos.dev/getting-started/add-accounts/index.md): make:auth writes user accounts into your app: registration, login with "remember me", login with Google and GitHub, email verification, password reset, … - [Test and build](https://docs.anetos.dev/getting-started/test-and-build/index.md): go test ./... ### Tutorial: build an issue tracker - [Tutorial: build an issue tracker](https://docs.anetos.dev/getting-started/tutorial/index.md): In this tutorial you build a small issue tracker: people sign up, open issues, comment on them, search them, and get an email when someone comments on theirs. … - [1. Create the app](https://docs.anetos.dev/getting-started/tutorial/01-create-the-app.md): You create the project, run it, and look around. - [2. Accounts](https://docs.anetos.dev/getting-started/tutorial/02-accounts.md): Issues have authors, so the app needs accounts. One command writes them. - [3. Issues](https://docs.anetos.dev/getting-started/tutorial/03-issues.md): You add the issues: a model and its table, pages to list, open and edit them, and a test. - [4. The issue page](https://docs.anetos.dev/getting-started/tutorial/04-the-issue-page.md): Each issue gets its page, with comments that post without reloading the page, and a button to close it. - [5. Search](https://docs.anetos.dev/getting-started/tutorial/05-search.md): You add a search box that finds issues by the words in their title and description, best matches first, from a full-text index in the database. - [6. Email the author](https://docs.anetos.dev/getting-started/tutorial/06-email-the-author.md): When someone comments on an issue, its author gets an email. The comment handler of part 4 already emits CommentAdded; you add the email and a listener that … - [7. Deploy](https://docs.anetos.dev/getting-started/tutorial/07-deploy.md): You build the app for production: one binary with everything in it, or a container image. ### Your first API - [Your first API](https://docs.anetos.dev/getting-started/your-first-api/index.md) - [Tutorial: build an API](https://docs.anetos.dev/getting-started/build-an-api/index.md): Build a JSON API for bookmarks: people sign up, get a token, and save links that only they see; a token made for a script can read them but not change them; and … ## Guides - [Guides](https://docs.anetos.dev/guides/index.md): How to do one thing, step by step. ### Basics - [Basics](https://docs.anetos.dev/guides/basics/index.md) - [Routing](https://docs.anetos.dev/guides/routing/index.md): Map URLs to handlers, group routes under shared prefixes and middleware, name them, and generate URLs from names. - [Handlers and requests](https://docs.anetos.dev/guides/handlers/index.md): Write handlers that receive typed input, return typed output, and turn errors into proper HTTP responses. - [Render HTML with templ](https://docs.anetos.dev/guides/views/index.md): Write pages as templ components (typed, compiled, escaped by default), share a layout, link to routes by name, serve static files with cache-busting URLs, and … - [Style your app](https://docs.anetos.dev/guides/styling/index.md): A new project looks finished from the first page. Its pages are made of components in views/ui, a package of your app, styled by one stylesheet, … - [Handle HTML forms](https://docs.anetos.dev/guides/forms/index.md): Protect forms against cross-site request forgery, send PUT and DELETE from plain HTML, and show validation errors next to the fields with the submitted values … - [Validation](https://docs.anetos.dev/guides/validation/index.md): Declare rules on an input struct, get one clear message per field, and add checks of your own. - [Sessions and flash messages](https://docs.anetos.dev/guides/sessions/index.md): Remember things about a visitor between requests, and show a message once after a redirect. - [Configure your application](https://docs.anetos.dev/guides/configuration/index.md): Read settings from .env files and the environment into typed Go structs, with defaults, required keys and validation. - [Commands](https://docs.anetos.dev/guides/commands/index.md): Your application builds to one binary. Its first argument picks what it does: run the app (the default), run only some process types, migrate the database, list … - [Test your app](https://docs.anetos.dev/guides/testing/index.md): Boot the app in a test, send it requests like a browser or an API client, and check the responses, the session, the database, the jobs, events and email the app … - [Describe an API with OpenAPI](https://docs.anetos.dev/guides/openapi/index.md): Package web/openapi writes an OpenAPI 3.1 document of your API from its routes and its typed handlers: what each operation reads and answers, which credentials … ### CSS frameworks - [CSS frameworks](https://docs.anetos.dev/guides/css-frameworks/index.md) - [The starter theme](https://docs.anetos.dev/guides/starter-theme/index.md): The starter theme (--css=anetos), which anetos new writes unless you pick a CSS framework: Anetos's own stylesheet, about 270 lines of plain CSS, with no … - [Start without styles](https://docs.anetos.dev/guides/plain-html/index.md): --css=none: the same components, writing plain HTML without classes, and an app.css that holds only a comment. For your own CSS, or a CSS framework anetos … - [Style with Pico](https://docs.anetos.dev/guides/pico/index.md): --css=pico: Pico CSS 2.1.1, a framework that styles plain HTML, so its components write few classes. No build step and no JavaScript. - [Style with Bootstrap](https://docs.anetos.dev/guides/bootstrap/index.md): --css=bootstrap: Bootstrap 5.3.8's classes, its stylesheet and its JavaScript bundle, as released. No build step. - [Style with Bulma](https://docs.anetos.dev/guides/bulma/index.md): --css=bulma: Bulma 1.0.4's classes and its stylesheet, as released, with a small script for the menu button. No build step. - [Style with Tailwind CSS](https://docs.anetos.dev/guides/tailwind/index.md): --css=tailwind: components with Tailwind CSS 4.3.3's utility classes, and a stylesheet that Tailwind compiles from them. anetos dev and anetos build run … ### Data - [Data](https://docs.anetos.dev/guides/data/index.md) - [Connect to a database](https://docs.anetos.dev/guides/database/index.md): Open your app's database from configuration and use it from handlers, jobs and background tasks. - [Define models and save data](https://docs.anetos.dev/guides/models/index.md): Map structs to tables, and create, update and delete rows with timestamps, soft deletes and hooks. - [Migrations](https://docs.anetos.dev/guides/migrations/index.md): Create and change your database tables with versioned migrations that are compiled into your app and run with one command. - [Query data](https://docs.anetos.dev/guides/queries/index.md): Find rows with typed conditions, sort and paginate them, aggregate, and update or delete in bulk. - [Relations and eager loading](https://docs.anetos.dev/guides/relations/index.md): Declare how models relate (a post belongs to an author, an author has many posts, posts have many tags), load related rows in one query per relation, and filter … - [Transactions](https://docs.anetos.dev/guides/transactions/index.md): Make several writes succeed or fail together, and run follow-up work only after they are saved. - [Raw SQL](https://docs.anetos.dev/guides/raw-sql/index.md): Write SQL yourself and scan the results into structs, when the query builder is in the way. - [Seed the database](https://docs.anetos.dev/guides/seeders/index.md): Fill a database with sample data for development, or with the reference data every environment needs. - [Generate typed columns](https://docs.anetos.dev/guides/code-generation/index.md): Let anetos generate declare a typed column for every field of your models, and a handle for every relation, so queries say PostCols.Title.Like("%go%") and … ### Accounts and security - [Accounts and security](https://docs.anetos.dev/guides/accounts-and-security/index.md) - [Add accounts with make:auth](https://docs.anetos.dev/guides/accounts/index.md): Give your app user accounts in one command: registration, login with "remember me" and throttling, login with Google and GitHub, two-factor authentication, … - [Add accounts to an API](https://docs.anetos.dev/guides/api-accounts/index.md): In a project made with anetos new --stack=api, make:auth writes accounts that log in with API tokens: registration, login (with two-factor codes for users who … - [Authentication](https://docs.anetos.dev/guides/authentication/index.md): Let people register, log in (with "remember me"), log out, verify their email address and reset a forgotten password, and give API clients tokens. The complete … - [Social login](https://docs.anetos.dev/guides/social-login/index.md): Let users log in with Google, GitHub, or any OpenID Connect provider (Okta, Auth0, Microsoft Entra ID, Keycloak, GitLab…). The complete app is examples/auth. - [Two-factor authentication and password confirmation](https://docs.anetos.dev/guides/two-factor/index.md): Ask for more than a password: a code from an authenticator app (Google Authenticator, 1Password, Authy… : TOTP, RFC 6238) after it, with recovery codes for a … - [Authorization](https://docs.anetos.dev/guides/authorization/index.md): Decide what a logged-in user may do, with policies the compiler checks. - [Roles and permissions](https://docs.anetos.dev/guides/roles-and-permissions/index.md): Give users roles, globally or in a team, and check what they may do, with package auth/rbac. - [Rate limiting](https://docs.anetos.dev/guides/rate-limiting/index.md): Limit how often clients can call your routes, and how often they can attempt actions such as logging in. - [Keep an audit log](https://docs.anetos.dev/guides/audit-log/index.md): Record who created, changed, deleted and restored the rows of your models, field by field, with package audit: for data governance, for support, and for "who … - [Add an admin panel](https://docs.anetos.dev/guides/admin/index.md): Give your staff pages to list, search, filter, create, edit and delete the app's records, and to manage users and roles, with the admin interface of module … ### Background work - [Background work](https://docs.anetos.dev/guides/background-work/index.md) - [Queues](https://docs.anetos.dev/guides/queues/index.md): Run slow or failure-prone work in the background: charge a card, send an email, build a report. A request dispatches a job, a typed struct, and responds at … - [Events](https://docs.anetos.dev/guides/events/index.md): Emit an event when something happens, and let listeners react: write an audit log, email a receipt, update a dashboard. The code that places an order then … - [Scheduling](https://docs.anetos.dev/guides/scheduling/index.md): Run tasks on a schedule: prune old rows every night, send a report every hour, sync with another service every five minutes. The scheduler runs in your app's … - [Run background tasks](https://docs.anetos.dev/guides/background-tasks/index.md): Run long-lived work, such as a poller, a cache warmer or a heartbeat, as a supervised goroutine that restarts on failure and stops cleanly on deploy. - [Pub/sub listeners](https://docs.anetos.dev/guides/pubsub/index.md): Listen to message streams other services publish, such as orders.created, and publish your own, from the same binary as your web app. Where the queue runs an … ### Mail, files, search and cache - [Mail, files, search and cache](https://docs.anetos.dev/guides/mail-files-search-and-cache/index.md) - [Send email](https://docs.anetos.dev/guides/mail/index.md): Send email from your app: a receipt, a welcome message, a password reset link. An email is a mailable, a type that builds its message from its fields, with an … - [Store files](https://docs.anetos.dev/guides/storage/index.md): Store files your app receives or makes: uploads, avatars, exports, invoices. Files go on disks: a disk is a named place files are kept, which is a local … - [Add full-text search](https://docs.anetos.dev/guides/search/index.md): Give users a search box that finds what they mean: every word they type, in any of the columns you choose, best matches first. Search runs on your database's … - [Cache](https://docs.anetos.dev/guides/cache/index.md): Keep the results of slow work for a while, count events for rate limits, and use locks so only one instance of the app does a job at a time. ### Languages and time - [Languages and time](https://docs.anetos.dev/guides/languages-and-time/index.md) - [Translations](https://docs.anetos.dev/guides/translations/index.md): Show your app, its validation messages and error pages, and its emails in each user's language. Adding a language is adding a file. - [Numbers, dates and languages](https://docs.anetos.dev/guides/formatting/index.md): Show numbers, prices, dates and times the way each user reads them, in their language and time zone, and add the framework's translations for a language with … - [Times and dates](https://docs.anetos.dev/guides/times-and-dates/index.md): Store times without thinking about time zones, keep calendar dates on their day, and choose the zone your app works in. ### Working with AI - [Working with AI](https://docs.anetos.dev/guides/working-with-ai/index.md) - [Add AI to your app](https://docs.anetos.dev/guides/ai/index.md): Use a language model in your app: summarize text into a typed struct, answer questions with tools that look up the user's own data, and stream the answer as … - [Build an AI assistant](https://docs.anetos.dev/guides/ai-assistant/index.md): Give your users a chat with an agent that answers from your app's data: conversations stored in the database, answers streamed to the page as they're written, … - [Search by meaning](https://docs.anetos.dev/guides/semantic-search/index.md): Find records by what they mean, not only by the words they share: "how much is the team plan" finds the article on plans and billing, which never says "how … ### Production - [Production](https://docs.anetos.dev/guides/production/index.md) - [Deploy](https://docs.anetos.dev/guides/deployment/index.md): An Anetos app is one binary: the migrations, views, translations and static files are inside it. Deploying it is building it, giving it its settings, running … - [Find N+1 queries](https://docs.anetos.dev/guides/n-plus-one/index.md): An N+1 is a query in a loop: one query for a list of posts, then one per post for its author. It works, and it's fast with three posts in development; with … - [Secure your app](https://docs.anetos.dev/guides/security/index.md): Anetos starts safe: CSRF protection, encrypted session cookies, parameterized queries, escaped views, security headers, throttled logins. What it can't choose … - [Check your app's security](https://docs.anetos.dev/guides/security-check/index.md): security:check checks your app against security rules: its code (SQL built from request data, a redirect to a URL from the request, a secret written in a file), … ### Extending - [Extending](https://docs.anetos.dev/guides/extending/index.md) - [Use plugins](https://docs.anetos.dev/guides/plugins/index.md): Add features to your app with plugins: packages that bring their own routes, database tables, settings, commands, queue jobs, scheduled tasks or event … - [Write a plugin](https://docs.anetos.dev/guides/writing-plugins/index.md): Package a feature so any Anetos app can add it with anetos add: its routes, tables, settings, commands, queue jobs, scheduled tasks and event listeners. A … ## Concepts - [Concepts](https://docs.anetos.dev/concepts/index.md): How Anetos works, and why. ### The app - [The app](https://docs.anetos.dev/concepts/the-app/index.md) - [Glossary](https://docs.anetos.dev/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 … - [Application lifecycle](https://docs.anetos.dev/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 … - [Runtime supervisor](https://docs.anetos.dev/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 … - [Commands and the app binary](https://docs.anetos.dev/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 … - [Configuration](https://docs.anetos.dev/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/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 … - [How testing works](https://docs.anetos.dev/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 … - [Performance](https://docs.anetos.dev/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 … ### Web - [Web](https://docs.anetos.dev/concepts/web/index.md) - [HTTP request lifecycle](https://docs.anetos.dev/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/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/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/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 … ### Data - [Data](https://docs.anetos.dev/concepts/data/index.md) - [The data layer](https://docs.anetos.dev/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/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 … ### Accounts and security - [Accounts and security](https://docs.anetos.dev/concepts/accounts-and-security/index.md) - [Authentication and authorization](https://docs.anetos.dev/concepts/authentication/index.md): How Anetos knows who is making a request, and what they may do. - [Roles and permissions](https://docs.anetos.dev/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/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 - [Working with AI](https://docs.anetos.dev/concepts/working-with-ai/index.md) - [AI](https://docs.anetos.dev/concepts/ai/index.md): How package ai connects language models to the app, and what it leaves to the providers. ## Reference - [Reference](https://docs.anetos.dev/reference/index.md): Settings, commands, tags and rules, to look things up. ### Commands and settings - [Commands and settings](https://docs.anetos.dev/reference/commands-and-settings/index.md) - [anetos tool and app commands reference](https://docs.anetos.dev/reference/cli/index.md): Two command lines: the anetos developer tool (module anetos.dev/anetos/cli), which creates projects and writes code, and your application's binary, which runs … - [anetos generate reference](https://docs.anetos.dev/reference/anetos-generate/index.md): anetos generate writes the typed columns of your models. It is part of the anetos developer tool (module anetos.dev/anetos/cli). See Generate typed columns for … - [Configuration reference](https://docs.anetos.dev/reference/configuration/index.md): Every key starts with its area's prefix (DB_, CACHE_, QUEUE_…). The key that picks a backend is _DRIVER in every area (DB_DRIVER, CACHE_DRIVER, MAIL_DRIVER, … ### Web - [Web](https://docs.anetos.dev/reference/web/index.md) - [Request binding reference](https://docs.anetos.dev/reference/binding/index.md): Rules used by web.H to fill a handler's input struct. - [Views, sessions and forms reference](https://docs.anetos.dev/reference/views/index.md): The APIs of packages view, session and encryption, and the HTML helpers of package web. See Render HTML with templ, Sessions and flash messages and Handle HTML … - [Validation rules reference](https://docs.anetos.dev/reference/validation-rules/index.md): Rules for the validate struct tag, used by validate.Struct and web.H. See the validation guide for how to use them. - [Translation file formats](https://docs.anetos.dev/reference/i18n-formats/index.md): The format and relative sections of a catalog, which i18n.Date, Time, DateTime, Format, Currency, Ago, Duration and LanguageName use, and the date pattern … - [OpenAPI reference](https://docs.anetos.dev/reference/openapi/index.md): Package web/openapi and what it writes. How to use it: Describe an API with OpenAPI. - [UI components reference](https://docs.anetos.dev/reference/ui/index.md): The components of views/ui, the package anetos new writes into a web project, which the layout and the pages of make:crud and make:auth call. The package is … ### Data - [Data](https://docs.anetos.dev/reference/data/index.md) - [Models reference](https://docs.anetos.dev/reference/models/index.md): How the db package maps a struct to a table. See Define models and save data for a walkthrough. - [Query builder reference](https://docs.anetos.dev/reference/query-builder/index.md): Everything available on db.Q[T], the query started by db.QueryT. See Query data for a walkthrough. - [Migrations reference](https://docs.anetos.dev/reference/migrations/index.md): The schema builder, the migration runner and the commands in package anetos.dev/anetos/db/migrate. See Migrations and Seed the database for walkthroughs. ### Packages - [Packages](https://docs.anetos.dev/reference/packages/index.md) - [Authentication reference](https://docs.anetos.dev/reference/auth/index.md): Packages auth, auth/password, auth/social and auth/rbac. How-to: Authentication, Authorization, Roles and permissions. Settings: configuration reference. - [AI reference](https://docs.anetos.dev/reference/ai/index.md): The API of package ai. See Add AI to your app for a walkthrough, AI for the design, and Configuration for the AI_* settings. - [Testing reference](https://docs.anetos.dev/reference/anetostest/index.md): The APIs of packages anetostest and db/factory, and the hooks they use. See Test your app for a walkthrough. ## Upgrade guides - [Upgrade guides](https://docs.anetos.dev/upgrade/index.md): One page per minor version before 1.0 (v0.N.md), listing every breaking change with migration steps, newest first. - [Upgrading to v0.5](https://docs.anetos.dev/upgrade/v0.5.md): v0.5 is in progress; this page lists its changes so far. - [Upgrading to v0.4](https://docs.anetos.dev/upgrade/v0.4.md): v0.4 adds the API stack. Most apps upgrade without code changes: update the modules (go get anetos.dev/anetos@v0.4.0, and cli, admin and the drivers you use to … - [Upgrading to v0.3](https://docs.anetos.dev/upgrade/v0.3.md): The breaking changes of v0.3, with what to do.