diff --git a/.gitignore b/.gitignore index 53a16b69..fce003a9 100644 --- a/.gitignore +++ b/.gitignore @@ -120,6 +120,7 @@ METRICS_DEADLOCK_FIX.md **/*.md !**/README.md +!/CONTRIBUTING.md !docs/**/*.md !extensions/dashboard/contract/*.md !extensions/dashboard/contract/shell/*.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..40ec7455 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,85 @@ +# Contributing to Forge + +Thanks for taking the time. This covers the mechanics; open a +[discussion](https://github.com/xraph/forge/discussions) if you want to talk +through an idea before writing code. + +## Setting up + +You need Go 1.24 or later. Make is optional, but every command below assumes it. + +```bash +git clone https://github.com/your-username/forge.git +cd forge +make install-tools +``` + +## Making a change + +Work on a branch, not on `main`. + +```bash +make test # all tests +make test-coverage # with coverage +go test ./extensions/graphql/... +``` + +Before you push, run what CI runs: + +```bash +make ci +``` + +That covers formatting, linting and tests together. The individual targets are +there when you want to iterate faster: + +```bash +make fmt # format +make lint # lint +make lint-fix # lint and fix what can be fixed +make security-scan # security scan +make vuln-check # check dependencies for known vulnerabilities +``` + +## Commit messages + +Commits follow [Conventional Commits](https://www.conventionalcommits.org/). +The prefix is not cosmetic: Release Please reads it to decide the next version +and to build the changelog, so a mislabelled commit produces a wrong release. + +``` +feat: a new feature, bumps the minor version +fix: a bug fix, bumps the patch version +docs: documentation only +style: formatting, no behaviour change +refactor: neither a fix nor a feature +perf: a performance change +test: adding or correcting tests +chore: build, tooling, dependencies +``` + +Add a scope when it narrows things usefully, for example `fix(router):` or +`feat(client):`. + +## Pull requests + +Open the PR against `main`. Describe what changes and why; if the reason is a +bug, say what the bug did rather than only that it existed. + +A PR is ready to review when `make ci` passes and the change is covered by +tests. If part of the work is deliberately left out, say so in the description +rather than leaving a reviewer to notice. + +## Releases + +You do not need to do anything to release your change. Merging to `main` with a +conventional commit message is enough: Release Please opens a PR with the +version bump and changelog, and merging that PR tags and publishes. + +See the [README](README.md#releases) for the full pipeline, including how to cut +a release by hand. + +## Licence + +Forge is Apache 2.0. By contributing you agree that your contribution is +licensed under the same terms. See [LICENSE](LICENSE). diff --git a/LICENSING.md b/LICENSING.md deleted file mode 100644 index dc029aae..00000000 --- a/LICENSING.md +++ /dev/null @@ -1,209 +0,0 @@ -# Forge Framework - Licensing Guide - -This document explains the licensing structure for the Forge framework and its extensions. - -## πŸ“œ Overview - -Forge uses a **dual-licensing approach**: - -1. **Forge Core Framework**: MIT License (permissive, open source) -2. **AI Extension**: Commercial Source-Available License (restrictive) -3. **All Other Extensions**: MIT License (permissive, open source) - -## 🎯 Quick Reference - -| Component | License | Commercial Use | Redistribution | -|-----------|---------|----------------|----------------| -| Forge Core | MIT | βœ… Free | βœ… Yes | -| Auth Extension | MIT | βœ… Free | βœ… Yes | -| Cache Extension | MIT | βœ… Free | βœ… Yes | -| Consensus Extension | MIT | βœ… Free | βœ… Yes | -| Dashboard Extension | MIT | βœ… Free | βœ… Yes | -| Database Extension | MIT | βœ… Free | βœ… Yes | -| Events Extension | MIT | βœ… Free | βœ… Yes | -| GraphQL Extension | MIT | βœ… Free | βœ… Yes | -| gRPC Extension | MIT | βœ… Free | βœ… Yes | -| HLS Extension | MIT | βœ… Free | βœ… Yes | -| Kafka Extension | MIT | βœ… Free | βœ… Yes | -| MCP Extension | MIT | βœ… Free | βœ… Yes | -| MQTT Extension | MIT | βœ… Free | βœ… Yes | -| oRPC Extension | MIT | βœ… Free | βœ… Yes | -| Queue Extension | MIT | βœ… Free | βœ… Yes | -| Search Extension | MIT | βœ… Free | βœ… Yes | -| Storage Extension | MIT | βœ… Free | βœ… Yes | -| Streaming Extension | MIT | βœ… Free | βœ… Yes | -| WebRTC Extension | MIT | βœ… Free | βœ… Yes | -| **AI Extension** | **Commercial** | **❌ License Required** | **❌ No** | - -## πŸ“– License Details - -### Forge Core & Most Extensions (MIT License) - -**Location**: `LICENSE` (root directory) - -The MIT License is one of the most permissive open source licenses. You can: - -- βœ… Use for commercial purposes -- βœ… Modify the code -- βœ… Distribute copies -- βœ… Sublicense -- βœ… Use in proprietary software - -**Requirements**: -- Include the original copyright notice -- Include the license text - -**No Warranty**: The software is provided "as is" without warranty. - -### AI Extension (Commercial Source-Available License) - -**Location**: `extensions/ai/LICENSE` - -The AI Extension uses a more restrictive license because it contains proprietary algorithms and represents significant R&D investment. - -#### Free Use Cases - -You CAN use the AI Extension for FREE for: -- Personal projects -- Educational purposes -- Research and academic use -- Internal evaluation (90 days) -- Learning and studying the code - -#### Commercial License Required - -You NEED a paid commercial license for: -- Production deployments in commercial environments -- SaaS products or services -- Internal tools that generate revenue or cost savings -- Any commercial advantage use - -#### Prohibited Without Permission - -You CANNOT: -- Redistribute the AI Extension -- Build competing AI products -- Extract and reuse the AI models or algorithms -- Remove copyright notices - -**See**: `extensions/ai/LICENSE_NOTICE.md` for detailed summary - -## 🀝 Why This Licensing Structure? - -### Open Core Model - -We believe in open source and want to provide a powerful, free framework for the community. The MIT license for Forge core and most extensions ensures: - -- Maximum adoption and community growth -- No barriers for startups and small projects -- Transparent, auditable code -- Community contributions and improvements - -### Protecting Innovation - -The AI Extension represents specialized work that required significant investment in: - -- AI model integration research -- Team coordination algorithms -- Training pipeline development -- Production-grade inference systems - -The commercial license for the AI Extension allows us to: - -- Continue investing in R&D -- Provide enterprise support -- Maintain the extension long-term -- Build a sustainable business model - -## πŸ’Ό Getting a Commercial License - -### Pricing - -Contact us for pricing information. We offer: - -- **Startup Plans**: Affordable pricing for early-stage companies -- **Enterprise Plans**: Unlimited use with SLA and support -- **Custom Agreements**: Tailored licensing for specific needs - -### What's Included - -Commercial licenses include: - -- βœ… Production deployment rights -- βœ… Commercial use authorization -- βœ… Priority email and chat support -- βœ… Security patch notifications -- βœ… Upgrade assistance -- βœ… Optional: Custom SLAs -- βœ… Optional: Integration consulting - -### Contact - -- **Email**: licensing@xraph.com -- **Web**: https://github.com/xraph/forge -- **Sales**: Schedule a call via the website - -## ❓ FAQ - -### Can I use Forge Core with the AI Extension together? - -Yes! You can use Forge Core (MIT) in any project. If you want to add the AI Extension: -- Free for personal/evaluation use -- Commercial license required for production use - -### What if I only use Forge Core without the AI Extension? - -Perfect! The core framework is MIT licensedβ€”use it freely for any purpose, including commercial products. - -### Can I contribute to the AI Extension? - -Yes! We welcome contributions. By contributing, you grant us a license to use your contribution under any license terms, including the commercial license. Contributors are recognized and appreciated. - -### Can I fork and modify Forge Core? - -Absolutely! The MIT license allows you to fork, modify, and redistribute the core framework. - -### Can I fork and modify the AI Extension? - -You can fork and modify for personal use, but you cannot redistribute your fork. See the AI Extension license for details. - -### What happens if I violate the AI Extension license? - -License termination and potential legal action. We prefer to work with users to ensure complianceβ€”contact us if you have questions. - -### Can I get a trial commercial license? - -The 90-day evaluation period lets you test the AI Extension internally. Contact us to extend the evaluation or discuss trial licensing. - -### Do students/researchers need a commercial license? - -No! Academic and research use is explicitly allowed under the free tier. - -### What if I'm building an open source project? - -For open source projects: -- Forge Core: Use freely (MIT) -- AI Extension: Personal/educational use is free; if the project generates revenue, a commercial license is needed - -## πŸ“š Additional Resources - -- **Main License (MIT)**: `/LICENSE` -- **AI Extension License**: `/extensions/ai/LICENSE` -- **AI Extension Summary**: `/extensions/ai/LICENSE_NOTICE.md` -- **Contributing Guide**: `/CONTRIBUTING.md` (if available) -- **Code of Conduct**: `/CODE_OF_CONDUCT.md` (if available) - -## πŸ”„ License Changes - -We reserve the right to change licensing terms for future versions. Existing versions remain under their original licenses. - -- Current version licensing is locked -- Future versions may have different terms -- You can continue using the version you acquired under its original license - ---- - -**Last Updated**: October 28, 2025 - -For questions about licensing, contact: licensing@xraph.com - diff --git a/README.md b/README.md index 762c34c2..ef90ccf7 100644 --- a/README.md +++ b/README.md @@ -1,43 +1,28 @@ -# πŸ”¨ Forge +# Forge -Forgeβ„’ is a backend framework, and Forge Cloudβ„’ is its AI cloud offering, maintained by XRAPHβ„’. - -**Enterprise-Grade Web Framework for Go** +A Go framework for backend services, with dependency injection, an extension system, and observability built in. -> Build scalable, maintainable, and observable Go applications with Forgeβ€”the modern framework that brings clean architecture, dependency injection, and powerful extensions to your production services. +Forgeβ„’ is a backend framework, and Forge Cloudβ„’ is its AI cloud offering, maintained by XRAPHβ„’. [![Go Version](https://img.shields.io/badge/Go-1.24+-00ADD8?style=flat&logo=go)](https://golang.org/) [![Go Report Card](https://goreportcard.com/badge/github.com/xraph/forge)](https://goreportcard.com/report/github.com/xraph/forge) -[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) +[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE) [![GitHub Stars](https://img.shields.io/github/stars/xraph/forge)](https://github.com/xraph/forge) [![CI](https://github.com/xraph/forge/actions/workflows/go.yml/badge.svg)](https://github.com/xraph/forge/actions/workflows/go.yml) ---- - - -## πŸš€ Quick Start - -### Installation +## Quick start ```bash -# Install the Forge CLI go install github.com/xraph/forge/cmd/forge@latest - -# Verify installation forge --version ``` -### Forge Your First App - ```bash -# Initialize a new project forge init my-app - -# Start the development server forge dev ``` -### Minimal Example +A minimal service: ```go package main @@ -45,7 +30,6 @@ package main import "github.com/xraph/forge" func main() { - // Create app with default configuration app := forge.NewApp(forge.AppConfig{ Name: "my-app", Version: "1.0.0", @@ -53,7 +37,6 @@ func main() { HTTPAddress: ":8080", }) - // Register routes router := app.Router() router.GET("/", func(ctx forge.Context) error { return ctx.JSON(200, map[string]string{ @@ -61,144 +44,75 @@ func main() { }) }) - // Run the application (blocks until SIGINT/SIGTERM) + // Blocks until SIGINT or SIGTERM. app.Run() } ``` -**Built-in endpoints:** -- `/_/info` - Application information -- `/_/metrics` - Prometheus metrics -- `/_/health` - Health checks - ---- - -## ✨ Key Features - -### πŸ—οΈ Core Framework - -- **βœ… Dependency Injection** - Type-safe container with service lifecycle -- **βœ… HTTP Router** - Fast, lightweight routing with middleware support -- **βœ… Middleware** - Auth, CORS, logging, rate limiting, and more -- **βœ… Configuration** - YAML/JSON/TOML support with environment variable override -- **βœ… Observability** - Structured logging, metrics, distributed tracing -- **βœ… Health Checks** - Automatic discovery and reporting -- **βœ… Lifecycle Management** - Graceful startup and shutdown - -### πŸ”Œ Extensions - -| Extension | Description | Status | -|-----------|-------------|--------| -| **AI** | LLM integration, agents, inference engine | βœ… | -| **Auth** | Multi-provider authentication (OAuth, JWT, SAML) | βœ… | -| **Cache** | Multi-backend caching (Redis, Memcached, In-Memory) | βœ… | -| **Consensus** | Raft consensus for distributed systems | βœ… | -| **Database** | SQL (Postgres, MySQL, SQLite) + MongoDB support | βœ… | -| **Events** | Event bus and event sourcing | βœ… | -| **GraphQL** | GraphQL server with schema generation | βœ… | -| **gRPC** | gRPC server with reflection | βœ… | -| **HLS** | HTTP Live Streaming | βœ… | -| **Kafka** | Apache Kafka integration | βœ… | -| **MCP** | Model Context Protocol | βœ… | -| **MQTT** | MQTT broker and client | βœ… | -| **orpc** | ORPC transport protocol | βœ… | -| **Queue** | Message queue management | βœ… | -| **Search** | Full-text search (Elasticsearch, Typesense) | βœ… | -| **Storage** | Multi-backend storage (S3, GCS, Local) | βœ… | -| **Streaming** | WebSocket, SSE, WebRTC | βœ… | -| **WebRTC** | Real-time peer-to-peer communication | βœ… | - -### πŸ› οΈ CLI Tools - -- **βœ… Project Scaffolding** - Initialize new projects with templates -- **βœ… Code Generation** - Generate handlers, controllers, and services -- **βœ… Database Migrations** - Schema management with versioning -- **βœ… Interactive Prompts** - Arrow-key navigation, multi-select -- **βœ… Server Management** - Development server with hot reload -- **βœ… Testing** - Built-in test runner and coverage reports - ---- - -## πŸ“– Documentation - -### Getting Started - -- [**Installation Guide**](docs/content/docs/getting-started/installation.mdx) -- [**Quick Start**](docs/content/docs/getting-started/quick-start.mdx) -- [**Architecture**](docs/content/docs/architecture/index.mdx) -- [**Examples**](examples/) - -### Core Concepts - -- [**Application Lifecycle**](docs/content/docs/core/lifecycle.mdx) -- [**Dependency Injection**](docs/content/docs/core/dependency-injection.mdx) -- [**Routing**](docs/content/docs/core/routing.mdx) -- [**Middleware**](docs/content/docs/core/middleware.mdx) -- [**Configuration**](docs/content/docs/core/configuration.mdx) -- [**Observability**](docs/content/docs/core/observability.mdx) - -### Extensions - -- [**AI Extension**](extensions/ai/README.md) - LLM integration and AI agents -- [**Auth Extension**](extensions/auth/README.md) - Authentication providers -- [**Database Extension**](extensions/database/) - SQL and NoSQL databases -- [**GraphQL Extension**](extensions/graphql/README.md) - GraphQL server -- [**gRPC Extension**](extensions/grpc/README.md) - gRPC services -- [**Streaming Extension**](extensions/streaming/) - WebSocket and SSE - -### CLI Reference - -- [**CLI Documentation**](cli/README.md) -- [**Commands Reference**](cmd/forge/COMMANDS.md) - ---- - -## 🌟 Why Forge? - -### Production-Ready - -Forge is built for production from day one: - -- **βœ… Graceful Shutdown** - Proper resource cleanup on SIGTERM -- **βœ… Health Monitoring** - Automatic discovery and reporting -- **βœ… Observability** - Metrics, logging, and distributed tracing -- **βœ… Error Handling** - Comprehensive error management -- **βœ… Security** - Built-in security best practices - -### Developer Experience - -- **βœ… Type Safety** - Generics and compile-time guarantees -- **βœ… Zero Config** - Sensible defaults with full customization -- **βœ… Hot Reload** - Instant feedback during development -- **βœ… CLI Tools** - Fast project scaffolding and generation -- **βœ… Rich Docs** - Comprehensive documentation and examples - -### Performance - -- **βœ… Low Latency** - Optimized HTTP router and middleware -- **βœ… Efficient Routing** - Trie-based path matching -- **βœ… Concurrent Safe** - Thread-safe components -- **βœ… Memory Efficient** - Minimal allocations - -### Extensible - -- **βœ… Extension System** - Modular, composable extensions -- **βœ… Plugin Architecture** - Easy to add custom functionality -- **βœ… Multi-Backend** - Switch implementations without code changes -- **βœ… Middleware Chain** - Powerful middleware composition - ---- - -## πŸ›οΈ Architecture +Every app serves three endpoints without configuration: `/_/info` for application +metadata, `/_/metrics` for Prometheus, and `/_/health` for health checks. + +## What you get + +The core framework handles the parts most services need before they can do +anything interesting: + +- A type-safe dependency injection container with service lifecycles +- An HTTP router with trie-based path matching and middleware support +- Middleware for auth, CORS, logging and rate limiting +- Configuration from YAML, JSON or TOML, overridable by environment variables +- Structured logging, Prometheus metrics and distributed tracing +- Health checks that discover and report themselves +- Graceful startup and shutdown, so SIGTERM cleans up rather than drops work + +The CLI scaffolds projects, generates handlers and services, runs migrations, +and serves your app with hot reload. See [cli/README.md](cli/README.md) and the +[commands reference](cmd/forge/COMMANDS.md). + +## Extensions + +Extensions are modules you compose into an app. Most are production ready; three +are still being built. + +| Extension | What it does | +|---|---| +| [auth](extensions/auth/README.md) | Multi-provider authentication (OAuth, JWT, SAML) | +| cache | Multi-backend caching (Redis, Memcached, in-memory) | +| [consensus](extensions/consensus/README.md) | Raft consensus for distributed systems | +| [cron](extensions/cron/README.md) | Distributed cron scheduling with execution history | +| [dashboard](extensions/dashboard/README.md) | Micro-frontend shell for admin dashboards | +| database | SQL (Postgres, MySQL, SQLite) and MongoDB | +| [discovery](extensions/discovery/README.md) | Service discovery and registry | +| events | Event bus and event sourcing | +| [features](extensions/features/README.md) | Feature flags and A/B testing | +| [graphql](extensions/graphql/README.md) | GraphQL server with schema generation | +| [grpc](extensions/grpc/README.md) | gRPC server with reflection | +| [hls](extensions/hls/README.md) | HTTP Live Streaming | +| [kafka](extensions/kafka/README.md) | Apache Kafka integration | +| [mcp](extensions/mcp/README.md) | Model Context Protocol | +| [mqtt](extensions/mqtt/README.md) | MQTT broker and client | +| [security](extensions/security/README.md) | Security hardening for production apps | +| [storage](extensions/storage/README.md) | Object storage (S3, GCS, local) | +| [streaming](extensions/streaming/README.md) | WebSocket and SSE | +| [webrtc](extensions/webrtc/README.md) | Peer-to-peer real-time communication | +| [orpc](extensions/orpc/README.md) | ORPC transport protocol (in progress) | +| [queue](extensions/queue/README.md) | Message queue management (in progress) | +| search | Full-text search, Elasticsearch and Typesense (in progress) | + +The [complete catalog](docs/content/docs/extensions/complete-catalog.mdx) covers +configuration for each one. + +## Composing an application + +Extensions are declared in the app config. Services register against the +container, and handlers resolve them from it: ```go -// Application Structure app := forge.NewApp(forge.AppConfig{ Name: "my-service", Version: "1.0.0", Environment: "production", - - // Extensions + Extensions: []forge.Extension{ database.NewExtension(database.Config{ Databases: []database.DatabaseConfig{ @@ -209,15 +123,13 @@ app := forge.NewApp(forge.AppConfig{ }, }, }), - + auth.NewExtension(auth.Config{ Provider: "oauth2", - // ... auth configuration }), }, }) -// Dependency Injection forge.RegisterSingleton(app.Container(), "userService", func(c forge.Container) (*UserService, error) { db, err := database.GetSQL(c) if err != nil { @@ -227,331 +139,109 @@ forge.RegisterSingleton(app.Container(), "userService", func(c forge.Container) return NewUserService(db, logger), nil }) -// Routing router := app.Router() router.GET("/users/:id", getUserHandler) router.POST("/users", createUserHandler) -// Run app.Run() ``` ---- - -## 🧩 Extension Example - -### Using the AI Extension - -```go -package main - -import ( - "github.com/xraph/forge" - "github.com/xraph/forge/extensions/ai" -) - -func main() { - app := forge.NewApp(forge.AppConfig{ - Extensions: []forge.Extension{ - ai.NewExtension(ai.Config{ - LLMProviders: map[string]ai.LLMProviderConfig{ - "openai": { - APIKey: os.Getenv("OPENAI_API_KEY"), - Model: "gpt-4", - }, - }, - }), - }, - }) - - // Access AI service via DI using helper function - aiService, err := ai.GetAIService(app.Container()) - if err != nil { - log.Fatal(err) - } - - // Use in your handlers - router := app.Router() - router.POST("/chat", func(ctx forge.Context) error { - result, err := aiService.Chat(ctx, ai.ChatRequest{ - Messages: []ai.Message{ - {Role: "user", Content: "Hello!"}, - }, - }) - if err != nil { - return err - } - return ctx.JSON(200, result) - }) - - app.Run() -} -``` - ---- +Switching a backend is a config change rather than a code change: the same +`database.GetSQL(c)` call works whether it resolves to Postgres or SQLite. -## πŸ› οΈ Development +## Documentation -### Prerequisites +- [Installation](docs/content/docs/forge/installation.mdx) +- [Quick start](docs/content/docs/forge/quick-start.mdx) +- [Architecture](docs/content/docs/forge/architecture.mdx) +- [Application lifecycle](docs/content/docs/forge/lifecycle.mdx) +- [Dependency injection](docs/content/docs/forge/dependency-injection.mdx) +- [Routing](docs/content/docs/forge/%28router%29/router.mdx) and [middleware](docs/content/docs/forge/%28router%29/middleware.mdx) +- [Configuration](docs/content/docs/forge/configuration.mdx) +- [Observability](docs/content/docs/forge/observability.mdx) -- **Go 1.24+** - Latest Go compiler -- **Make** - Build tool (optional but recommended) +Full docs are at [forge.dev](https://forge.dev). Questions and ideas go in +[Discussions](https://github.com/xraph/forge/discussions); bugs go in +[Issues](https://github.com/xraph/forge/issues). -### Build +## Examples -```bash -# Build the CLI -make build +The [examples](examples/) directory has runnable services. Some worth starting +with: -# Build with debug symbols -make build-debug +- [di-patterns](examples/di-patterns/) for container registration +- [lifecycle-hooks](examples/lifecycle-hooks/) for startup and shutdown ordering +- [observability](examples/observability/) for metrics, logging and tracing +- [simple-extension](examples/simple-extension/) and [runnable-extension](examples/runnable-extension/) for writing your own +- [openapi-demo](examples/openapi-demo/) for generated API specs +- [sse-streaming](examples/sse-streaming/) and [webtransport](examples/webtransport/) for streaming transports +- [auth](extensions/auth/examples/auth_example/) and [graphql](extensions/graphql/examples/graphql-basic/) for those extensions -# Build for all platforms -make release -``` +## Development -### Run Tests +You need Go 1.24 or later. Make is optional but the targets below assume it. ```bash -# Run all tests -make test - -# Run with coverage -make test-coverage - -# Run specific package -go test ./extensions/ai/... +make build # build the CLI +make build-debug # build with debug symbols +make release # build for all platforms ``` -### Code Quality - ```bash -# Format code -make fmt - -# Run linter -make lint - -# Fix linting issues -make lint-fix - -# Run security scan -make security-scan - -# Check vulnerabilities -make vuln-check +make test # all tests +make test-coverage # with coverage +go test ./extensions/graphql/... ``` -### Development Server - ```bash -# Start development server -forge dev - -# Start with hot reload -forge dev --watch - -# Start on custom port -forge dev --port 3000 +make fmt # format +make lint # lint +make lint-fix # lint and fix +make security-scan # security scan +make vuln-check # check dependencies for known vulnerabilities +make ci # everything CI runs ``` ---- - -## πŸ“Š Project Status - -### Core Framework - -- **βœ… Dependency Injection** - Production ready -- **βœ… HTTP Router** - Fast, lightweight -- **βœ… Middleware System** - Comprehensive -- **βœ… Configuration** - Multi-format support -- **βœ… Observability** - Metrics, logging, tracing -- **βœ… Health Checks** - Automatic discovery -- **βœ… CLI Tools** - Full-featured CLI - -### Extensions (17 total) - -**Production Ready (14):** -- βœ… AI - LLM integration and agents -- βœ… Auth - Multi-provider authentication -- βœ… Cache - Multi-backend caching -- βœ… Consensus - Raft consensus -- βœ… Database - SQL and NoSQL -- βœ… Events - Event bus and sourcing -- βœ… GraphQL - GraphQL server -- βœ… gRPC - gRPC services -- βœ… HLS - HTTP Live Streaming -- βœ… Kafka - Apache Kafka -- βœ… MCP - Model Context Protocol -- βœ… MQTT - MQTT broker -- βœ… Storage - Multi-backend storage -- βœ… Streaming - WebSocket, SSE, WebRTC - -**In Progress (3):** -- πŸ”„ Queue - Message queue management -- πŸ”„ Search - Full-text search -- πŸ”„ orpc - ORPC transport protocol - ---- - -## πŸ§ͺ Examples - -The `examples/` directory contains production-ready examples: - -- **[Minimal App](examples/minimal-app/)** - Hello World -- **[Configuration](examples/config-example/)** - Config management -- **[Database](examples/database-demo/)** - Database integration -- **[Auth](extensions/auth/examples/auth_example/)** - Authentication -- **[GraphQL](extensions/graphql/examples/graphql-basic/)** - GraphQL server -- **[gRPC](examples/grpc-basic/)** - gRPC services -- **[WebRTC](examples/webrtc/)** - Real-time communication -- **[MCP](examples/mcp-basic/)** - Model Context Protocol -- **[AI Agents](examples/ai-agents-demo/)** - AI agent system - ---- - -## 🀝 Contributing - -We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines. - -### Development Workflow +The dev server takes `--watch` for hot reload and `--port` to override the +address: ```bash -# Fork and clone -git clone https://github.com/your-username/forge.git -cd forge - -# Install tools -make install-tools - -# Make changes -# ... - -# Run tests -make test - -# Check code quality -make ci - -# Commit with conventional commits -git commit -m "feat: add new feature" -``` - -### Conventional Commits - -```bash -feat: add new feature -fix: fix bug in router -docs: update documentation -style: format code -refactor: refactor DI container -perf: optimize routing performance -test: add tests for middleware -chore: update dependencies +forge dev --watch --port 3000 ``` -### Releasing - -Releases are managed by [Release Please](https://github.com/googleapis/release-please) and a unified GitHub Actions workflow. - -**Automated releases** β€” Push to `main` with conventional commits. Release Please opens a PR with version bumps and changelogs. Merging the PR creates a tag, which triggers the release pipeline. - -**Manual releases** β€” Go to [Actions > Release](../../actions/workflows/release.yml), click **Run workflow**, select the module and version, and optionally enable dry-run mode. - -The release workflow supports: -- **Main module + CLI**: Builds cross-platform binaries, Docker images, and publishes to Homebrew/Scoop/NFPM via GoReleaser. -- **Extension modules**: Creates a GitHub release and notifies the Go module proxy. -- **Dry run**: Validates the full pipeline without publishing. -- **Skip tests**: For hotfixes when tests have already passed on CI. - ---- - -## πŸ“„ License -This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details. - ---- - -## πŸ™ Acknowledgments - -Built with ❀️ by [Rex Raphael](https://github.com/juicycleff) - -**Special thanks to:** -- [Bun](https://github.com/uptrace/bun) - SQL ORM -- [Uptrace](https://github.com/uptrace/uptrace) - Observability platform -- [Chi](https://github.com/go-chi/chi) - Router inspiration -- All contributors and maintainers - ---- - -## πŸ”— Links - -- **[Documentation](https://forge.dev)** - Comprehensive docs -- **[GitHub](https://github.com/xraph/forge)** - Source code -- **[Issues](https://github.com/xraph/forge/issues)** - Bug reports -- **[Discussions](https://github.com/xraph/forge/discussions)** - Questions and ideas -- **[Examples](examples/)** - Code examples -- **[CLI Reference](cli/README.md)** - CLI documentation - ---- - -## πŸ“œ License - -Forge uses a **dual-licensing approach**: - -### Forge Core & Most Extensions: MIT License - -The core framework and most extensions are licensed under the **MIT License** - one of the most permissive open source licenses. - -βœ… **Use freely for:** -- Commercial products and services -- Personal projects -- Closed-source applications -- Modifications and distributions - -See the [LICENSE](LICENSE) file for full terms. - -### AI Extension: Commercial Source-Available License - -The AI Extension (`extensions/ai/`) uses a more restrictive **Commercial Source-Available License**. - -βœ… **Free for:** -- Personal projects -- Educational purposes -- Research and academic use -- Internal evaluation (90 days) - -❌ **Commercial license required for:** -- Production deployments -- Commercial products/services -- Revenue-generating applications +## Contributing -See [extensions/ai/LICENSE](extensions/ai/LICENSE) for full terms or [LICENSING.md](LICENSING.md) for the complete licensing guide. +Fork, branch, and open a pull request. Run `make install-tools` once, then +`make ci` before you push. -**Need a commercial license?** Contact: licensing@xraph.com +Commits follow [Conventional Commits](https://www.conventionalcommits.org/), +which the release tooling reads to decide the version bump. See +[CONTRIBUTING.md](CONTRIBUTING.md) for the rest. ---- +## Releases -## πŸ“ˆ Roadmap +Releases run through [Release Please](https://github.com/googleapis/release-please) +and a GitHub Actions workflow. -### v2.1 (Q1 2025) -- [ ] Complete remaining extensions (Queue, Search, orpc) -- [ ] Enhanced AI agent orchestration -- [ ] Real-time collaboration features -- [ ] Advanced monitoring dashboard +Push to `main` with conventional commits and Release Please opens a PR carrying +the version bumps and changelog. Merging that PR creates a tag, and the tag +triggers the release pipeline. For a release you need to cut by hand, go to +[Actions > Release](../../actions/workflows/release.yml) and run the workflow +against a chosen module and version. -### v2.2 (Q2 2025) -- [ ] Kubernetes operator -- [ ] Helm charts and deployment automation -- [ ] Advanced caching strategies -- [ ] Performance optimization pass +The pipeline builds cross-platform binaries and Docker images for the main +module and CLI and publishes them to Homebrew, Scoop and NFPM through +GoReleaser. Extension modules get a GitHub release and a notification to the Go +module proxy. Dry-run mode validates the whole pipeline without publishing, and +tests can be skipped for a hotfix that CI has already verified. -### v3.0 (Q3 2025) -- [ ] TypeScript/Node.js runtime -- [ ] Multi-language code generation -- [ ] Enhanced observability platform -- [ ] Enterprise features (SLA, auditing, compliance) +## License ---- +Apache License 2.0. See [LICENSE](LICENSE). -**Ready to build?** [Get Started β†’](docs/content/docs/getting-started/quick-start.mdx) +## Acknowledgments +Built by [Rex Raphael](https://github.com/juicycleff), with thanks to +[Bun](https://github.com/uptrace/bun) for the SQL ORM, +[Uptrace](https://github.com/uptrace/uptrace) for observability, and +[Chi](https://github.com/go-chi/chi), whose router shaped the design of this one. diff --git a/llm.txt b/llm.txt index 0b89beac..7fa29ca7 100644 --- a/llm.txt +++ b/llm.txt @@ -12,7 +12,7 @@ Forge is an enterprise-grade web framework for Go that provides a complete found - **Configuration**: Multi-format config management with auto-discovery and environment overrides - **Observability**: Built-in metrics, structured logging, and distributed tracing - **Health Checks**: Automatic health monitoring and status aggregation -- **Extensions**: Modular extension system for adding capabilities (Database, Cache, AI, etc.) +- **Extensions**: Modular extension system for adding capabilities (Database, Cache, Events, etc.) - **Middleware**: Comprehensive middleware stack (CORS, logging, rate limiting, recovery) ## Architecture @@ -33,7 +33,7 @@ Infrastructure Layer └── Lifecycle Manager Extension Layer -└── Pluggable extensions (DB, Cache, Events, AI, etc.) +└── Pluggable extensions (DB, Cache, Events, Storage, etc.) ``` ## Public API @@ -308,7 +308,6 @@ router.Use(forge.RequestID()) - No secrets in logs (automatic scrubbing) ### License -MIT License (core framework and most extensions) -Note: AI Extension uses a Commercial Source-Available License -See LICENSE and LICENSING.md for details +Apache License 2.0 +See LICENSE for details