Your First Guard
This guide walks you through creating a guard in the Liteguard web UI, configuring its default behavior and a simple rule, and then confirming that your application is using it correctly.
Before starting, make sure your SDK is installed and calling isOpen with the guard name you plan to use. If you have not done that yet, start with the SDK guide overview and choose the guide for your language or runtime.
Open the Guards tab
In the Liteguard app, tap or click Guards in the navigation bar. The Guards tab shows the catalog for the currently selected workspace, project, and environment.
If you see a message asking you to select a workspace or project, use the context selector to pick one. On mobile, tap the context bar near the top of the screen that shows your current workspace name and environment name. On desktop, click the context selector in the navigation sidebar. This opens the Switcher, where you can choose your workspace, environment, and project.
Create the guard
In the upper right of the guard catalog, click Add. A modal appears with the following fields:
- Name — the guard's usage key. This is the string your SDK passes to
isOpen. Guard names must start with an ASCII letter, may contain only ASCII letters, digits,.,-,_, and/, must be at least 3 characters long, and must not end with.or/. A convention such aspayments.checkout,feature.new_dashboard, orapi/v2/new-endpointworks well. - Description — optional free text for your own reference.
- Tags — optional labels you can add to group or search guards later. Type a tag and press Enter or comma to add it.
- Lifecycle — set to Active for a guard you are actively using. An Archived guard still evaluates but its configuration is treated as inactive.
Enter the name that matches what you are passing to isOpen in your code. Click Save to create the guard.
After saving, Liteguard opens the guard detail page for the new guard.
Adopting an existing unadopted guard
If your SDK has already called isOpen with a guard name that Liteguard has not seen a configuration for, the guard catalog shows it in a separate section with an Adopt button beside it. Click Adopt to open the same modal pre-filled with the name from your code. This is a convenient way to start configuring guards that your application has already begun reporting.
Set the default behavior
On the guard detail page, the environment configuration section shows the settings for the currently selected environment. The first setting is Default value, a toggle that controls what isOpen returns when no rule matches.
- Default value off (false) means the guard is closed unless a rule explicitly opens it. This is the right starting point for a feature you are not ready to release broadly.
- Default value on (true) means the guard is open for everyone unless a rule closes it. This is useful for a guard you plan to disable only for specific cases.
For a new feature, set the default value to off for now. You can change this later as the rollout progresses.
Add a rule (optional)
Rules let you evaluate the guard differently based on properties you pass with each isOpen call. Rules are evaluated in order and the first match wins.
To add a rule:
- In the Rules section of the guard detail page, click the add button.
- Set the Property name to the key you pass in your
propertiesargument, such asuserIdorplan. - Choose an Operator:
equals,not equals,in,not in,regex,>,>=,<, or<=. - Enter one or more values to match against.
- Set the Result toggle to the value you want
isOpento return when this rule matches. - Make sure the rule is Enabled.
For example, to open the guard for a specific user ID during internal testing, add a rule with property name userId, operator equals, value usr_abc123, and result true.
To reorder rules, use the up and down arrows beside each rule row. Rules are evaluated from top to bottom.
Save the configuration
After setting the default value and any rules, click Save to apply the configuration. The button label changes from Save to Saved after a successful save.
The saved configuration applies to the currently selected environment only. To configure a different environment, use the context selector to switch to that environment, then adjust the settings and save again.
Exercise the guard from your application
Run your application and call the code path that contains the isOpen check for this guard. If you left the default value as off and did not add a rule matching your current properties, isOpen returns false. If you added a rule that matches, it returns true.
Confirm the result in Liteguard
Return to the Guards tab. The guard should appear in the catalog, and clicking it should show:
- Evaluated count and Last evaluated time, which update as your application calls
isOpen. - The environment configuration you saved, confirming the guard detail page reflects your settings.
If you want to inspect exactly what bundle your application is receiving, go to Config, open your workspace, open the project, and scroll to the Bundle Preview section. The bundle preview shows the assembled configuration Liteguard serves to the SDK, including your guard's default value, rules, and any rate limits, for the selected environment.
Next steps
- Concepts: guards — understand the full guard model including lifecycle and measurement
- Guarding patterns: new feature — a real-world rollout scenario
- Guarding patterns: release a feature — move from guarded rollout to broadly enabled