 README
      ΒΆ
      README
      ΒΆ
    
    
      GoInit - Go Gin API Generator
A powerful CLI tool to generate production-ready Go API projects built with the Gin framework.
π Installation
Option 1: Go Install (Recommended)
go install github.com/rou/goinit@latest
Option 2: Download Binary
Download the latest release from GitHub Releases
Option 3: Build from Source
git clone https://github.com/rou/goinit.git
cd goinit
go build -o goinit .
π Usage
goinit
Follow the interactive prompts to configure your new Go API project.
β¨ Features
- Interactive Setup: Step-by-step project configuration
- Multiple Databases: SQLite, MySQL, PostgreSQL support
- Authentication: JWT and session-based auth
- Real-time: SSE and WebSocket endpoints
- Email Integration: SMTP and local email logging
- File Storage: Local and S3-compatible storage
- Admin Panel: Built-in admin functionality
- API Documentation: Auto-generated Swagger docs
- Docker Support: Ready-to-deploy containers
- Smart Module Initialization: Automatically initializes Go modules
- Module Reference Replacement: Updates all internal module references
- Automatic Dependency Management: Runs go mod tidyto download all packages
π― What You Get
Your generated project includes:
- β Clean Architecture with dependency injection
- β User authentication and authorization
- β Real-time communication (SSE/WebSocket)
- β Database models with GORM
- β Email service with templates
- β File upload and storage
- β Admin dashboard endpoints
- β Swagger API documentation
- β Docker configuration
- β Comprehensive README and setup instructions
π Requirements
- Go 1.19 or later
- Git
π οΈ Configuration Options
During setup, you can configure:
- Project Name: Your API project name
- Go Module: Module path (e.g., github.com/username/project)
- Database: SQLite (default), MySQL, or PostgreSQL
- Port: Server port (default: 8080)
π§ Smart Module Management
GoInit includes intelligent module management features:
Automatic Go Module Initialization
- Checks for existing go.mod: If a go.modfile already exists, it skips initialization
- Runs go mod init: Automatically initializes a new Go module with your specified module name
- No manual setup required: The generated project is ready to use immediately
Module Reference Replacement
- Scans all Go files: Searches through all generated Go files for module references
- Replaces old references: Updates any hardcoded module references with your custom module name
- Maintains consistency: Ensures all internal imports use the correct module path
Example
# User specifies: github.com/mycompany/myapi
# GoInit will:
# 1. Run: go mod init github.com/mycompany/myapi
# 2. Replace any "github.com/SOG-web/goinit" references with "github.com/mycompany/myapi"
# 3. Run: go mod tidy (downloads all dependencies)
# 4. Generate a fully functional project ready to run
π Generated Project Structure
your-project/
βββ cmd/api/                 # Application entry point
βββ config/                  # Configuration management
βββ internal/
β   βββ app/                # Application services
β   βββ data/               # Data layer (repositories)
β   βββ domain/             # Domain models
β   βββ lib/                # Shared libraries
β   βββ server/             # Server setup
βββ api/                    # HTTP handlers and routes
βββ docs/                   # API documentation
βββ .env                    # Environment configuration
βββ go.mod                  # Go module file
βββ README.md               # Project documentation
βββ Dockerfile              # Docker configuration
π Quick Start with Generated Project
# Navigate to your new project
cd your-project-name
# Dependencies are already downloaded by GoInit
# Configure environment (optional)
# Edit .env file with your settings
# Run the server
go run cmd/api/main.go
Visit http://localhost:8080 and http://localhost:8080/docs for API documentation.
π API Endpoints
Authentication
- POST /api/auth/register/- User registration
- POST /api/auth/login/- User login
- GET /api/auth/logout/- User logout
Real-time
- GET /api/sse/events- Server-Sent Events
- GET /api/ws/connect- WebSocket connection
Admin
- GET /api/admin/users/- List users
- GET /api/admin/stats/- User statistics
π€ Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π Acknowledgments
- Gin Web Framework
- GORM
- Inspired by Django's admin and authentication patterns
Happy coding! π
Test change for hook
Test commit
       Documentation
      ΒΆ
      Documentation
      ΒΆ
    
    
  
    
  
    There is no documentation for this package.
 Click to show internal directories. 
   Click to hide internal directories.