Modulus is a Go framework for building modular server applications, supporting both CLI applications and GraphQL web servers. It's designed for creating maintainable, testable, and easily extensible monolithic applications with a modular architecture.
- Modular Design: Applications are composed of independent modules with clear dependencies
- Dependency Injection: Uses Uber's FX framework for dependency injection and lifecycle management
- CLI & GraphQL Support: Primary focus on CLI applications and GraphQL web servers
- Database Integration: Built-in support for PostgreSQL with SQLc for type-safe queries
- CLI Module (
cli): Creates CLI applications usingurfave/cli/v2 - HTTP Module (
http): HTTP server based on Chi router with middleware support - GraphQL Module (
graphql): GraphQL server using gqlgen with playground - Logger Module (
logger): Structured logging with slog and zap backend
- PGX Module (
db/pgx): PostgreSQL driver and connection pooling - Migrator Module (
db/migrator): Database migrations using DBMate - Embedded Module (
db/embedded): Embedded PostgreSQL for testing
- Auth Module (
auth): Token-based authentication with sessions - Email Provider (
auth/providers/email): Email-based authentication - Captcha Module (
captcha): CAPTCHA integration for forms
- Temporal Module (
temporal): Workflow and activity management - Translation Module (
translation): Internationalization support - Error Handling (
errors): Comprehensive error management system
- mtools CLI: Main development tool for project management
mtools init: Initialize new projectsmtools module install: Install framework modulesmtools module create: Create custom modulesmtools db: Database operations (migrate, rollback, generate)
project/
├── cmd/ # Application entry points
│ └── console/ # CLI application entry
├── internal/ # Private application code
│ ├── auth/ # Authentication module (if installed)
│ ├── graphql/ # GraphQL module (if installed)
│ └── [custom-modules]/ # Your custom modules
├── mk/ # Makefile includes
├── bin/ # Compiled binaries
├── modules.json # Installed modules manifest
├── Makefile # Development commands
└── .env files # Environment configurations
module/
├── module.go # Module definition and providers
├── graphql/ # GraphQL resolvers and schemas
├── storage/ # Database layer
│ ├── migration/ # SQL migrations
│ ├── query/ # SQLc query files
│ └── fixture/ # Test data fixtures
├── action/ # Business logic actions
└── cli/ # CLI commands
- Environment-based configuration using
go-envconfig .envfiles for different environments (dev, test, prod)- Module-specific configuration with automatic env variable binding
- Built-in test helpers and fixtures
- Database testing with embedded PostgreSQL
- Snapshot testing support
- Make targets for common operations:
make test: Run all testsmake analyze: Static code analysismake db-migrate: Run database migrations
- Go 1.24: Latest Go version
- FX: Dependency injection framework
- Chi: HTTP router
- gqlgen: GraphQL implementation
- SQLc: Type-safe SQL generation
- DBMate: Database migration tool
- Temporal: Workflow engine (optional)
- Use
mtools initto create new project - Install required modules with
mtools module install - Create custom modules with
mtools module create - Use provided Makefile targets for development tasks
- Follow modular architecture patterns
- Standard Go build process
- Docker support available
- Environment-specific configurations
- Database migrations handled via CLI tools
Based on git status, the project is actively developing an email authentication provider with:
- Email-based user registration and login
- Password reset functionality
- CAPTCHA integration
- GraphQL API endpoints
- Database migrations and storage layer
- Build:
make install(builds mtools binary) - Test:
make test(runs all tests) - Lint:
make analyze(static analysis) - Database:
make db-migrate(run migrations) - Generate:
make db-sqlc-generate(generate SQLc code)
# Install database module
mtools module install -m "pgx"
# Install GraphQL module
mtools module install -m "gqlgen"
# Install authentication
mtools module install -m "auth"This framework emphasizes modularity, type safety, and developer productivity while maintaining the simplicity of a monolithic deployment model.