Skip to content

Conversation

@jackielii
Copy link
Owner

Summary

This PR adds a comprehensive blog-admin example that demonstrates all the advanced features of structpages mentioned in the README. It serves as a complete real-world application example.

Features Demonstrated

  • Dependency Injection: Multiple services (Store, AuthService, SessionManager, FormDecoder, Config) injected into handlers
  • Nested Routing: 3-level deep routing structure (/admin/posts/{id}/edit)
  • Authentication & Authorization: Session-based auth with bcrypt password hashing
  • Middleware Patterns: Auth middleware, CSRF protection, logging middleware
  • Props Pattern: Complex data loading with Props methods
  • HTMX Integration: Configured with HTMXPageConfig, supports partial rendering
  • Database Integration: SQLite with proper schema and relationships
  • Form Handling: Using go-playground/form for parsing
  • Error Handling: Custom error handler with HTTPError type
  • Static Files: CSS served from embedded filesystem

What's Included

The blog application includes:

  • Public Pages: Home, individual posts, categories, search
  • Authentication: Login/logout with session management
  • Admin Dashboard: Statistics and recent activity
  • Post Management: Full CRUD operations
  • User Management: Create and manage users
  • Media Library: Placeholder for file uploads
  • Settings: Site configuration

Testing

Run the example:

cd examples/blog-admin
templ generate -include-version=false
go run .

Default credentials: admin / admin123

Files Added

  • Complete blog application in examples/blog-admin/
  • Updated examples/README.md with new example documentation
  • All necessary templates, handlers, and database schema

🤖 Generated with Claude Code

This comprehensive example showcases:
- Dependency injection with multiple services (Store, Auth, Session, Config)
- Nested routing (3+ levels deep) with admin panel structure
- Session-based authentication with bcrypt password hashing
- Middleware patterns (auth, CSRF, logging)
- Props pattern for complex data loading
- HTMX integration with partial rendering
- SQLite database with relationships
- Form handling with go-playground/form
- Custom error handling
- Reusable Templ components
- Static file serving

The example includes a fully functional blog with:
- Public pages (home, posts, categories, search)
- Authentication (login/logout)
- Admin dashboard with statistics
- Post management (CRUD operations)
- User management
- Media library placeholder
- Settings management

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Jun 22, 2025

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

jackielii and others added 2 commits June 22, 2025 22:03
- Remove log files, database, cookies, and binary from git
- Add .gitignore to prevent tracking generated files
- Keep only source code in version control

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants