Coder Social home page Coder Social logo

switchfeat-com / switchfeat Goto Github PK

View Code? Open in Web Editor NEW
197.0 3.0 16.0 2.05 MB

SwitchFeat is an open source and self-hosted feature flags and A/B testing framework written in Nodejs, Typescript and React.

Home Page: https://switchfeat.com

License: GNU Affero General Public License v3.0

JavaScript 0.85% TypeScript 98.11% HTML 0.83% CSS 0.03% Dockerfile 0.18%
ab-testing feature-flags self-hosted abtesting feature-toggle remote-config continuous-delivery nodejs react reactjs

switchfeat's Introduction

SwitchFeat

Open source feature flags and A/B testing service

Minimize deployment risks and speed-up your features development.

PR welcome on @apitrakr/cli


What is SwitchFeat

SwitchFeat is an open-source, self-hosted platform that makes it very easy to manage your feature flags and run A/B tests straight from your infrastructure. No external servers involved, no latency in sending flags data over the internet. Your data stays within your network.

Just wrap your logic around a feature flag and use SwitchFeat API to toggle that code on or off, based on multiple conditions and user segments.

Getting started

The easiest way to start using SwitchFeat is using the Docker image.

You can either clone the repo and generate the image yourself using our docker-compose.yml file, like this:

git clone https://github.com/switchfeat-com/switchfeat.git
cd switchfeat
docker-compose up -d

Or you can just download the premade image from the official Github Registry like this:

docker run --name switchfeat-com -d -p 4000:4000 ghcr.io/switchfeat-com/switchfeat:main

Once the download is complete, an additional step is needed to set the environment variables within the Docker image itself. The image already contains a .env.example file which contains all env variables names. Please fill the values for the variables in the required section, rename the file to .env and restart the container.

Once done, SwitchFeat will be available at http://localhost:4000

Building the project

The SwitchFeat project has been configured using Lerna framework which allows to manage multiple projects in the same repo (monorepo).

To build the project use the following command in the root folder of the project:

npm run build

To start both the server and the ui, simply run:

npm run start

SwitchFeat will be available at http://localhost:4000

Running frontend and backend separately

For convenience during the development phase, the package.json file esposes two additional scripts which allow to run the server and the UI on separate ports. This simplifies working on the frontend, where the UI can be updated without running a full build on both projects on every change.

The following command will run the UI process on http://localhost:3000

npm run dev:start-ui

The following command will run the Server process on http://localhost:4000

npm run dev:start-api

Contributions

Either it be a bug fix, an update to our documentation, a feature request, contributions are extremely welcome!

Look at the public roadmap to see what's coming and where you can help.

switchfeat's People

Contributors

andyandy82 avatar antoniocollazo avatar arsangamal avatar dependabot[bot] avatar dev-bre avatar lazyfuhrer avatar zeeshnhmd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

switchfeat's Issues

feat: create actions audit

Every action on a flag/segment/rule should be audited specifying:

  • action type: create/update/delete
  • entity involved: flag.segment/rule/etc..
  • username
  • timestamp

Define conditions entity

Flags can define their status based on specific conditions. This task is about defining the criteria and the logic operations that the user might use to control flags.

bug(docker): the docker image missing .env file

On solution to that is to create a .env.example file which would just enlist the evironment variables needed, which the user will have to fill in.

The user will have to manually do that once the docker image has been downloaded and installed.

feat(api): apikey based access

The curernt SDK API doesn't offer any kind of authetication at the moment. This task is about adding an APIKey parameter that need to be added to header of any SDK API request.

feat: create rules

A rule defines the connection between flags and segments

The user can assign zero or more rules to a flag.

The API will traverse each rule assigned to a flag to decide if that flag should return true or false response.

feat(ui): add notifications

As a developer I would like to use a generic notification system which can be used in multiple places in the UI.

Every time the user execute an action, like create a flag, delete, update etc a notification should show up to either confirm success or show an error.

All pages should share the same approach to showing notifications. Might be good to have a notification provider or something.

feat(data): add mongodb datasource

Even thought the codebase already contains a MongoDBManager, it needs to be tidied up and tested.

A proper configuration forMongoDB, including any Docker configuration to install MongoDB locally needs to be added.

feat(ui): add product tour

To help users to learn how to use SwitchFeat, a product tour should be implemented using Driver.js library.

feat(api): add support for datetime conditions match

A datetime condition should include the following checks:

"before" | "after" | "beforeOrAt" | "afterOrAt" | "equals" | "notEquals"

between a the given context (datetime) and the condition value.

The SdkService should be updated with a new condtion matcher to evaluate this condition.

feat: add segments/conditions feature

A segment is made of one or more conditions.

A condition is made of the following properties:

  • context (e.i. name, email, country)
  • type of condition (i.e. string, number, boolean, datetime)
  • operator (dependent on the type).
  • value

Types: Specification from OpenFeature

boolean: true, false
string: startsWith, endsWith, equals, notEquals
number: eq, neq, gt, lt, get, let
datetime: before, after, at, not at, before or at, after or at

An example of a condition would be:

-> email - context
-> string - type
-> endsWith - op
-> @gmail.com - value

feat(sdk): build nodejs sdk

Being an official SDK for Nodejs , it makes sense to have it inside the main repo itself.

The SDK should be placed inside the folder: packages/sdk/nodejs

It should be a 100% Typescript SDK.

feat(ui): create reusable fetch client

The current http calls that the React app sends to the server are pretty much a copy and paste. Would be nice to have a centralized http client which all components would use to send reaquests to the backend.

feat(api): add support for numeric conditions match

A numberic condition should include the following checks:

"gt" | "lt" | "gte" | "lte" | "equals" | "notEquals"

between a the given context (number) and the condition value.

The SdkService should be updated with a new condtion matcher to evaluate this condition.

feat(api): create sdk routes for get requests

The SDK is going to use a dedicated set of routes mainly around reading the state of a flag.
The SDK can only read data and not change the datastore.

Possible endpoints:

  • evaluate-flag (this is half done already)
  • get-flags
  • get-segments
  • get-conditions-by-segment
  • get-rules-by-flag

feat(ui): design dashboard

The first iteration of the dashboard page should fairly simple but eye catching.
I would think having cards showing some stats against how many flags / segments / rules have been created. how many flags are enabled.

Once we have the basic stuff, we might expand with some more in depth analytics, charts, etc.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.