An architecture for dynamic UI without client deployment

Overview

Server Driven UI Demo

  • Server Driven UI(SDUI)는 서버에서 클라이언트의 UI 컴포넌트를 관리하는 방식.
  • 클라이언트 배포없이 API 응답을 변경하는 것만으로 UI 변경이 가능한 동시에 하위 호환성을 확보할 수 있다.
  • Rust, GraphQL, Flutter로 간단히 동작하는 SDUI 데모를 구현한다:
    • Flutter의 체계적인 위젯 시스템이 UI 컴포넌트 개념에 부합한다.
    • flutter/material 라이브러리가 material design system을 높은 수준으로 구현하고 있어 스키마 디자인이 수월하다.
    • GraphQL은 재사용 가능한 fragment를 지원하기 때문에 컴포넌트 인터페이스를 주고받기 적합하다.

Description

  • 스크린(화면을 구성하는 가장 큰 단위) 안에 다양한 컴포넌트가 배치된다.
  • screenType 인자로 화면 유형을 선택하면 서버가 해당 화면에 맞는 컴포넌트를 응답한다.
  • 각 컴포넌트는 Component 인터페이스를 구현하며, screen.components 필드는 [Component!]!를 반환한다.
  • 클라이언트는 사용 가능한 모든 컴포넌트를 요청하며, 응답받은 컴포넌트의 __typename과 위젯을 매핑한다.

Component fragments

fragment AppBar on AppBar {
  __typename
  title
}

fragment TextField on TextField {
  __typename
  labelText
  placeholder
  enabled
}
      
fragment TextButton on TextButton {
  __typename
  text
  route
}

fragment Container on Container {
  __typename
  padding
  color {
    value
    alpha
  }
  child {
    ... AppBar
    ... TextField
    ... TextButton
  }
}

fragment GridView on GridView {
  __typename
  columnCount
  children {
    ... AppBar
    ... TextField
    ... TextButton
    ... Container
  }
}

Request

query getScreen {
  screen(screenType: HOME) {
    components {
      ... AppBar
      ... TextField
      ... TextButton
      ... Container
      ... GridView
    }
  }
}

Response

{
  "data": {
    "screen": {
      "components": [
        {
          "__typename": "AppBar",
          "title": "Home"
        },
        {
          "__typename": "GridView",
          "columnCount": 2,
          "children": [
            {
              "__typename": "Container",
              "padding": 0,
              "color": {
                "value": 8440772,
                "alpha": 255
              },
              "child": {
                "__typename": "TextButton",
                "text": "Sign in",
                "route": "/sign_in"
              }
            },
            {
              "__typename": "Container",
              "padding": 0,
              "color": {
                "value": 8440772,
                "alpha": 255
              },
              "child": {
                "__typename": "TextButton",
                "text": "Sign up",
                "route": null
              }
            }
          ]
        }
      ]
    }
  }
}

Future work

  • 클라이언트 타이핑 고도화
  • 컴포넌트 스타일 고도화
  • 중첩 컴포넌트
  • 컴포넌트 페이지네이션
  • 특정 컴포넌트 리로딩

References

License

This project is distributed under the MIT License - see the LICENSE file for details.

You might also like...

A time tracking app that respects your privacy and the gets the job done without being fancy.

Time Cop A time tracking app that respects your privacy and gets the job done without getting too fancy. Motivation I'd rather not do time-tracking at

Dec 30, 2022

Whats-link - App to open conversation without having to save the number in WhatsApp

Whats-link - App to open conversation without having to save the number in WhatsApp

Whats Link App feito para abrir conversa do WhtasApp sem salvar o número do dest

Feb 14, 2022

Pokedex app built with Flutter (with lots of animations) using Clean Architecture

Pokedex app built with Flutter (with lots of animations) using Clean Architecture

Flutter Pokedex Pokedex app built with Flutter App preview Video demo Installation Add Flutter to your machine Open this project folder with Terminal/

Jan 8, 2023

App dos Carros com Flutter e Clean Architecture

App dos Carros com Flutter e Clean Architecture

Carros Flutter - App Exemplo com Clean Architecture Possui apenas 3 telas para facilitar o entendimento. Arquitetura Baseado na proposta do Reso Coder

Jun 8, 2022

A Flutter application that recommends activities to do in free time. Made with Clean + Layered Architecture

A Flutter application that recommends activities to do in free time. Made with Clean  + Layered Architecture

im_bored_app Bored? is a Flutter application that suggests different activities to do in your free time. Available platforms: iOS, Android, iPadOS App

Oct 15, 2022

E-Commerce App built on Flutter with Firebase, SQLite, GetX and MVVM Architecture.

E-Commerce App built on Flutter with Firebase, SQLite, GetX and MVVM Architecture.

Shopzler A new open source E-commerce App created using Flutter and GetX. ScreenShots Features : Sign-In, Sign-Up and LogOut using Email & Password /

Jan 6, 2023

This is not an app. I made this architecture to build robust and easy-to-maintain products but in a faster way.

simple_architecture_flutter This is not an app. I made this architecture to build robust and easy-to-maintain products but in a faster way. Info I use

Oct 28, 2022

Self Host Group Chat App (firebase + clean architecture) is full functional group chat where you can create new groups and update profile and communicate in different groups easily. there 2 auth firebase method [Google & Email Password]

Self Host Group Chat App (firebase + clean architecture) is full functional group chat where you can create new groups and update profile and communicate in different groups easily. there 2 auth firebase method [Google & Email Password]

Self Host Group Chat App (firebase + clean architecture) Show some and star the repo to support the project Screenshots Packages we are using: flutter

Jan 8, 2023

MSWS Flutter architecture starter

MSWS Flutter architecture starter

msws_starter Module Service Widget Screen Flutter architecture project starter. For examples visit Example project Main abstractions Main 5 types of a

Jul 7, 2021
Owner
Simon Park
I'm not a robot
Simon Park
Cross-platform GitHub client in Flutter and BLoC clean architecture

FlutterHub Cross-platform GitHub client in Flutter and BLoC clean architecture. SwiftHub - Swift version is available Try Web version Get Started To g

Khoren Markosyan 36 Nov 12, 2022
An android app built using flutter that displays and forecast the specific city Weather and Climate for dynamic time event by collecting the data from API that is provided for free by OPENWEATHER site.

clima_weather_reporter A new Flutter application. Getting Started This project is a starting point for a Flutter application. A few resources to get y

dev_allauddin 3 Feb 3, 2022
Flutter 2.0 (Null safety) Basic, Dynamic & Silver style Staggered Grid views made using flutter staggered grid view package. 🦺

Staggered Grid View Developement Stack Getting Started This project is a starting point for a Flutter application. A few resources to get you started

Nakshatra Singh 9 Oct 28, 2022
Dynamic Text Highlighting (DTH) package for Dart & Flutter.

Dynamic Text Highlighting (DTH) This package is used to highlight, in a completely dynamic way, keywords, or phrases, wherever they are present in a s

null 34 Oct 3, 2022
Platform to post/say something without sharing personal information.

Anon is an Open Source Application where it's users will be able to share their thoughts without their identity being revealed i.e Anonymous. When the

Ismael Shakverdiev 18 Sep 13, 2022
A Dart/Flutter package to register/query/remove URI Schemes without hassle.

protocol_registry Register/query/remove URI Schemes without hassle. Available for Windows and Linux. Installation flutter pub add protocol_registry Us

ZYROUGE 10 Oct 25, 2022
Send WhatsApp Messages without saving contact

WHATSAPP DIRECT Send WhatsApp Messages without saving contact Installation PlayStore Link: https://play.google.com/store/apps/details?id=com.snapsid.w

Siddharth Chopra 1 Oct 2, 2022
Flutter Radio Player, A Plugin to handle streaming audio without a hassle

Flutter radio plugin handles a single streaming media preciously. This plugin was developed with maximum usage in mind. Flutter Radio player enables S

Sithira Munasinghe 104 Dec 27, 2022
Code generation for immutable classes that has a simple syntax/API without compromising on the features.

Welcome to Freezed, yet another code generator for unions/pattern-matching/copy. 0.14.0 and null-safety Important note: From 0.14.0 and onwards, Freez

Remi Rousselet 1.4k Jan 4, 2023
Dynamically changing your theme without hassle

dynamic_theme Dynamically changing your theme without hassle This packages manages changing your theme during runtime and persiting that theme. I wrot

Norbert Kozsir 329 Dec 29, 2022