goplate

Installation

This guide covers different ways to install and set up Galaplate for your development environment.

System Requirements

Minimum Requirements

Database Requirements

Choose one of the following databases:

Optional Tools

Installation Methods

Method 1: Automated Installation Script

The easiest way to get started with Galaplate:

curl -sSL https://raw.githubusercontent.com/sheenazien8/galaplate/master/install.sh | bash

This script will:

Method 2: Go Install

Install directly using Go’s package manager:

go install github.com/sheenazien8/galaplate/cmd/galaplate@latest

Make sure your $GOPATH/bin is in your $PATH:

# Add to your shell profile (.bashrc, .zshrc, etc.)
export PATH=$PATH:$(go env GOPATH)/bin

Method 3: Manual Download

  1. Download the latest release:
    # Replace VERSION with the latest version
    wget https://github.com/sheenazien8/galaplate/releases/download/v1.0.0/galaplate-linux-amd64.tar.gz
    
  2. Extract and install:
    tar -xzf galaplate-linux-amd64.tar.gz
    sudo mv galaplate /usr/local/bin/
    chmod +x /usr/local/bin/galaplate
    

Method 4: Build from Source

For developers who want the latest features:

# Clone the repository
git clone https://github.com/sheenazien8/galaplate.git
cd galaplate

# Build the CLI tool
go build -o galaplate cmd/galaplate/main.go

# Install to your PATH
sudo mv galaplate /usr/local/bin/

Verify Installation

Check that Galaplate is installed correctly:

galaplate --version

You should see output similar to:

Galaplate v1.0.0

Development Dependencies

Install additional tools for the best development experience:

Essential Tools

# Install development dependencies using console commands
go run main.go console db:create

This installs:

Manual Installation

If you prefer to install tools manually:

# Hot reload tool
go install github.com/cespare/reflex@latest

# Database migration tool (optional - console commands available)
go install github.com/amacneil/dbmate@latest

# Environment CLI (requires Node.js)
npm install -g dotenv-cli

Console Command System

Galaplate now includes a powerful console command system. After installation, you can:

# View all available console commands
go run main.go console list

# Generate new models, DTOs, jobs, etc.
go run main.go console make:model User
go run main.go console make:dto UserDto
go run main.go console make:job ProcessEmail

# Database operations
go run main.go console db:up
go run main.go console db:status
go run main.go console db:fresh

Database Setup

MySQL Installation

macOS (Homebrew)

# Install MySQL
brew install mysql

# Start MySQL service
brew services start mysql

# Secure installation (optional but recommended)
mysql_secure_installation

Ubuntu/Debian

# Update package index
sudo apt update

# Install MySQL
sudo apt install mysql-server

# Start MySQL service
sudo systemctl start mysql
sudo systemctl enable mysql

# Secure installation
sudo mysql_secure_installation

CentOS/RHEL

# Install MySQL repository
sudo yum install mysql-server

# Start MySQL service
sudo systemctl start mysqld
sudo systemctl enable mysqld

# Get temporary root password
sudo grep 'temporary password' /var/log/mysqld.log

# Secure installation
mysql_secure_installation

Windows

  1. Download MySQL installer from mysql.com
  2. Run the installer and follow the setup wizard
  3. Choose “Developer Default” for a complete installation
  4. Set a root password during installation

PostgreSQL Installation

macOS (Homebrew)

# Install PostgreSQL
brew install postgresql

# Start PostgreSQL service
brew services start postgresql

# Create a database user (optional)
createuser --interactive

Ubuntu/Debian

# Update package index
sudo apt update

# Install PostgreSQL
sudo apt install postgresql postgresql-contrib

# Start PostgreSQL service
sudo systemctl start postgresql
sudo systemctl enable postgresql

# Switch to postgres user
sudo -u postgres psql

CentOS/RHEL

# Install PostgreSQL
sudo yum install postgresql-server postgresql-contrib

# Initialize database
sudo postgresql-setup initdb

# Start PostgreSQL service
sudo systemctl start postgresql
sudo systemctl enable postgresql

Windows

  1. Download PostgreSQL installer from postgresql.org
  2. Run the installer and follow the setup wizard
  3. Remember the password you set for the postgres user

IDE and Editor Setup

Visual Studio Code

Recommended extensions for Go development:

# Install VS Code extensions
code --install-extension golang.go
code --install-extension ms-vscode.vscode-json
code --install-extension bradlc.vscode-tailwindcss

GoLand

GoLand by JetBrains provides excellent Go support out of the box. No additional setup required.

Vim/Neovim

For Vim users, consider these plugins:

Environment Setup

Git Configuration

Set up Git hooks for better development workflow:

# In your Galaplate project directory
git config core.hooksPath .githooks
chmod +x .githooks/*

Troubleshooting

Common Installation Issues

Go Not Found

# Check if Go is installed
go version

# If not installed, download from https://golang.org/dl/
# Or use package manager:
# macOS: brew install go
# Ubuntu: sudo apt install golang-go

Permission Denied

# Fix permissions for global installation
sudo chown -R $(whoami) $(go env GOPATH)
sudo chown -R $(whoami) $(go env GOROOT)

PATH Issues

# Add Go binary path to your shell profile
echo 'export PATH=$PATH:$(go env GOPATH)/bin' >> ~/.bashrc
source ~/.bashrc

Database Connection Issues

MySQL Connection Refused

# Check if MySQL is running
sudo systemctl status mysql

# Start MySQL if not running
sudo systemctl start mysql

# Check MySQL port
netstat -tlnp | grep :3306

PostgreSQL Connection Issues

# Check PostgreSQL status
sudo systemctl status postgresql

# Check PostgreSQL port
netstat -tlnp | grep :5432

# Connect to PostgreSQL
sudo -u postgres psql

Performance Optimization

Go Module Proxy

Speed up dependency downloads:

# Set Go module proxy
export GOPROXY=https://proxy.golang.org,direct
export GOSUMDB=sum.golang.org

Build Cache

Enable Go build cache for faster builds:

# Check build cache location
go env GOCACHE

# Clean build cache if needed
go clean -cache

Next Steps

After successful installation:

  1. Quick Start - Create your first project
  2. Configuration - Set up your environment
  3. Project Structure - Understand the codebase

Getting Help

If you encounter issues during installation:


Installation complete! 🎉 You’re ready to start building with Galaplate!