Get up and running with Galaplate in just a few minutes!
Before you begin, make sure you have:
The fastest way to get started:
curl -sSL https://raw.githubusercontent.com/sheenazien8/galaplate/master/install.sh | bash
# Install the CLI tool
go install github.com/sheenazien8/galaplate/cmd/galaplate@latest
# Or clone the repository directly
git clone https://github.com/sheenazien8/galaplate.git
cd galaplate
# Create a new project
galaplate my-awesome-api
cd my-awesome-api
# Install dependencies
go mod tidy
# Clone the repository
git clone https://github.com/sheenazien8/galaplate.git my-awesome-api
cd my-awesome-api
# Remove git history and initialize your own
rm -rf .git
git init
git add .
git commit -m "Initial commit"
# Install dependencies
go mod tidy
cp .env.example .env
.env
file:
APP_NAME=MyAwesomeAPI
APP_ENV=local
APP_DEBUG=true
APP_URL=http://localhost
APP_PORT=8080
APP_SCREET=your-super-secret-key-here
# Database Configuration
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=my_awesome_api
DB_USERNAME=root
DB_PASSWORD=your_password
# Basic Auth for Admin Endpoints
BASIC_AUTH_USERNAME=admin
BASIC_AUTH_PASSWORD=secure_password
# Generate a random 32-character secret
openssl rand -base64 32
CREATE DATABASE my_awesome_api CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE DATABASE my_awesome_api;
# View all available console commands
go run main.go console list
# Create database (if needed)
go run main.go console db:create
# Run database migrations
go run main.go console db:up
# Check migration status
go run main.go console db:status
# Start development server with hot reload
make dev
This will:
reflex
if not already installed# Build and run
make run
# Or build separately
make build
./server
Once your server is running, you can test it:
curl http://localhost:8080/
Expected Response:
Hello world
curl -u admin:secure_password http://localhost:8080/logs
This should return an HTML page showing your application logs.
Your application logs will be available in:
storage/logs/app.YYYY-MM-DD.log
Congratulations! ๐ Your Galaplate application is now running. Hereโs what you can do next:
If port 8080 is already in use:
# Change the port in your .env file
APP_PORT=3000
# Or set it temporarily
APP_PORT=3000 make run
# MySQL
brew services start mysql
# or
sudo systemctl start mysql
# PostgreSQL
brew services start postgresql
# or
sudo systemctl start postgresql
Verify connection details in .env
make db-connect
If you encounter missing dependencies:
# Install all development dependencies
make install-deps
# Tidy go modules
make tidy
Here are the most commonly used commands during development:
# Development
make dev # Start with hot reload
make run # Build and run once
make build # Build binary only
make clean # Clean build artifacts
# Database (Console Commands)
go run main.go console db:up # Run migrations
go run main.go console db:down # Rollback migration
go run main.go console db:status # Check migration status
go run main.go console db:fresh # Reset and migrate
go run main.go console db:seed # Run database seeders
# Database (Make Commands - Alternative)
make db-up # Run migrations
make db-down # Rollback migration
make db-status # Check migration status
make db-fresh # Reset and migrate
# Code Quality
make fmt # Format code
make test # Run tests
make test-coverage # Run tests with coverage
# Code Generation (Console Commands)
go run main.go console make:model User # Generate new model
go run main.go console make:dto UserDto # Generate new DTO
go run main.go console make:job ProcessData # Generate background job
go run main.go console make:seeder UserSeeder # Generate database seeder
# Console System
go run main.go console list # List all available commands
go run main.go console example # Run example command
go run main.go console interactive # Interactive demo
Youโre all set! ๐ Start building your amazing API with Galaplate!