Skip to Content
Quickstart

Quickstart

Get up and running with GoGreen Flags in minutes using Docker, or point your SDK at the hosted environment.

Hosted production (gogreenflags.com)

If you use GoGreen Flags Cloud instead of a local stack, use a single base URL for the SDK:

WhatURL
Dashboardhttps://app.gogreenflags.com
SDK API (config, evaluate, stream, events)https://app.gogreenflags.com

Set apiBaseUrl / APIBaseURL (and streamUrl / StreamURL if you use streaming) to https://app.gogreenflags.com. The ingress routes /config, /evaluate, /stream, and /events to the right services behind that host.

Browser / SPA: The hosted APIs return CORS headers so the SDK can call https://app.gogreenflags.com directly from the browser (including Access-Control-Allow-Headers for Authorization and X-SDK-Key). You should not need a same-origin proxy for evaluation or config.

Use the SDK key and environment ID from Environment settings in the dashboard. The rest of this page shows local Docker URLs for self-hosted development.

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: @gogreenflags/sdk on npm ships compiled dist/ entry points (main / exports). Use import { GoGreenClient } from '@gogreenflags/sdk' as below. If you are on an older published version without correct exports, see the TypeScript SDK page or upgrade the package.

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.