Sign inSign up

sfalda/sync_server

By sfalda

•Updated about 10 hours ago

A simple sync-server able to sync user data between devices.

Image
Developer tools
Web servers
Databases & storage
0

1.2K

sfalda/sync_server repository overview

⁠Sync Server

The Sync Server is a Node.js/Express-based server designed to handle user authentication, client registration, and data synchronization across multiple platforms. This server works alongside a client-side library to ensure secure and consistent data synchronization, providing support for realms to separate different user groups or applications.

Source: sync_server_ts⁠

The client-side library is available for Flutter and any of its supported platforms (iOS, Android, Web, Windows, MacOS, Linux):

⁠Configuration

The server is able to support different realm each one with its specific database backend (postgres). Every realm should be defined in the config.json file in the dist folder or in the base folder for development. Beware that the realm should be coded in lowercase.

Example config.json:

{
 "db": {
     "realms": {
         "default": "postgresql://postgres:postgress@localhost:5433/postgres",
         "todos": "postgresql://postgres:postgress@localhost:5433/postgres",
         "todo_test": "postgresql://postgres:postgress@localhost:5433/postgres"
     }
 },
 "email": {
     "from": "Nowhere Man",
     "fromEmail": "[email protected]",
     "smtp": "email-smtp.eu-west-3.amazonaws.com",
     "port": "2587",
     "username": "john",
     "password": "password",
     "apps": {
         "default": "Sync Server App",
         "todos": "ToDos App"
         "todo_test": "ToDos Test App"
      }
 }
}

⁠Deployment

If you want to self host everything you can use a docker-compose.yml file like the following:

services:
  db:
    image: postgres:alpine3.20
    user: postgres
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgress
      - POSTGRES_DB=postgres
    healthcheck:
      test: ["CMD-SHELL", "pg_isready"]
      interval: 1s
      timeout: 5s
      retries: 10  
    ports:
      - "5433:5432"
    volumes:
      - ./database_postgres_script.sql:/docker-entrypoint-initdb.d/init.sql
      - ./data:/var/lib/postgresql/data
    
  server:
    image: sfalda/sync_server:latest
    restart: always
    container_name: sync-server
    ports:
      - '8076:3000'
    depends_on:
        db:
          condition: service_healthy
    volumes:
      # the config.json file
      - ./dist/config.json:/app/dist/config.json

Tag summary

Content type

Image

Digest

sha256:e97129206…

Size

58.3 MB

Last updated

about 10 hours ago

docker pull sfalda/sync_server