Skip to content

gojangframework/gojang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

77 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Gojang Framework

v0.3.1 - Email verification for new registration, forgot/reset password process, AWS SES email implemntation

v0.3 - New file structure - separating dev files from Gojang framework files - AI Skills added - Docs updated - addModel and addPage automations removed - Ent schema files moved to more convenient location

v0.2 - Added some changes based on what I learned from another production app that has been built on top of Gojang over the past eight months. I learned a lot about Gojang’s pros and cons, and I hope to make many improvements based on my experience running the app in production.

A modern, batteries-included web framework for Go with HTMX. Build dynamic web applications with minimal JavaScript and maximum productivity.

🌟 Why Gojang?

  • AI Skills: Start AI development from strong boilerplate, save time and tokens - Claude and Codex compatible
  • Batteries Included: Authentication, admin panel, ORM, security - ready to go
  • HTMX First: Modern interactions without heavy JavaScript frameworks
  • Developer Joy: Minimal boilerplate, maximum productivity
  • Type Safe: Ent ORM catches errors at compile time
  • Production Ready: Security, logging, and best practices built-in
  • Easy to Learn: Clear documentation and simple patterns

✨ Features

  • πŸ” Authentication & Authorization - Built-in user system with sessions
  • πŸ‘₯ User Management - Complete user CRUD with permissions
  • πŸŽ›οΈ Auto-Generated Admin Panel - Automatic CRUD interface for any model
  • πŸ“Š Type-Safe ORM - Powered by Ent with reflection-based queries
  • 🎨 HTML Templates - Go templates with layouts and partials
  • ⚑ HTMX Integration - Dynamic interactions without heavy JavaScript
  • οΏ½ Security First - CSRF protection, rate limiting, password hashing
  • 🎯 Simple & Clean - Minimal boilerplate, maximum productivity
  • πŸš€ Production Ready - Audit logging, middleware, error handling

πŸ› οΈ Technology Stack

Technology Purpose
Go 1.21+ Backend language
HTMX Dynamic interactions
Ent Type-safe ORM
Chi HTTP router
Custom CSS Clean, semantic styling
SQLite / PostgreSQL Database

πŸ“ Project Structure

app/
β”œβ”€β”€ cmd/               # Application commands
β”‚   β”œβ”€β”€ migrate/
β”‚   β”œβ”€β”€ seed/
β”‚   └── web/
β”œβ”€β”€ gojang/            # Framework core, admin, auth, models, renderers
β”œβ”€β”€ pages/             # App-owned page handlers, routes, and templates
β”œβ”€β”€ posts/             # App-owned post handlers, routes, and templates
└── views/
    β”œβ”€β”€ i18n/          # Public translation files
    └── static/        # Public CSS, images

πŸš€ Quick Start

  1. Clone the repository:

    git clone https://github.com/gojangframework/gojang
  2. Copy environment file:

    cp .env.example .env
  3. Install dependencies:

    go mod download
  4. Run Ent schema generation:

    task schema-gen
  5. Run the application in dev mode:

    task dev
  6. Visit: http://localhost:8080

That's it! The database is automatically created and migrated on first run.

🌱 First Admin Login (Seed)

You need to run seed program to insert the first admin account

task seed

βš’οΈ Installation

This project uses Task for task automation (cross-platform alternative to Make).

Install Task:

macOS/Linux:

go install github.com/go-task/task/v3/cmd/task@latest

Or using Homebrew:

brew install go-task

Windows:

go install github.com/go-task/task/v3/cmd/task@latest

Or using Chocolatey:

choco install go-task

For other installation methods, see the official Task installation guide.

Install Air (Optional - for live reload):

Air provides automatic reload when code changes, making development faster.

All platforms:

go install github.com/air-verse/air@latest

After installation, you can use task dev to run the server with live reload.

πŸ”§ Development Commands

Run task --list to see all available tasks:

task dev              # Run server with live reload
task build            # Build the application
task test             # Run tests
task migrate          # Run database migrations
task seed             # Seed database with initial data
task schema-gen       # Generate Ent code after schema changes

Or use plain Go commands:

go run ./app/cmd/web                 # Run server
go build -o app ./app/cmd/web        # Build binary
go test ./...                         # Run tests
go generate ./app/gojang/models     # Generate code

πŸ“š Documentation

Ready to start building? Check out our comprehensive guides:

Quick Examples

// 1. Create schema: app/schema/product.go
// 2. Generate: go generate ./app/gojang/models
// 3. Register admin: registry.RegisterModel(...)

See the documentation for detailed step-by-step guides!

🎯 Key Features

Auto-Generated Admin Panel

Register any model and get a full admin interface automatically:

registry.RegisterModel(ModelRegistration{
    ModelType:      &models.Product{},
    Icon:           "πŸ“¦",
    NamePlural:     "Products",
    ListFields:     []string{"ID", "Name", "Price"},
    ReadonlyFields: []string{"ID", "CreatedAt"},
})

Includes:

  • βœ… List view with sorting
  • βœ… Create/Edit forms with validation
  • βœ… Delete with confirmation
  • βœ… Relationship handling
  • βœ… Search and filters (coming soon)

HTMX Integration

Dynamic interactions without writing JavaScript:

<button hx-get="/products/load" 
        hx-target="#product-list"
        hx-swap="innerHTML">
    Load Products
</button>

Type-Safe Database

Define schemas once, use everywhere:

// Define schema
field.String("name").NotEmpty()
field.Float("price").Positive()

// Use with type safety
product := client.Product.Create().
    SetName("Widget").
    SetPrice(19.99).
    Save(ctx)

🀝 Contributing

Contributions are welcome!

Please feel free to submit a Pull Request or email gojangframework@gmail.com

πŸ“ License

BSD 3-Clause "New" or "Revised" License


About

Django-like Web Framework Written in Go and HTMX

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors