Giter Site home page Giter Site logo

feature-flag-backend's Introduction

Feature Flag Backend

The Feature Flag Backend service helps manage feature flags for your applications in Real Dev Squad. With feature flags, we can easily enable or disable specific features for different groups of users. It provides APIs for creating, updating, and retrieving feature flags and user mappings. The backend is built using Golang and is deployed using a serverless architecture on AWS Lambda. It uses DynamoDB as the database. Whenever we want to roll out new features gradually or experiment with different options, the Feature Flag Backend simplifies the process and gives us full control over our features.

Table of Contents

Installation

You should have some things pre-installed :

  1. Clone the repository

    • Open the terminal or command prompt: Depending on your operating system, open the terminal or command prompt to begin the cloning process.
    • Navigate to your desired local directory: Use the cd command to navigate to the directory where you want to store the cloned repository.
    • Clone the repository: Use the following command to clone the repository :
      git clone https://github.com/Real-Dev-Squad/feature-flag-backend.git
      
  2. AWS CLI

    Note This step will not be required once the support for local DynamoDB setup is added. To know more read this

  3. AWS SAM CLI

  4. Add tables in DynamoDB

    • Follow steps 1 to 5 (ignore the last step to add backup) mentioned in Create a table development guide under AWS Management Console section
    • For table names and thier respective keys information refer to the Data Model section

Run

  1. Navigate to the directory where template.yaml is present
  2. Run this command to build the backend
sam build
  1. Run this command to start the backend in development mode
sam local start-api

By default port 3000 is used, if you need to change add the --port {port_number} options at the end of the above command. If you have multiple AWS profiles use the --profile {profile_name} option at the end of the above command. For more options refer here

Usage

The Feature Flag Backend is used to manage feature flags for enabling or disabling features for a set of users. It provides API endpoints for creating, updating, and retrieving feature flags and user mappings.

Features

The Feature Flag Backend project is built using the following technologies and programming languages:

  • Programming Language: Golang
  • Database: DynamoDB
  • Deployment: Serverless (AWS Lambda)
  • Deployment Automation: GitHub Actions

API Endpoints

The API endpoints available in the Feature Flag Backend project are as follows:

  • GET /feature-flags to get all the feature flags
  • POST /feature-flags to create a feature flag
  • GET /feature-flags/{flagId} to get the feature flag with an ID
  • PATCH /feature-flags/{flagId} to update a feature flag
  • GET /users/{userId}/feature-flags/{flagId} to get a feature flag details for a user
  • GET /users/{userId}/feature-flags/ to get all feature flag details for a user
  • POST /users/{userId}/feature-flags/{flagId} to create a feature flag for a user
  • PATCH /users/{userId}/feature-flags/{flagId} to update a feature flag for a user

For more detailed information about the API contracts, please refer to the API contract.

Data Model

The Feature Flag Backend project uses DynamoDB as the database. The data model consists of two main entities:

FeatureFlag

  • Id (string) Partition key
  • name (string) (GSI)
  • description (string)
  • createdAt (number)
  • createdBy (string)
  • updatedAt (number)
  • updatedBy (string)
  • status (string)

FeatureFlagUserMapping

  • userId (string) Global Secondary Index
  • flagId (string) Partition key
  • status (string)
  • createdAt (number)
  • createdBy (string)
  • updatedAt (number)
  • updatedBy (string)

For a visual representation of the data model, refer to the ER diagram.

Contributing

Wish to contribute? You can find a detailed guide here

feature-flag-backend's People

Contributors

shubham-y avatar vikhyat187 avatar prakashchoudhary07 avatar

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.