🚀 The Ultimate sqlc Configuration Template - Production-ready, comprehensive sqlc configuration template that works for ALL project types. Takes advantage of EVERY sqlc feature with real working plugins and validated configurations.
This is a comprehensive, production-ready sqlc configuration template that supports SQLite, PostgreSQL, and MySQL databases. It provides fully configured code generation with all sqlc features, including multi-language plugins (Python, Kotlin, TypeScript), CEL validation rules for production safety, and 30+ type mapping patterns for common domain needs.
-
🛡️ Production Safety CEL validation rules prevent dangerous queries (SELECT *, DELETE without WHERE)
-
⚡ Multi-Database Excellence SQLite/Turso, PostgreSQL, MySQL - comprehensive support with isolated configurations
-
🎨 Code Generation Mastery All emit_* options configured with detailed explanations and trade-offs
-
🔧 Real Working Plugins Verified Python, Kotlin, TypeScript plugins with actual SHA256 hashes
-
🌍 Universal Project Support 10+ project type templates from hobby to enterprise scale
-
📊 Comprehensive Type Overrides 30+ real-world type mapping patterns for domain-specific needs
-
✅ Production Validated Based on analysis of 21+ real projects, sqlc vet verified
-
🎯 Smart Configuration Management Environment variables, build tags, conditional compilation support
# Clone this repository
git clone https://github.com/LarsArtmann/template-sqlc.git
cd template-sqlc
# Copy the configuration to your project
cp sqlc.yaml /path/to/your/project/
# Set up example schemas (optional)
make examples
# Generate your Go code
sqlc generate- Go 1.21+
- sqlc v1.29.0+
- Database driver for your target database
# Install sqlc (macOS)
brew install sqlc
# Install sqlc (Linux)
curl -L https://github.com/kyleconroy/sqlc/releases/latest/download/sqlc_$(uname -s)_$(uname -m).tar.gz | tar -xz -C /usr/local/bin sqlc
# Verify installation
sqlc version# Create your project structure
mkdir -p sql/{sqlite,postgres,mysql}/{queries,schema}
# Add your schema files
echo "CREATE TABLE users (id INTEGER PRIMARY KEY, email TEXT);" > sql/sqlite/schema/001_users.sql
# Add your queries
echo "-- name: GetUser :one\nSELECT * FROM users WHERE id = ?;" > sql/sqlite/queries/user.sql
# Generate Go code
sqlc generate# Copy the comprehensive configuration
cp sqlc.yaml your-project/
# Uncomment your database configuration
# Edit paths and database URLs
# Validate and generate
sqlc compile # Validate syntax
sqlc generate # Generate Go codeSee the examples/ directory for complete, working examples with:
- User management schemas
- Database-specific features (FTS, JSON, Enums)
- Optimized queries and indexes
- Session management patterns
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Test your changes:
sqlc compile && sqlc vet - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
- Test thoroughly: Ensure
sqlc compilepasses - Add comments: Explain WHY each setting is chosen
- Consider trade-offs: Document performance/flexibility implications
- Keep universal: Avoid domain-specific hardcoded values
This project is licensed under the MIT License - see the LICENSE file for details.
Lars Artmann - https://lars.software
Project Link: https://github.com/LarsArtmann/template-sqlc