Skip to content
Unreleased: these pages follow the main branch. The latest release is v0.5.

Create a project

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.

Create it

anetos new blog
cd blog

anetos new writes the project, downloads its dependencies and compiles its views. Its flags:

FlagDefaultMeaning
--dbsqlitepostgres or mysql for a server database (Choose a database)
--stackwebapi for an app that serves JSON only (below); react, svelte or vue for pages written as components (below)
--cssanetosThe CSS framework: anetos, the starter theme; none, components without classes and an almost empty stylesheet, for your own CSS; pico, bootstrap or bulma, components in that framework’s markup, with its files; tailwind, components with Tailwind CSS’s classes, compiled by anetos dev (Style your app)
--modulethe folder’s nameThe Go module path, such as github.com/you/blog

Run it

go run . migrate     # create the tables the framework uses
go tool anetos dev   # http://localhost:8080

migrate creates the database (for SQLite, database/app.db) and the tables of sessions, the cache and the queue. anetos dev builds and runs the app, and rebuilds it when you save a file: the page in your browser reloads by itself. Keep it running in a terminal of its own.

Open http://localhost:8080: a welcome page, in light or dark like your system. Edit views/home.templ and save to see it change; its text is in locales/en/app.yaml, ready for other languages.

The app’s commands

The app is one program with commands. go run . help lists them:

go run . help          # every command
go run . route:list    # the URLs and their handlers
go run .               # run: the web server, the queue's workers and the scheduler

In production, the built binary takes the same commands (./bin/blog migrate).

An API instead

--stack=api writes an app that serves JSON only, for a mobile app or a front end built separately:

anetos new shop --stack=api
cd shop
go run . migrate
go tool anetos dev   # http://localhost:8080/api/v1

It has the same database, queue, mail, storage, scheduler, plugins and deploy files, but no views, static files, sessions or CSRF protection. Its routes are in routes/api.go, under /api/v1; GET /api/v1 answers:

{"name":"shop","message":"Welcome to the Shop API."}

Every error is JSON problem details, whatever the client accepts (a missing URL’s 404 too). Browsers on other origins may call the API once HTTP_CORS_ORIGINS in .env lists them, such as http://localhost:5173. make:handler writes JSON handlers in such a project, make:auth accounts that log in with API tokens (Add accounts to an API), and make:crud JSON endpoints for a model (Add pages for a model).

openapi.json describes the API in OpenAPI 3.1, for clients and tools, and the app serves it at /api/v1/openapi.json. make:auth and make:crud update it; after changing a route or a handler yourself, run go run . openapi: a test in main_test.go fails until you do (Describe an API with OpenAPI).

Pages in React, Vue or Svelte

--stack=react, --stack=vue and --stack=svelte keep the web stack’s Go side (routes, handlers, sessions, validation) and write the pages as React, Vue or Svelte components in TypeScript, which Inertia renders in the browser with the props the handlers send. It needs Node.js 20.19 or 22.12 or later, for the frontend’s packages and build:

anetos new shop --stack=react   # or --stack=vue, --stack=svelte
cd shop
go run . migrate
go tool anetos dev   # http://localhost:8080

The components are in frontend/src/pages; make:auth and make:crud write theirs there too. Build pages in React, in Svelte and in Vue add a page of your own; Frontends compares the stacks.

Next: Project structure.