Skip to content

Go Project Setup and Architecture #2

@starbops

Description

@starbops

Go Project Setup and Architecture

User Story

As a developer, I want a well-structured Go project foundation so that the team can develop efficiently with consistent patterns.

Technical Requirements

  • Initialize Go module with proper project structure
  • Set up Gin web framework with essential middleware
  • Configure environment variable management
  • Implement structured logging with levels
  • Set up request ID tracking and correlation
  • Create health check and readiness endpoints

Acceptance Criteria

  • Project follows Go project layout standards
  • All HTTP requests have correlation IDs
  • Environment variables loaded from .env file
  • Health endpoints return proper status codes
  • Structured JSON logging implemented
  • CORS middleware configured for frontend domains

Definition of Done

  • Code compiles and runs locally
  • Basic middleware stack functional
  • Health checks pass in development
  • Documentation updated with setup instructions
  • PR reviewed and approved

Implementation Guide

Directory Structure

voidrunner/
├── cmd/
│   └── server/
│       └── main.go
├── internal/
│   ├── api/
│   │   ├── handlers/
│   │   ├── middleware/
│   │   └── routes/
│   ├── config/
│   ├── database/
│   └── models/
├── pkg/
├── migrations/
├── docker/
├── scripts/
├── .env.example
├── go.mod
├── go.sum
├── Dockerfile
└── README.md

Essential Commands

# Initialize Go module
go mod init github.com/voidrunnerhq/voidrunner

# Install dependencies
go get github.com/gin-gonic/gin
go get github.com/joho/godotenv
go get github.com/sirupsen/logrus
go get github.com/google/uuid

# Run the server
go run cmd/server/main.go

Related Epic

Contributes to Epic #1: Core API Infrastructure

Metadata

Metadata

Assignees

Type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions