标签归档:Meteor

firebase替代

Google的firebase只能在国外用,且不开源,国内的有野狗、leancloud都是小厂。

参考

PouchDB

PouchDB is an open-source JavaScript database inspired by Apache CouchDB that is designed to run well within the browser.

PouchDB was created to help web developers build applications that work as well offline as they do online.

It enables applications to store data locally while offline, then synchronize it with CouchDB and compatible servers when the application is back online, keeping the user\’s data in sync no matter where they next login.

var db = new PouchDB('dbname');

db.put({
  _id: 'dave@gmail.com',
  name: 'David',
  age: 69
});

db.changes().on('change', function() {
  console.log('Ch-Ch-Changes');
});

db.replicate.to('http://example.com/mydb');

CouchDB

Apache CouchDB™ lets you access your data where you need it. The Couch Replication Protocol is implemented in a variety of projects and products that span every imaginable computing environment from globally distributed server-clusters, over mobile phones to web browsers.

Store your data safely, on your own servers, or with any leading cloud provider. Your web- and native applications love CouchDB, because it speaks JSON natively and supports binary data for all your data storage needs.

The Couch Replication Protocol lets your data flow seamlessly between server clusters to mobile phones and web browsers, enabling a compelling offline-first user-experience while maintaining high performance and strong reliability. CouchDB comes with a developer-friendly query language, and optionally MapReduce for simple, efficient, and comprehensive data retrieval.

$ curl -X PUT http://127.0.0.1:5984/my_database/001 -d
'{  Name  :  Raju  ,  age  : 23  ,  Designation  :  Designer  }'

{ok:true,id:001,rev:1-1c2fae390fa5475d9b809301bbf3f25e}

gunDB

A realtime, decentralized, offline-first, mutable graph protocol to sync the web. https://gun.eco/docs

<script src=https://cdn.jsdelivr.net/npm/gun/gun.js></script>
<script>
// var Gun = require('gun'); // in NodeJS
// var Gun = require('gun/gun'); // in React
var gun = Gun();

gun.get('mark').put({
  name: Mark,
  email: mark@gunDB.io,
});

gun.get('mark').on(function(data, key){
  console.log(update:, data);
});
</script>

gun官网

RxDB

⛁ A realtime Database for JavaScript Applications https://rxdb.info/

myCollection.insert({
  name: 'foo',
  lastname: 'bar'
});
const query = myCollection
    .find()
    .where('age')
    .gt(18);

Meteor

Meteor is a full-stack JavaScript platform for developing modern web and mobile applications. Meteor includes a key set of technologies for building connected-client reactive applications, a build tool, and a curated set of packages from the Node.js and general JavaScript community.

  • Meteor allows you to develop in one language, JavaScript, in all environments: application server, web browser, and mobile device.
  • Meteor uses data on the wire, meaning the server sends data, not HTML, and the client renders it.
  • Meteor embraces the ecosystem, bringing the best parts of the extremely active JavaScript community to you in a careful and considered way.
  • Meteor provides full stack reactivity, allowing your UI to seamlessly reflect the true state of the world with minimal development effort.

Meteor 官网

import { Mongo } from 'meteor/mongo'; 
export const Tasks = new Mongo.Collection('tasks'); 
import { Tasks } from '../api/tasks.js'; 
db.tasks.insert({ text: Hello world!, createdAt: new Date() });

Kinto

Kinto is a minimalist JSON storage service with synchronisation and sharing abilities. It is meant to be easy to use and easy to self-host.

Kinto is used at Mozilla and released under the Apache v2 licence.

http GET https://kinto.dev.mozaws.net/v1/buckets/default/collections/tasks/records \
       -v --auth 'bob:s3cr3t'

Kinto文档

Kinto官网

Hoodie

Hoodie is a free and Open Source Software for building applications for the web and iOS. It is a complete backend for your apps, ready for you to get creative. It works immediately out-of-the-box: develop your frontend code, plug it into Hoodie’s frontend-friendly API and your app is ready.

When you develop it, your app runs locally first, you can then deploy and host it wherever you want to. And if you want to extend Hoodie’s core features, you can check our list of currently available plugins or build plugins yourself.

Hoodie is a noBackend technology — it\’s there for making the lives of frontend developers easier by abstracting away the backend and keeping you from worrying about backends. It gives you Dreamcode: a simple, easy-to-learn-and-implement frontend API built into it. Hoodie is also Offline First, which means that your app users’ data is stored locally by default so your Hoodie-based apps are accessible and usable anytime, independent from your users’ internet connection.

hoodie.store.add({
    type: 'todo-item',
    content: 'Try out hoodie!',
    done: false
})