• Stars
    star
    643
  • Rank 70,000 (Top 2 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created almost 4 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Node.js server for the Agora Flat open source classroom.

Agora Flat Server

Project flat-server is a Node.js server for the Agora Flat open source classroom.

ไธญๆ–‡

Features

  • Login via
  • Wechat
  • Github
  • Google
  • Room scheduling
    • Ordinary rooms
    • Periodic rooms
  • Signing tokens for Whiteboard, Real-time video/audio chat(RTC), Real-time messaging(RTM)
  • Cloud recording and replaying
  • Cloud Storage for multi-media courseware

Develop Locally

Execute the following steps to run flat-server:

Installation

yarn install --frozen-lockfile

Setup Environment

  1. Create files config/development.local.yaml.
  2. Add environment variables following the config/defaults.yaml format.

Run the Project

  1. Execute at project root:
   yarn run start
  1. Open another terminal and execute at project root:
   node ./dist/index.js

You should see ready on http://0.0.0.0:80 if everything is OK.

Deployment

Deployment is not needed for local development. If you want to bring the server up online, deploy anyway you like.

Warning If you have deployed this project before, please see the migration documentation

Environment Variables Reference

server:
    # Server port
    port: 80

redis:
    # Redis host
    host:
    # Redis port
    port:
    # Redis username
    username:
    # Redis password
    password:
    # Redis db name
    db:
    # Redis-based implementation of the deferred queue db name
    queueDB:

mysql:
    # MySQL host
    host:
    # MySQL port
    port:
    # MySQL username
    username:
    # MySQL password
    password:
    # MySQL database
    db:

jwt:
    # JWT secret
    secret:
    # JWT crypto algorithms, see: https://github.com/auth0/node-jsonwebtoken/tree/d71e383862fc735991fd2e759181480f066bf138#algorithms-supported
    algorithms:

# Front-end address
website: https://flat-web-dev.whiteboard.agora.io

log:
    # Log path name, see: https://github.com/netless-io/flat-server/blob/main/src/utils/EnvVariable.ts
    pathname: "{{PROJECT_DIR}}/logs"
    # Log file name, see: https://github.com/netless-io/flat-server/blob/main/src/utils/EnvVariable.ts
    filename: "{{DAY_DATE}}"

cloud_storage:
    # Maximum count of Cloud Storage uploading files. Default: 3
    concurrent: 3
    # Maximum size of a Cloud Storage file. Default: 500M
    single_file_size: 524288000
    # Maximum Cloud Storage size of a user. Default: 2G
    total_size: 2147483648
    # Cloud Storage upload path prefix. Default: cloud-storage (No / prefix or suffix)
    prefix_path: cloud-storage
    # Cloud Storage supported file extensions
    allow_file_suffix:
        - ppt
        - pptx
        - doc
        - docx
        - pdf
        - png
        - jpg
        - jpeg
        - gif
        - mp3
        - mp4

user:
    avatar:
        # Maximum size. Default: 5M
        size: 5242880
        # User supported upload image file extensions
        allow_suffix:
            - png
            - jpg
            - jpeg

oauth:
    logo:
        # Upload logo path prefix. Default: oauth-logo (No / prefix or suffix)
        prefix_path: oauth-logo
        # Maximum size. Default: 5M
        size: 5242880
        # Logo supported upload image file extensions
        allow_suffix:
            - png
            - jpg
            - jpeg

login:
    wechat:
        # See: https://developers.weixin.qq.com/doc/oplatform/Website_App/WeChat_Login/Wechat_Login.html
        web:
            # Whether to enable WeChat login on the web/desktop side
            enable: false
            # App ID
            app_id:
            # App Secret
            app_secret:
        # See: https://developers.weixin.qq.com/doc/oplatform/Mobile_App/WeChat_Login/Development_Guide.html
        mobile:
            # Whether to enable WeChat login on the mobile side
            enable: false
            # App ID
            app_id:
            # App Secret
            app_secret:
    # See: https://docs.github.com/cn/developers/apps/building-oauth-apps/authorizing-oauth-apps
    github:
        # Whether to enable GitHub login
        enable: false
        # GitHub Client ID
        client_id:
        # GitHub Client Secret
        client_secret:
    # In development, see: https://developers.google.com/identity/protocols/oauth2
    google:
        # Whether to enable Google login
        enable: false
        # Google Client ID
        client_id:
        # Google Client Secret
        client_secret:
        # Redirect URI
        redirect_uri:
    apple:
        # Whether to enable Apple login
        enable: false
    # Not open to the public at the moment
    agora:
        # Whether to enable Agora login
        enable: false
        # Agora Client ID
        client_id:
        # Agora Client Secret
        client_secret:
    # Phone message login
    sms:
        # Whether to enable SMS login
        enable: true
        # Is force binding phone
        force: false
        # Test user (Only valid if server.env is dev)
        # You need to run MYSQL yourself to insert the user
        # INSERT INTO user_phone (version, user_uuid, user_name, phone_number) VALUES (1, 'uuid', 'name', 'phone');
        # INSERT INTO users (version, user_uuid, user_name, user_password, avatar_url) VALUES (1, 'uuid', 'name', '', 'url');
        test_users:
            -   phone:
                code:
        chinese_mainland:
            # see:  https://help.aliyun.com/document_detail/419273.htm?spm=a2c4g.11186623.0.0.34371d58IYPbs3
            access_id:
            access_secret:
            template_code:
            sign_name:
        # Hong Kong, Macao and Taiwan regions of China
        hmt:
            access_id:
            access_secret:
            template_code:
            sign_name:
        global:
            access_id:
            access_secret:
            template_code:
            sign_name:

agora:
    # For RTC and RTM. See: https://docs.agora.io/en/Agora%20Platform/get_appid_token?platform=All%20Platforms
    app:
        # Agora App ID
        id:
        # Agora App Certificate
        certificate:
    # For classroom replaying. See: https://docs.agora.io/en/cloud-recording/faq/restful_authentication?platform=All%20Platforms
    restful:
        # Agora RESTful ID
        id:
        # Agora RESTful Secret
        secret:
    # For storing RTC Cloud Recording media files. See: https://docs.agora.io/en/cloud-recording/restfulapi/
    # Path: Cloud Recording Start -> Schema -> clientRequest -> storageConfig
    oss:
        access_id:
        access_secret:
        vendor:
        region:
        bucket:
        folder:
        prefix:
    # Video screenshot service
    # See: https://docs.agora.io/en/cloud-recording/cloud_recording_screen_capture?platform=RESTful
    screenshot:
        enable: false
        oss:
            access_id:
            access_secret:
            vendor:
            region:
            bucket:
            folder:
            prefix:
    # Message notification service
    # See: https://docs-preprod.agora.io/en/Agora%20Platform/ncs
    messageNotification:
        enable: false
        events:
            # Currently only supported `productID: 3` and `eventType: 45`
            -   productID:
                eventType:
                secret:

# See: https://docs.agora.io/en/whiteboard/generate_whiteboard_token_at_app_server?platform=RESTful
whiteboard:
    # Whiteboard AK
    access_key:
    # Whiteboard SK
    secret_access_key:
    # Convert Region
    # "cn-hz" | "us-sv" | "sg" | "in-mum" | "gb-lon"
    convert_region:

# Storage Service
storage_service:
    # Currently, only supported OSS
    type: oss
    oss:
        access_key:
        secret_key:
        endpoint:
        bucket:
        region:

# Content censorship
censorship:
    # Need to configure screenshot and messageNotification services under agora
    # messageNotification needs to be added: productID: 3 and eventType: 45 (see: https://docs.agora.io/en/cloud-recording/cloud_recording_callback_rest)
    # The principle is to take a screenshot of all the video streams in the room at regular intervals, get the screenshot address through the message notification service, and call a third party (e.g. AliCloud) to review the API to check it
    video:
        enable: false
        # Current only support aliCloud
        type: aliCloud
        # See: https://www.alibabacloud.com/help/en/content-moderation/latest/development-preparations-1
        aliCloud:
            access_id:
            access_secret:
            endpoint:
    # See: https://docs.agora.io/cn/cloud-recording/audio_inspect_restful?platform=RESTful
    # NOTE: No English description available at the moment
    voice:
        enable: false
        # Current only support aliCloud
        type: aliCloud
        aliCloud:
            uid:
            access_id:
            access_secret:
            callback_address:
    text:
        enable: false
        # Current only support aliCloud
        type: aliCloud
        # See: https://www.alibabacloud.com/help/en/content-moderation/latest/development-preparations-1
        aliCloud:
            access_id:
            access_secret:
            endpoint:

If deployment is required then you need to ensure that the following variables are present in the environment variables for deployment:

Variable Name Description Note
METRICS_ENABLED Whether to enable metrics monitoring
METRICS_ENDPOINT metrics url path e.g.: /metrics
METRICS_PORT metrics port e.g.: 9193

Tech Stack

Disclaimer

You may use Flat for commercial purposes but please note that we do not accept customizational commercial requirements and deployment supports. Nor do we offer customer supports for commercial usage. Please head to Flexible Classroom for such requirements.

More Repositories

1

flat

Project flat is the Web, Windows and macOS client of Agora Flat open source classroom.
TypeScript
5,700
star
2

flat-android

Project Flat Android is the Android client of Agora Flat open source classroom.
Kotlin
108
star
3

netless-rtc-react-whiteboard

Demo https://demo-rtc.herewhite.com/#/zh-CN/
TypeScript
71
star
4

whiteboard-demo

TypeScript
66
star
5

netless-app

Official Apps for the Agora Interactive Whiteboard.
TypeScript
58
star
6

fastboard

An open sourced whiteboard starter based on white-web-sdk.
TypeScript
53
star
7

flat-iOS

Project Flat iOS is the iOS client of Agora Flat open source classroom.
Swift
50
star
8

Whiteboard-iOS

Whiteboard
Objective-C
30
star
9

netless-react-whiteboard

netless whiteboard demo https://demo.herewhite.com/#/zh-CN/
TypeScript
24
star
10

whiteboard-android

Java
22
star
11

white-fast-web-sdk

TypeScript
14
star
12

netless-token

sample codes to generate token for Netless services
JavaScript
14
star
13

window-manager

a window management system based on white-web-sdk
TypeScript
13
star
14

vue-whiteboard

Vue
11
star
15

Whiteboard-bridge

white-web-sdk, white-sdk-ios, white-sdk-android
TypeScript
10
star
16

netless-slide-demo

ๅŸบไบŽ canvas ็š„ pptx to html
JavaScript
9
star
17

flat-landing-page

https://github.com/netless-io/flat
HTML
7
star
18

whiteboard_flutter

A flutter library for Agora Whiteboard
Dart
6
star
19

fastboard_flutter

A flutter library for Agora Fastboard
Dart
6
star
20

community-apps

Community Netless Apps for Whiteboard Window Manager.
4
star
21

community-app-template

Community Netless Apps for Whiteboard Window Manager.
JavaScript
4
star
22

sync-player

TypeScript
4
star
23

legacy-netless-swift-whiteboard

Netless build iOS whiteboard demo with โค๏ธ
Swift
4
star
24

netless-combine-player

TypeScript
4
star
25

fastboard-iOS

Quickly create a whiteboard interface for iOS
Swift
4
star
26

docs

netless sdk documents
JavaScript
4
star
27

netless-iframe-bridge

TypeScript
3
star
28

synced-store

TypeScript
3
star
29

legacy-netless-android-whiteboard

Netless build Android whiteboard demo with โค๏ธ
Java
3
star
30

white-android-demo

3
star
31

canvas-polyfill

a polyfill for canvas getTransform, ellipse, resetTransform API
TypeScript
3
star
32

sync-player-iOS

Swift
2
star
33

fastboard-android

Java
2
star
34

react-native-fastboard

interactive whiteboard with user interface for react-native
TypeScript
2
star
35

telebox-insider

Experimental Whiteboard Windows UI.
TypeScript
1
star
36

vuplex-bridge

https://developer.vuplex.com/webview/overview
C#
1
star
37

watermark-pptx

automatically add watermark to all images in pptx
JavaScript
1
star
38

slide-prefetch

Simple script to prefetch packed slide data on navigation.
TypeScript
1
star
39

white-snapshot

TypeScript
1
star
40

whiteboard-flutter-bridge

Whiteboard-Flutter-bridge
TypeScript
1
star
41

y-app-attributes

Netless App Attributes adapter for Yjs
1
star
42

netless-ppt-plugin

1
star
43

rebirth

1
star
44

y

Shared utils for using CRDT in Netless Apps
TypeScript
1
star
45

electron-whiteboard-preload-demo

whiteboard preload demo in electron
TypeScript
1
star
46

SLSWeb

TypeScript
1
star
47

flat-server-docs

flat server docs (api / config / types)
1
star
48

netless-i18n-react-router

TypeScript
1
star
49

react-native-whiteboard

Whiteboard implements for react-native
TypeScript
1
star
50

pre-convert-demo

pre convert your ppt to whiteboard resources
JavaScript
1
star
51

sign-server

SignTool.exe as a server.
JavaScript
1
star