Skip to content

Latest commit

 

History

History
112 lines (78 loc) · 2.96 KB

File metadata and controls

112 lines (78 loc) · 2.96 KB

Getting Started Tutorial

Welcome! This guide will take you through the end-to-end process of using Solid Fortnight, from setting up the platform to evaluating feature flags and tracking real-time events.

1. Launch the Platform

The easiest way to get started is by using the provided Docker Compose setup.

make start-all

The system will be accessible through the API Gateway on port 8080.

2. Admin Dashboard

Once the platform is running, you can access the Admin Dashboard at http://localhost:5173.

  1. Create a Project: Click "New Project" and give it a name like "Tutorial Project".
  2. Create an Environment: Inside your project, click "Add Environment". Call it Production with key prod.
  3. Create a Feature Flag: Click "New Flag". Use key show-beta-feature and type boolean.

3. Configure Targeting

Click on your new flag to open the detail view.

  1. Add a Variation: Ensure you have variations for true and false.
  2. Set Default: Set the default variation to false.
  3. Add a Rule:
    • Attribute: user_group
    • Operator: EQUALS
    • Values: beta-testers
    • Return: true
  4. Save: Click "Save Configuration".

4. Evaluate the Flag

You can now test your flag using the Evaluator API (via the Gateway).

Test for a normal user

Request: POST http://localhost:8080/api/v1/evaluate

{
  "project_id": "{{project_id}}",
  "environment_key": "prod",
  "flag_key": "show-beta-feature",
  "context": {
    "user_id": "user-1",
    "attributes": { "user_group": "standard" }
  }
}

Response: {"value": false, "reason": "default variation"}

Test for a beta tester

Request: Same endpoint

{
  "project_id": "{{project_id}}",
  "environment_key": "prod",
  "flag_key": "show-beta-feature",
  "context": {
    "user_id": "user-2",
    "attributes": { "user_group": "beta-testers" }
  }
}

Response: {"value": true, "reason": "rule match: ..."}

5. Integrate with SDKs

The easiest way to use Solid Fortnight in your application is via the "Single-Key" initialization pattern. You only need the API Gateway URL and an SDK Key.

JavaScript / TypeScript

import { Client } from '@solid-fortnight/client-js';

const client = new Client({
  baseUrl: 'http://localhost:8080',
  apiKey:  'your-sdk-key'
});

await client.init();

const isEnabled = client.boolVariation('show-beta-feature', { id: 'user-123' }, false);

Go

import "github.com/adafia/solid-fortnight/sdk/server-go"

client, _ := sdk.NewClient(sdk.Config{
    BaseURL: "http://localhost:8080",
    APIKey:  "your-sdk-key",
})

isEnabled := client.BoolVariation("show-beta-feature", engine.UserContext{ID: "user-123"}, false)

6. Next Steps

  • Concepts: Read the Core Concepts guide.
  • SDKs: Integrate with your application using our SDKs.
  • Architecture: Learn how the services work together in the Architecture docs.