How to develop for Web And Mobile?

90 views
Skip to first unread message

Nick Pavlica

unread,
Aug 13, 2014, 7:36:01 PM8/13/14
to mobile-c...@googlegroups.com
All,
  After researching the use of Sync Gateway and Couchbase Server as a platform for web and mobile applications, I would like to make sure that I understand the development model.  I will list my assumptions(insert joke here:))/questions below, in the hopes that I'm thinking about things correctly.

1.  All new applications that use offline/online syncing should use the Sync Gateway Rest API exclusively to avoid the duplicate work created by shadowing a bucket?

  1(A).  Will the native drivers be updated to implement the necessary components for syncing,  allowing native access to the data without the need of the Sync Gateway?
  1(B).  Alternatively, will Couchbase server be modified so that it handles the syncing components without requiring the Sync Gateway? 

2.  The Sync Gateway doesn't currently have CORS support. Is this support planned, if so, what is the timeline?

  2(A).  Instead of using the Sync Gateway directly from browser based apps(Angualrjs,ETC.)  should you use a server based "Web Framework" that utilizes the Sync Gateway APIs for traditional Browser facing UI's?  In addition to the traditional web app architecture, you would also develop native mobile apps with CB light that simultaneously utilize the Sync Gateway API.

              Architecture:
               +  Desktop/Mobile Browsers ---> "Client+Server Web Framework of Choice"  -----> Sync Gateway ----> CouchBase Server
               +  And a Native Device App + CB Light -----> Sync Gateway ----->  Couchbase Server 

3.  Does the use of the Sync Gateway limit the full functionality of Couchbase Server? 

4.  Can PouchDB, and Apache CouchDB be used safely with the Sync Gateway?

5.  When using the Sync Gateway, are there any special considerations to make when modeling your documents?


- Thanks!
-- Nick

Jens Alfke

unread,
Aug 15, 2014, 12:46:47 PM8/15/14
to mobile-c...@googlegroups.com
On Aug 13, 2014, at 4:36 PM, Nick Pavlica <lin...@gmail.com> wrote:

1.  All new applications that use offline/online syncing should use the Sync Gateway Rest API exclusively to avoid the duplicate work created by shadowing a bucket?

It depends. In most cases, yes. But if you explicitly want to use the Couchbase Server APIs as well (maybe you're an expert at it, or you want to use a library that uses it) you'll need bucket shadowing.

  1(A).  Will the native drivers be updated to implement the necessary components for syncing,  allowing native access to the data without the need of the Sync Gateway?

I'm not sure what you mean by this? Do you mean extending the Couchbase SDKs to add support for calling the Sync Gateway REST API? You'd have to ask the SDK team about that. (But there are existing libraries for the same languages for communicating with CouchDB, which uses the same REST API as the Sync Gateway, so you can use those.)

  1(B).  Alternatively, will Couchbase server be modified so that it handles the syncing components without requiring the Sync Gateway? 

It's unclear. That depends on architectural decisions that haven't been made yet.

2.  The Sync Gateway doesn't currently have CORS support. Is this support planned, if so, what is the timeline?

There's an issue for it in Github; I don't remember whether it's been assigned a milestone. (Or possibly it's been fixed since 1.0.1?)

  2(A).  Instead of using the Sync Gateway directly from browser based apps(Angualrjs,ETC.)  should you use a server based "Web Framework" that utilizes the Sync Gateway APIs for traditional Browser facing UI's?  

Yes, for now. The Sync Gateway API doesn't yet expose a way to query views, and that really limits what you can do with it directly.

3.  Does the use of the Sync Gateway limit the full functionality of Couchbase Server? 

Only in that you shouldn't use Couchbase Server APIs to write to the gateway's bucket directly.

4.  Can PouchDB, and Apache CouchDB be used safely with the Sync Gateway?

Yes, for the most part. There are a few compatibility issues (see Github for details.) The one that I remember is that PouchDB doesn't yet support MIME multipart format for downloading docs with attachments, but Sync Gateway doesn't support the older all-JSON format.

5.  When using the Sync Gateway, are there any special considerations to make when modeling your documents?

As opposed to using what? It's going to be mostly the same as using CouchDB or PouchDB, but of course very different from a relational db.
The differences from *ouchDB would be in how to deal with channel assignment, i.e. using properties to denote what channel the document should be in or what channels are otherwise associated with it.

—Jens

Daniel McGreal

unread,
Aug 18, 2014, 6:11:31 AM8/18/14
to mobile-c...@googlegroups.com
Hi,

I am struggling to come up with the best-fit solution for a web and mobile system.

Is the ability to access views and run queries via SG considered or planned?

Does bucket shadowing deal with document attachments? If not, could it?

Thanks! Dan.

Jens Alfke

unread,
Aug 18, 2014, 12:19:27 PM8/18/14
to mobile-c...@googlegroups.com
On Aug 18, 2014, at 3:11 AM, Daniel McGreal <d.j.m...@gmail.com> wrote:

Is the ability to access views and run queries via SG considered or planned?

Yes; and you can do it now by querying the database's bucket directly. (Normally we say not to access the bucket through Couchbase Server APIs, but in this case there's no alternative, and it's read-only anyway.)

Does bucket shadowing deal with document attachments? If not, could it?

No. I suppose it could, but how should the attachments be represented in the app bucket? (Also, in the long run we don't want attachments to be stored in buckets at all, as buckets don't deal well with big binary blobs. We'll likely switch to an external distributed file system like CBFS.)

Currently the attachment metadata is propagated to the app bucket (as a top-level "_attachments" property), and you can get the attachment body from that data by using the gateway's REST API.

—Jens

Dan

unread,
Aug 18, 2014, 1:08:55 PM8/18/14
to mobile-c...@googlegroups.com
Thanks Jens. This information will help me decide on our web client strategy.

--
You received this message because you are subscribed to a topic in the Google Groups "Couchbase Mobile" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mobile-couchbase/R7KIyhMlh2g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mobile-couchba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/852AFB08-EF1E-4993-AD58-49D768C9AC55%40couchbase.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages