Quick Start Guide

Get up and running with boGO in less than 5 minutes

Prerequisites

  • Go 1.22 or later
  • PostgreSQL (or Docker for local development)
  • Basic understanding of SQL
  • Text editor or IDE

Installation

Clone the boGO repository:

git clone https://github.com/WithBogo/bogo.git
cd bogo

Generate Your First Service

1. Create a SQL Schema

Create a file called blog_schema.sql:

CREATE TABLE users (
    id BIGSERIAL PRIMARY KEY,
    username VARCHAR(50) UNIQUE NOT NULL,
    email VARCHAR(255) UNIQUE NOT NULL,
    password_hash VARCHAR(255) NOT NULL,
    created_at TIMESTAMPTZ DEFAULT NOW(),
    updated_at TIMESTAMPTZ DEFAULT NOW()
);

CREATE TABLE posts (
    id BIGSERIAL PRIMARY KEY,
    user_id BIGINT REFERENCES users(id),
    title VARCHAR(255) NOT NULL,
    content TEXT NOT NULL,
    published BOOLEAN DEFAULT FALSE,
    created_at TIMESTAMPTZ DEFAULT NOW(),
    updated_at TIMESTAMPTZ DEFAULT NOW()
);

CREATE TABLE comments (
    id BIGSERIAL PRIMARY KEY,
    post_id BIGINT REFERENCES posts(id),
    user_id BIGINT REFERENCES users(id),
    content TEXT NOT NULL,
    created_at TIMESTAMPTZ DEFAULT NOW()
);

2. Generate the Service

go run . blog-service blog_schema.sql

3. Explore the Generated Code

boGO creates a complete project structure:

blog-service/
├── domain/              # Business entities and interfaces
│   ├── user.go         # User entity and repository interface
│   ├── post.go         # Post entity and repository interface
│   ├── comment.go      # Comment entity and repository interface
│   └── interfaces.go   # Common interfaces
├── repository/          # Data access layer
│   ├── user_repository.go
│   ├── post_repository.go
│   └── comment_repository.go
├── interactor/          # Business logic layer
│   ├── user_interactor.go
│   ├── post_interactor.go
│   └── comment_interactor.go
├── rest/               # HTTP API layer
│   ├── user_handler.go
│   ├── post_handler.go
│   ├── comment_handler.go
│   └── middleware.go
├── application/        # Main application
│   └── main.go
├── migration/          # Database migrations
│   └── 001_initial.sql
├── docker-compose.yml  # Docker setup
├── Dockerfile         # Container image
├── Makefile          # Build scripts
└── go.mod            # Go dependencies

4. Run Your Service

cd blog-service

# Start with Docker (includes PostgreSQL)
docker-compose up -d

# Or run locally (requires PostgreSQL running)
go run application/main.go

5. Test Your API

Your service is now running on http://localhost:8080

# Health check
curl http://localhost:8080/health

# Create a user
curl -X POST http://localhost:8080/users \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer your-token" \
  -d '{
    "username": "johndoe",
    "email": "john@example.com",
    "password_hash": "hashed-password"
  }'

# Get all users
curl http://localhost:8080/users \
  -H "Authorization: Bearer your-token"

What Gets Generated?

🏗️ Complete Hexagonal Architecture

  • Domain Layer: Pure business entities and interfaces
  • Interactor Layer: Business logic and use cases
  • Repository Layer: Database access with PostgreSQL
  • REST Layer: HTTP handlers with middleware
  • Application Layer: Dependency injection and startup

🚀 Production Features

  • JWT Authentication middleware
  • Database migrations
  • Health check endpoints
  • Docker containerization
  • Comprehensive error handling
  • Request/Response DTOs
  • Database connection pooling

📋 CRUD Operations

For each table, boGO generates:

  • POST /resource - Create new record
  • GET /resource - List all records
  • GET /resource/{id} - Get single record
  • PUT /resource/{id} - Update record
  • DELETE /resource/{id} - Delete record

Next Steps

📖 Learn Architecture

Understand hexagonal architecture patterns and best practices

Architecture Guide →

🔧 API Reference

Complete reference for generated APIs and customization

API Docs →

💡 Best Practices

Production tips and recommended development patterns

Best Practices →