# Datapages > Datapages is a webdev meta-framework and toolchain for Go, Templ, and Datastar, designed for building modern web applications and hybrid desktop apps with a thin-client architecture. Each link leads to the Markdown copy of a page of the documentation. llms-full.txt holds all of them in 1 file. ## Get started - [Introduction](index.md): Datapages is a webdev meta-framework and toolchain for Go, Templ, and Datastar, designed for building modern web applications and hybrid desktop apps with a thin-client architecture. - [Installation](installation.md): Install the Datapages CLI and templ, then use datapages init to create a project. The generated make dev target starts its dependencies and development server. - [Upgrading](upgrading.md): Read the sections of the changelog between your release and the new one. A change that needs edits to application or project files states them. Then run these steps in the module root. ## Tutorial - [Overview](tutorial/index.md): Build a shared shopping list with sign-in and an HTTP test. Every open tab shows the same list. A change in 1 tab updates all of them. - [Create the project](tutorial/create-project.md): Run datapages init in a directory outside any Git repository and Go module: - [Show the list](tutorial/show-the-list.md): The list lives on App. cmd/server/main.go creates 1 App that every request and every tab share, which is why a mutex guards the items. Replace app/app.go: - [Add items](tutorial/add-items.md): An action handles a request from the page. Its name gives the HTTP method, and the first line of its doc comment gives the route. POSTAdd therefore handles POST /items. Add "strings" to the imports of app/app.go, then add these declarations: - [Update every open tab](tutorial/update-every-tab.md): POSTAdd patches the tab that sent the request. Another tab shows the new item only after a reload. To update every tab, the action dispatches an event, and every open page handles it. Add the event type and the handler to app/app.go, and replace POSTAdd: - [Check off and remove items](tutorial/check-off-and-remove.md): These actions act on 1 item, which the route names with the variable {id}. Add the field Done to Item, and add these declarations to app/app.go: - [Rename an item](tutorial/rename-items.md): Renaming opens a field in 1 tab. OnItemsChanged renders the whole list in every tab. Without the ID of the item being renamed, an update from another tab would close the field. Event handlers receive no request or current signals. Keep the ID in datapages.State[T], which gives each open tab its own server-side *T for the lifetime of its stream. - [Sign in](tutorial/sign-in.md): A session identifies the visitor by a cookie. Change app/app.go: - [Test the app](tutorial/test-the-app.md): The server that datapages.NewServer returns implements http.Handler, which net/http/httptest can serve without NATS or Docker. Create app/app_test.go: ## Concepts - [Application model](application-model.md): Datapages generates an application's HTTP server from 1 Go package. The CLI finds this app package through datapages.NewServer, reads its declarations and writes datapagesgen below it. - [Request lifecycle](request-lifecycle.md): A loaded page can open an SSE stream, send actions and receive events from other requests. The generated server also handles reconnects, deployments, closed sessions and shutdown. The sequence below names each path, header and status code. ## Guides - [Pages and routes](pages.md): A page is a struct type named PageXXX. Its doc comment declares the route, and its GET method renders an HTML document. Generated helpers build page URLs from typed path and query values. - [Actions](actions.md): An action is a method that handles a request from an open page. A Datastar attribute in a template usually sends the request. Actions can read typed input, patch the calling tab, return files and report HTTP errors. - [Templates and forms](templates.md): templ components render pages and the fragments patched by actions. Generated href and action packages build URLs and Datastar expressions. datapages lint checks their use in templates. - [Events](events.md): An event sends a change from its handler to every open page that shows the affected data. Subjects can limit delivery to a user, signal value or browser tab. A message broker carries events across server processes. - [Per-tab state](state.md): datapages.State[T] keeps server-side values for 1 browser tab. The tab's actions, event handlers and stream hooks can read and write those values. The stream controls the state's lifetime. - [Sessions and auth](sessions.md): A session cookie identifies the visitor of a request. Handlers can read typed session data, create or close a session, and reject guests. A session manager stores the records behind the cookies. - [Static assets](assets.md): Datapages can compile stylesheets, scripts, fonts and images into the server binary. The generated packages build their URLs, and the server handles caching and compression. - [Offline and shims](offline.md): The offline module stores page snapshots and loading shims in a service-worker cache. A snapshot opens without a network connection. A shim appears immediately and is replaced by the live page. - [Testing](testing.md): Test domain logic with plain Go tests. Test the generated HTTP server with net/http/httptest. Every example on this page passes under go test -race ./.... - [Slow and failing networks](network.md): datapages watch can serve the app through a Toxiproxy proxy. Its toxics add latency, limit bandwidth, cut connections and return HTTP errors. A settings page applies presets, changes them while the app runs and saves them to datapages.yaml. Use the proxy to test pages, actions and streams on slow or failing networks. - [Deployment](deployment.md): A deployment runs 1 or more copies of the server binary. Configure the binary in cmd/server/main.go, terminate TLS in the server or a reverse proxy, and collect its metrics and logs. - [Performance](performance.md): Datapages compresses SSE streams, page and action responses, and static assets by default. The settings trade CPU time and memory for transfer size. - [Security](security.md): The generated server checks request shape, cross-origin requests, CSRF tokens and stale pages. Application code must still authorize access, escape JavaScript values, limit custom request bodies and protect secrets. - [Multiple applications](multiple-applications.md): 1 Go module can hold several Datapages applications. Each application has its own app package, generated package and entry point. Applications can share ordinary Go and templ packages, and they can exchange events through a broker. - [AI agents](ai-agents.md): datapages init writes instructions and skills for coding agents. datapages lint and datapages gen report invalid code with source positions and suggested fixes. You can update, replace or omit the generated instructions. - [Troubleshooting](troubleshooting.md): Find the observed error or behavior below. Each section gives its cause and the command or code change that fixes it. ## Reference - [Specification](specification.md): The generator requires an application source package containing App and type PageIndex struct. - [CLI](cli.md): The datapages command creates projects, generates server code, checks application models and runs the development server. - [datapages.yaml](configuration.md): datapages.yaml names the entry point that datapages gen writes for a new project. It also configures the datapages watch development server and its Toxiproxy proxy. - [Go API](https://pkg.go.dev/github.com/romshark/datapages) - [Changelog](changelog.md): This file records the notable changes of each release in the format of Keep a Changelog. The release workflow publishes the section of a version as its GitHub release notes. Releases up to v0.10.0 have their notes on GitHub Releases only. ## More - [Examples](examples.md): The example/ directory contains 12 applications in 11 modules. - [FAQ](faq.md): Frequently asked questions about Datapages.