Skip to content

elroykanye/maayo

Repository files navigation

Maayo

Maayo (Fulfulde: "river") — offline-first sync between a local device store and any backend.

CI License: MIT

Maayo is for applications that need to work without a network connection. Local writes go into an IndexedDB outbox immediately and sync to your server whenever connectivity returns. The server side is two HTTP endpoints — implement them on any backend, any database, any language.

Packages

Package Version Downloads Description
@maayo/protocol npm downloads TypeScript types — zero runtime deps
@maayo/client npm downloads Core engine: outbox, push/pull, LWW
@maayo/react npm downloads React / Next.js hooks
@maayo/angular npm downloads Angular signals + DI
@maayo/spring GitHub Packages Spring Boot autoconfiguration

How it works

Browser                                    Server (any DB)
─────────────────────────────────────      ─────────────────────────
write → _outbox (IndexedDB)
               ──── POST /sync/mutations ──→  store mutation + timestamp
               ←─── GET  /sync/changes   ───  deltas since cursor
apply to local tables ←
update cursor ←

Writes are local-first — they appear in the UI instantly even offline. Push and pull run independently. A device can be offline for days, queue hundreds of writes, and sync cleanly when it reconnects.

Quick start

React / Next.js

npm install @maayo/react @maayo/client dexie
// layout.tsx — add 'use client' for Next.js App Router
import { SyncProvider, useCollection } from '@maayo/react';

function App() {
  return (
    <SyncProvider config={{ baseUrl: 'https://api.example.com', dbName: 'myapp', channels: ['org:abc'] }}>
      <StudentList />
    </SyncProvider>
  );
}

function StudentList() {
  const students = useCollection('students');
  return students.map(s => <div key={s.id}>{s.name}</div>);
}

Angular

npm install @maayo/angular @maayo/client dexie
// app.config.ts
import { provideSync } from '@maayo/angular';

export const appConfig = {
  providers: [provideSync({ baseUrl: 'https://api.example.com', dbName: 'myapp', channels: ['org:abc'] })]
};
// component
students = syncCollection('students');
status = injectSyncStatus();

Spring Boot server

// build.gradle.kts
repositories {
    maven { url = uri("https://maven.pkg.github.com/elroykanye/maayo") }
}
dependencies {
    implementation("dev.maayo:maayo-spring:0.1.1")
}

Any backend language works — see the protocol spec.

Framework support

Frontend Support
React 18+ @maayo/react
Next.js (App Router / Pages) @maayo/react + 'use client'
Angular 17+ @maayo/angular
Vue / Nuxt @maayo/client directly (Vue adapter planned)
Svelte / vanilla JS @maayo/client directly
Backend Support
Spring Boot @maayo/spring (GitHub Packages)
Node.js / Express / Fastify Implement 2 endpoints — protocol spec
Python / FastAPI / Django Implement 2 endpoints — protocol spec
Go, Rails, Laravel, any Implement 2 endpoints — protocol spec

Docs

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors