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:
| What | URL |
|---|---|
| Dashboard | https://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 upOr using Docker Compose directly:
docker-compose -f ops/docker-compose.yml up -dThis 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
- Open the Dashboard at
http://localhost:5173. - Login with the default Keycloak credentials (
admin/admin). - Navigate to Projects and select the “Default Project”.
- Click Create Flag.
- Enter:
- Name:
New Checkout Flow - Key:
new-checkout - Type:
Boolean(or choose String, Number, JSON)
- Name:
- 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/sdkon npm ships compileddist/entry points (main/exports). Useimport { GoGreenClient } from '@gogreenflags/sdk'as below. If you are on an older published version without correctexports, 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:
- Click on your
new-checkoutflag. - Click Add Rule.
- Set:
If plan equals "enterprise" → serve True. - Click Save.
Now only users with plan: "enterprise" in their evaluation context will see the new checkout flow.
Step 5: Run an Experiment (Optional)
- Navigate to Experiments in the dashboard.
- Click Create Experiment and link it to the
new-checkoutflag. - Define a metric (e.g.,
checkout_completed). - Start the experiment.
- Track events from your SDK using
client.Track(). - 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.