Skip to content

Instantly share code, notes, and snippets.

@saiqulhaq
Created November 13, 2025 17:10
Show Gist options
  • Select an option

  • Save saiqulhaq/1b789cf96c77a5d9a254bf045edc88eb to your computer and use it in GitHub Desktop.

Select an option

Save saiqulhaq/1b789cf96c77a5d9a254bf045edc88eb to your computer and use it in GitHub Desktop.
learn go

Project Review

This is a well-structured Go skeleton project that follows Clean Architecture principles. Coming from Rails, you'll find some familiar patterns but with Go's unique approach.

Architecture Highlights:

Strong Points:

  • ✅ Clean separation of concerns (Handler → Usecase → Repository)
  • ✅ Dependency injection pattern (similar to Rails services)
  • ✅ JWT authentication with RS512 (like Devise but more explicit)
  • ✅ Database migrations (like Rails migrations)
  • ✅ Unit testing with mocks (like RSpec with doubles)
  • ✅ API documentation with Swagger
  • ✅ Background jobs via RabbitMQ (like Sidekiq)
  • ✅ Proper error handling and logging

Rails vs Go Comparison:

  • Handlers = Rails Controllers
  • Usecases = Rails Service Objects/Interactors
  • Repositories = Rails ActiveRecord Models (but more explicit)
  • Entities = Rails Models (just data structures, no ORM magic)
  • Fiber = Rails/Sinatra (fast HTTP framework)

Suggested Learning Use Cases

Based on your Rails background, here are practical scenarios ranked by learning value:

1. Blog API with Comments 🌟 Best for Beginners

Why: Extends existing patterns, teaches Go relationships

What to build:

  • Posts CRUD (title, body, author)
  • Comments (belongs to posts)
  • Categories/Tags (many-to-many)
  • Markdown support for posts

What you'll learn:

  • Go struct composition
  • GORM associations (has_many, belongs_to)
  • Nested JSON responses
  • Filtering and pagination

2. E-commerce Product Catalog 🌟 Intermediate

Why: Real-world complexity, teaches transactions

What to build:

  • Products with variants (size, color)
  • Inventory tracking
  • Shopping cart (session-based)
  • Order creation with transactions

What you'll learn:

  • Database transactions
  • Concurrent updates (Go's strength)
  • Redis caching for cart
  • Complex queries with GORM

3. File Upload Service 🌟 Great for Go Features

Why: Teaches Go's concurrency and streaming

What to build:

  • Image/document upload
  • Thumbnail generation (goroutines!)
  • S3/local storage
  • Progress tracking

What you'll learn:

  • Go channels and goroutines
  • File I/O patterns
  • Multipart form handling
  • Background processing

4. Notification System 🌟 Advanced

Why: Utilizes RabbitMQ worker architecture

What to build:

  • Multi-channel notifications (email, SMS, push)
  • Template system
  • Queue-based delivery
  • Retry logic

What you'll learn:

  • Message queue patterns
  • Worker processes
  • Error handling strategies
  • Go's interface power

5. Real-time Chat API 🌟 Explores Go's Strengths

Why: WebSockets, concurrency, real-time

What to build:

  • Chat rooms
  • Direct messages
  • Online status
  • Message history

What you'll learn:

  • WebSocket with Fiber
  • Goroutines for real-time
  • Redis pub/sub
  • Connection management

Quick Start Recommendation

For your first learning project, I suggest:

"Extended Todo with Teams"

Build on the existing todo-list by adding:

  1. Teams/Workspaces (users can create teams)
  2. Shared todos (assign todos to team members)
  3. Comments on todos
  4. File attachments
  5. Activity feed (using RabbitMQ)

Why this is perfect:

  • 70% of the code already exists
  • You'll modify existing patterns (learn by doing)
  • Covers relationships, uploads, and queues
  • Small enough to complete, big enough to learn

Time estimate: 2-3 days for a Rails dev learning Go


Key Differences to Remember (Rails → Go)

Concept Rails Go
Type Safety Dynamic Strict static typing
Error Handling Exceptions Explicit err returns
Concurrency Threads/Fibers Goroutines (way better!)
ORM ActiveRecord (magical) GORM (explicit)
Dependencies Gemfile go.mod
Nil checks present? if obj != nil everywhere
Testing RSpec DSL Table-driven tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment