datapages README

The project's README from github.com/romshark/datapages. As one markdown file: README.md.

Datapages

CI golangci-lint Coverage Status Go Reference License: MIT Beta

[!NOTE] Beta: Datapages is ready for production use. APIs are close to stable but can still change.

A Templ + Go + Datastar web framework and toolset for building GUI apps and web application in pure Go - no matter whether it's a real-time collaborative dynamic web app, a simple HTMX-style website, or an installable local-first GUI app.

See FAQ.md for frequently asked questions.

Utilize AI agents more efficiently

Datapages will provide your coding agents with the skills and CLI tools they need to generate well performing, resource-efficient apps and keep the code base coherent and maintainable, lowering token-usage, reducing potential for bugs and vulnerabilities as well as slowing the accumulation of technical debt.

Focus on your business logic

Datapages parses your app source packages, lints them, reports errors, and generates all the wiring and boilerplate. Routing, sessions and authentication, SSE streams, per-tab server-side state, CSRF protection, type-safe URL and action helpers, Prometheus metrics, JavaScript service workers etc. - so your application code stays clean and takes full advantage of Go's strong static typing and high performance.

Examples

Getting Started

See the Guide.

Specification

See SPECIFICATION.md for the full source package specification, including handler signatures, parameters, return values, events, sessions, and modules.

Modules

Datapages ships pluggable modules with swappable implementations:

Motivation

The reason I built Datapages is that the combination of Datastar + Go + Templ is my preferred way of writing server-centric web applications. But in every project I used this tech stack for I kept repeating the same code patterns and solving the same problems over and over again. I realized many developers are repeating the same patterns too and struggle with the common pitfalls:

Your Datastar frontends are your rocket to extraterrestrial worlds of the internet. The further you want to go, the heavier a rocket you'll require. Hence, you need powerful boosters to get it off the ground and overcome Earth's gravity. Such boosters exist in the form of awesome templates like zangster300/northstar, which will quickly get your rocket to the stratosphere and beyond. But power alone is not enough — you also need good stabilizing fins and thrust vectoring to keep your rocket steady as it flies. I felt like this part was lacking in the Go ecosystem of Datastar. By enforcing a common structure of types, methods and other conventions with tooling, Datapages provides not only the power but also the stability your rocket needs to stay in flight for long and consume as little brain fuel as possible.

Not only does Datapages allow you to start quickly with datapages init and jump straight into building your application, but it also continuously supports you keeping accidental complexity low by:

Agentic coding is a big topic right now and likely here to stay. But LLMs tend to drift over time and introduce accidental complexity. So for AI to be used more effectively I wanted to provide the skills and instructions necessary for agents to know how to deal with this tech stack and call into Datapages CLI help them when they drift by providing them with useful feedback.

Cost comparison: doing it all yourself, using AI assistance, and Datapages plus AI assistance

Who This Is For

Datapages is a good fit if you:

Contributing

See CONTRIBUTING.md for development setup and commands, and AGENTS.md for code style, testing conventions, commit message format and project structure.

datapages (romshark/datapages)

Searching Database…

Что это такое?Datapages — это веб-фреймворк и набор инструментов для создания GUI- и веб-приложений на чистом Go на стеке Templ + Go + Datastar: приложения для совместной работы в реальном времени, простые сайты с рендерингом на сервере или устанавливаемые локальные GUI-приложения.
Чем это отличается от самостоятельной связки Datastar с Go?Он разбирает ваши пакеты с исходным кодом и генерирует ту обвязку, которую в каждом проекте пришлось бы писать вручную: маршрутизацию, SSE-потоки, состояние на сервере для каждой вкладки, защиту от CSRF, метрики Prometheus и service workers — благодаря этому код остаётся чистым и в полной мере использует статическую типизацию Go.
Какую первую команду нужно выполнить, чтобы попробовать?Создайте приложение по шаблону командой datapages init; во время разработки datapages gen генерирует шаблонный код, а datapages watch обеспечивает горячую перезагрузку с показом ошибок прямо в предпросмотре браузера.
Нужен ли NATS или другая инфраструктура для запуска?Нет — компоненты подключаемые: для приложений в одном экземпляре подходят сессии и брокер в памяти, а при масштабировании можно заменить их на реализации на базе NATS (KV-сессии с зашифрованными cookie по AES-128-GCM).
В README написано, что это beta — насколько это безопасно для продакшена?Там прямо сказано, что Datapages готов к использованию в продакшене, но API близки к стабильным и всё ещё могут меняться — ожидайте некоторых сложностей при обновлениях, пока проект зреет.
То есть для офлайн-SPA с REST API он не подходит?Верно — он ориентирован на приложения с рендерингом на сервере, где данные принадлежат серверу, а не на локальное офлайн-SPA, и избавляет от необходимости поддерживать отдельный REST/GraphQL API только ради фронтенда.
Он умеет делать настоящие десктоп-приложения или только веб?Гибридные: пример с калькулятором работает и как сервер с несколькими клиентами, и как десктоп-приложение с одним клиентом, а приложения разворачиваются одним статически скомпилированным бинарником.
Почему автор сделал этот проект, а не использовал Datastar с Go напрямую?Datastar + Go + Templ — его любимый стек, но он раз за разом повторял одни и те же шаблоны — обработку SSE, работу с NATS, аутентификацию, настройку горячей перезагрузки — в каждом проекте. Datapages упаковывает эти решения и добавляет структурную стабильность, которой, по его мнению, не хватало экосистеме Datastar для Go.
Что за архитектура Tao, которую он навязывает?Это структура приложения в духе Datastar Tao, предлагаемая как разумный вариант по умолчанию — общие соглашения о типах и методах, которые проверяет инструментарий, — но при этом остаётся простор выйти за её рамки. Пример todolist больше всего соответствует Tao.
Можно ли использовать с ним Tailwind CSS или Web Components?Да — есть примеры для обоих случаев: минимальная статическая страница с интеграцией Tailwind CSS и лендинг с ванильными и Lit-компонентами Web Components, собранными через esbuild с помощью собственного watcher'а.
Creator
romshark
Size
7.5 MB
Stars
114
Age
9mo
Commits · 90 Days