datapages-server
БесплатноБез исполняемых скриптовНе проверенConfigure the Datapages server entry point: NewServer type arguments, the message broker, server options, static assets, TLS and Prometheus metrics.
от romshark★ 122 звезды на GitHubОб этом скилле
Server entry point
Read datapages first for the build loop, hard rules and naming conventions.
On its first run, datapages gen writes the server command's main.go. It does not regenerate that file on later runs.
NewServer
datapages gen reads the type arguments to find the app package and output directory.
s, err := datapages.NewServer[
app.App, // App
app.SessionData, // or datapages.DisableSessions
datapages.DisablePrometheus, // or datapages.EnablePrometheus
datapagesgen.Server, // the datapagesgen of that app package
](&a, broker, opts...) // the app is passed by pointer
Keep the call inside the module. Import datapages with a package name because the scanner rejects dot imports. Generated code is always in datapagesgen directly below its app package. 1 module can contain several apps. Run one with datapages watch --app app/frontend, the directory of its app package.
datapages.EnablePrometheus requires WithPrometheus, DisablePrometheus rejects it.
Broker
A broker is always required. It sends events between server instances and to SSE subscribers. Use modules/messaging/natscore for multiple instances. Use modules/messaging/inmem only for 1 instance. The generated server uses NATS. Start it with make up before starting the server.
Options
var opts []datapages.ServerOption
opts = append(opts,
datapages.WithLogger(slog.Default()),
datapages.WithMiddleware(mw),
datapages.WithSessions(datapages.SessionsConfig{}),
datapages.WithSessionManager[app.SessionData](mgr),
datapages.WithAssets(app.StaticFS, false),
datapages.WithHTTPServer(&http.Server{ReadHeaderTimeout: 10 * time.Second}),
datapages.WithDatastarJS("https://cdn.example.com/[email protected]/datastar.js"),
datapages.WithShutdownTimeout(30*time.Second),
datapages.WithFileSendTimeout(time.Minute),
datapages.WithAssetsCache(datapages.AssetsCacheConfig{}),
datapages.WithBodySizeLimit(1<<20),
datapages.WithLogSampling(datapages.LogSamplingConfig{Interval: time.Minute}),
datapages.WithSSECompression(datapages.SSECompressionConfig{}),
datapages.WithResponseCompression(datapages.ResponseCompressionConfig{}),
datapages.WithPrometheus(datapages.PrometheusConfig{Host: ":9091"}),
)
WithBodySizeLimit limits the request body of an action that declares Signals. The default is 1 MiB. An over-limit request returns 400 while reading signals. A handler that reads r.Body itself gets no limit: wrap the body in http.MaxBytesReader. WithLogSampling limits repeated framework warnings, not application logs. WithHTTPServer uses every supplied field except Addr and Handler. Keep WriteTimeout at 0 because a nonzero value ends long-lived SSE streams. WithFileSendTimeout ends a blocked file response after 1 minute by default. WithSSECompression sets the codings, order, levels and windows; the default order is zstd, brotli and gzip. CPU and memory scale with stream count. Use the presets datapages.SSECompressionLowMemory() for many streams with fragments below about 100 KB, datapages.SSECompressionLowBandwidth() for few streams with slow or metered clients, and datapages.SSECompressionLargeFragments() for fragments above about 1 MB. WithNoSSECompression turns compression off. A page's StreamConfig overrides it for the page's streams, and a StreamConfig method named after an action, such as StreamConfigPOSTSave, for that action's response. Use WithNoSSECompression in an entry point that only loopback clients reach, such as a desktop app whose webview loads from a server on 127.0.0.1. Compression there costs CPU and saves no transfer.
WithResponseCompression sets the codings, order, levels and minimum size for page and action bodies. Bodies of at least 256 bytes use zstd, brotli or gzip by default. ResponseCompressionLowCPU reduces CPU and memory. ResponseCompressionLowBandwidth prefers brotli. Static assets use WithAssetsCompression. datapages.File and SSE responses pass through, as do responses with Content-Encoding or Cache-Control: no-transform. A HEAD response gets the headers of its GET response. Compression runs after every middleware and is disabled in dev mode. For loopback-only clients, add WithNoResponseCompression, WithNoSSECompression and WithNoAssetsCompression. Before a proxy body filter such as nginx sub_filter, add the ones for the responses it edits. Compressing proxies pass encoded bodies through. Set Cache-Control: private, no-transform on pages that combine secrets with attacker-controlled input, and on their _$/ streams, or give such a page a StreamConfig that returns Compression: &datapages.SSECompressionConfig{Disabled: true}.
WithPrometheus starts a second HTTP server that serves /metrics on the configured host. WithShutdownTimeout limits how long ListenAndServe waits after context cancellation for requests, SSE streams and StreamClose hooks. When the ti
Установить datapages-server в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл datapages-server?
Configure the Datapages server entry point: NewServer type arguments, the message broker, server options, static assets, TLS and Prometheus metrics.
Как установить скилл datapages-server?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл datapages-server запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic