muxt-sqlc

Integrates generated code from Protobuf files and YAML/JSON/TOML/Apifox definitions to create a customizable React admin panel with 40+ templates.

6|1|Updated Aug 5, 2024
One-click install
npx skills add https://github.com/typelate/muxt --skill muxt-sqlc
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: muxt-sqlc
Source: https://github.com/typelate/muxt/tree/main/docs/skills/sqlc
Command: npx skills add https://github.com/typelate/muxt --skill muxt-sqlc

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill streamlines the development of web applications by integrating Muxt for HTML templating and sqlc for type-safe database query generation, ensuring consistency between your frontend, backend logic, and database schema.

Core Features & Use Cases

  • Type-Safe Code Generation: Generates Go code from HTML templates and SQL queries, catching errors at compile time.
  • Project Structure Guidance: Provides recommended layouts for small and large applications.
  • Database Integration: Demonstrates embedding sqlc-generated query types and handling transactions.
  • Form-to-Query Alignment: Maps HTML form fields directly to SQL query parameters using struct generation.
  • Error Handling: Implements safe, user-facing error messages by wrapping database errors.
  • End-to-End Testing: Guides on testing the full stack using httptest, domtest, and chromedp.

Quick Start

Follow the recommended project layout to integrate Muxt with sqlc for your web application.

Frequently Asked Questions about muxt-sqlc

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build type-safe web apps with Go using HTML templates and SQL?

Building type-safe web apps with Go involves generating code from HTML templates and SQL queries to catch errors at compile time. This approach aligns frontend form fields directly with SQL query parameters and ensures schema consistency.

How does combining sqlc and HTML templating improve Go web development?

Combining sqlc and HTML templating improves Go web development by generating type-safe code for both database queries and HTTP handlers. This mechanism catches frontend and backend misalignments at compile time rather than during runtime.

What is the recommended project structure for a Go web app using sqlc?

The recommended project structure for a Go web app using sqlc provides tailored layouts for both small and large applications. It guides embedding sqlc-generated query types and structuring handlers to maintain clear separation between database logic and templating.

How do I map HTML form fields to SQL query parameters in a Go web application?

Mapping HTML form fields to SQL query parameters uses struct generation to align form inputs directly with sqlc query parameters. This ensures that data extracted from HTML forms is type-safe and accurately matches the underlying database schema.

How do I test a full-stack Go web application with generated type-safe code?

Testing a full-stack Go web application involves end-to-end strategies using `httptest`, `domtest`, and `chromedp`. These tools validate the integrated output of HTML templating and sqlc database queries through browser automation and HTTP request simulation.

Does this approach handle database errors and user-facing messages safely?

Handling database errors safely involves wrapping sqlc database errors to implement robust, user-facing error messages. This approach prevents raw database errors from exposing sensitive schema details while maintaining application stability.