Skip to content

Arsfiqball/storm

Repository files navigation

Storm Framework

The Storm Framework is a Go-based service boilerplate designed for building scalable applications of any size, from microservices to monoliths. It provides a solid foundation with best practices for modern Go service development.

Go Reference Go Report Card License: MIT

Quick Start

# Clone the repository
git clone https://github.com/Arsfiqball/storm.git
cd storm

# Start development environment
sh ./scripts/isolate_up.sh --expose

# To stop the development environment
sh ./scripts/isolate_down.sh

Core Features

  • Dependency Injection: Uses Wire for compile-time dependency injection
  • HTTP Server: Built with Fiber for high-performance HTTP handling
  • Database Integration: GORM for PostgreSQL database interactions
  • Asynchronous Messaging: Watermill for event-driven architecture
  • Background Processing: Redis-based job processing with gocraft/work
  • Observability: OpenTelemetry integration with Zipkin tracing support
  • Structured Logging: Using Go's slog package with configurable outputs

Architecture

The project follows a clean architecture pattern with:

  • cmd: Application entry points
  • internal: Private application code
    • provider/: Core service providers (Fiber, GORM, Redis, etc.)
    • system/: Application bootstrapping and lifecycle management
  • pkg: Public packages that can be imported by other projects
  • database: Database migration scripts
  • scripts: Utility scripts for development workflows

Development Workflow

The framework includes several convenience scripts:

  • isolate_up.sh: Start the development environment with Docker
  • isolate_down.sh: Tear down the development environment
  • wire.sh: Generate dependency injection code
  • test_component.sh: Run component tests in an isolated environment
  • gomarkdoc.sh: Generate Markdown documentation from code comments

Deployment Options

The framework supports multiple deployment methods:

  1. Docker containers: Multi-stage Docker builds for minimal production images
  2. Debian packages: Build scripts for creating Debian packages with systemd service files

Configuration

Configuration is managed through:

  • Environment variables with APP_ prefix
  • YAML configuration file (.config.yml)
  • Viper for configuration management

This framework is designed to be flexible enough for any Go service development while providing a solid foundation of best practices and patterns.

Project Structure

storm/
├── bin/                # Binary artifacts
│   └── server          # Compiled server binary
├── build/              # Build configurations
│   ├── docker/         # Docker build files
│   │   ├── dev/        # Development Docker setup
│   │   └── prod/       # Production Docker setup
│   └── linux/          # Linux packaging
│       └── debian/     # Debian package build scripts
├── cmd/                # Application entry points
│   └── server/         # Main server executable
│       └── main.go
├── database/           # Database migrations
│   └── postgresql/     # PostgreSQL specific migrations
│       └── migrations/
├── docs/               # Documentation
│   └── packages/       # Package-specific documentation
├── internal/           # Private application code
│   ├── provider/       # Service providers
│   └── system/         # Application bootstrapping
├── pkg/                # Public packages
│   ├── example/        # Example package
│   └── kernel/         # Core functionality
├── scripts/            # Utility scripts
├── test/               # Test files
│   ├── component/      # Component tests
│   └── testhelper/     # Test helper utilities
├── tmp/                # Temporary files
├── .air.toml           # Air configuration for hot reload
├── .config.yml         # Application configuration
├── docker-compose.isolated.yml        # Isolated Docker Compose
├── docker-compose.isolated.expose.yml # Exposed ports Docker Compose
├── go.mod              # Go module definition
└── go.sum              # Go module checksums

Prerequisites

  • Go 1.21+
  • Docker and Docker Compose
  • PostgreSQL 15+
  • Redis 7+
  • Gomarkdoc (for documentation generation)
  • Wire (for dependency injection)

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

About

Go based service boilerplate for any size (micro or monolith)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published