Skip to Content
DocsQuickstart

Quickstart

Get up and running with GoGreen Flags in minutes using Docker.

Prerequisites

  • Docker and Docker Compose installed.
  • Go 1.21+ (for the Go SDK) or Node.js 20+ (for the TypeScript SDK).

Step 1: Start the Platform

Run the following command to start the entire GoGreen Flags stack:

make up

Or using Docker Compose directly:

docker-compose -f ops/docker-compose.yml up -d

This starts all services including:

  • Dashboard: http://localhost:5173
  • Management API Gateway: http://localhost:8085
  • Evaluation API: http://localhost:8092
  • Streaming Service: http://localhost:8100
  • PostgreSQL, Redis, Redpanda, Keycloak, and all microservices.

Step 2: Create a Feature Flag

  1. Open the Dashboard at http://localhost:5173.
  2. Login with the default Keycloak credentials (admin / admin).
  3. Navigate to Projects and select the “Default Project”.
  4. Click Create Flag.
  5. Enter:
    • Name: New Checkout Flow
    • Key: new-checkout
    • Type: Boolean (or choose String, Number, JSON)
  6. Click Create.

Step 3: Implement in Code

Use the GoGreen Flags SDK to check the flag status in your application.

Go Example

package main import ( "fmt" gogreen "github.com/MarkDurbin104/GoGreen/sdk/go" shared "github.com/MarkDurbin104/GoGreen/lib/shared-data" ) func main() { client, err := gogreen.NewClient(gogreen.Config{ SDKKey: "YOUR_SDK_KEY", // Found in Environment Settings EnvID: "YOUR_ENV_ID", // Found in Environment Settings APIBaseURL: "http://localhost:8092", StreamURL: "http://localhost:8100", EnableStreaming: true, }) if err != nil { panic(err) } defer client.Close() user := shared.EvaluationContext{ Key: "user-123", Custom: map[string]interface{}{"plan": "enterprise"}, } // Boolean evaluation if client.BoolVariation("new-checkout", user, false) { fmt.Println("New checkout enabled!") } // Detailed evaluation with reason val, detail := client.BoolVariationDetail("new-checkout", user, false) fmt.Printf("Value: %v, Reason: %s\n", val, detail.Reason) // Number variation rateLimit := client.NumberVariation("rate-limit", user, 100) fmt.Printf("Rate limit: %v\n", rateLimit) // Track events for experimentation client.Track("checkout_completed", user, map[string]any{"revenue": 49.99}) }

TypeScript Example

Note: The @gogreenflags/sdk package is CommonJS. The import syntax below works in TypeScript (compiled to require). For pure ESM projects, use const { GoGreenClient } = require('@gogreenflags/sdk') via createRequire. See the SDK Reference for details.

import { GoGreenClient } from '@gogreenflags/sdk'; const client = new GoGreenClient({ sdkKey: 'YOUR_SDK_KEY', // Found in Environment Settings environmentId: 'YOUR_ENV_ID', // Found in Environment Settings apiBaseUrl: 'http://localhost:8092', streamUrl: 'http://localhost:8100', enableStreaming: true, defaultContext: { key: 'user-123', custom: { plan: 'enterprise' } }, }); // Boolean evaluation const isEnabled = client.boolVariation('new-checkout', false); if (isEnabled) { console.log('New checkout enabled!'); } // Detailed evaluation const detail = client.boolVariationDetail('new-checkout', false); console.log(`Value: ${detail.value}, Reason: ${detail.reason}`); // Number variation const rateLimit = client.numberVariation('rate-limit', 100); // String variation const theme = client.stringVariation('ui-theme', 'light'); // JSON variation const config = client.jsonVariation('feature-config', {}); // Track events for experimentation client.track('checkout_completed', { revenue: 49.99 });

Step 4: Add Targeting Rules

Back in the dashboard:

  1. Click on your new-checkout flag.
  2. Click Add Rule.
  3. Set: If plan equals "enterprise" → serve True.
  4. Click Save.

Now only users with plan: "enterprise" in their evaluation context will see the new checkout flow.

Step 5: Run an Experiment (Optional)

  1. Navigate to Experiments in the dashboard.
  2. Click Create Experiment and link it to the new-checkout flag.
  3. Define a metric (e.g., checkout_completed).
  4. Start the experiment.
  5. Track events from your SDK using client.Track().
  6. View results with statistical significance in the dashboard.

Next Steps

  • Read Concepts to understand targeting rules, segments, and rollouts in depth.
  • Explore the Architecture for the full service topology.
  • Browse the SDK Reference for complete API documentation.
  • Check the API Reference for the OpenAPI specification.