PouchDB with CouchDB with Node Web Api Server Layer? - node.js

Just trying to spec out a new system. We want to build a mobile app with offline storage using react-native.
We were originally going to use node and create a web api layer that worked with a MongoDB. However after looking into offline storage we found PouchDB. But pouch has to use CouchDB. So we are considering using CouchDb and having a flat db layer with all our business and data logic modelled in the apps.
However there may be some server side things that we need to do (for example pulling other records from somewhere else in the organisation).
So can we deploy a web api using node alongside CouchDb? How would this work? Totally separate or in the same node process?

So can we deploy a web api using node alongside CouchDb?
Yes, of course.
How would this work?
I'm not sure about what solution suites your needs, but one solution is to develop a web app with this tech-stack: NodeJS/Express, CouchDB/PouchDB and ReactJS/MobX. One important point about CouchDB is that, you shouldn't think about it like any other database . Basically, you don't need any server-side code to talk to CouchDB, it can all be done on the client-side with PouchDB. The live sync of PouchDB is extremely convenient at handling offline/online storage. If you're considering ReactJS, take a look at MobX.

Related

RealTime CRUD Application with nodejs /express and mongodb

I wish to create a realtime crud application, using node.js and express as the backend with MongoDB as the database in order to serve flutter frontend
I tried searching on google and GitHub, I found socket.io, but just for chat applications. my goal is to make a mobile app with synchronized data (like apps using firebase) using node js and MongoDB as Backend. Thank you!
Socket.Io is a good option for real-time communication. In fact it is a very popular choice. Socket.IO is not created to build chat application. Most of the time, as an example of real-time app everyone bring the concept of chatting. Main purpose of Socket.IO is to transfer data in real-time. It can be any data.
If you are new to this world then I would suggest you to take a look at FeathersJS. You can switch from REST to Real-time or vice versa anytime you want with a couple of lines of code change. A lot of things are hidden from you to make your development easier. Their documentation is good as well.
And the fun part is, FeathersJS is based on ExpressJS and you can choose database driver as you want (mongoose is available as an option).

How can I decide if I should use a NoSQL vs a SQL database engine?

I plan to build an app using Node.js as my Rest API Service and Angular for my Admin side.
I've tried to create Rest API using Node.js with MongoDB as my database server.
MongoDB is a transactional DB, not a relational DB. So my question is, is MongoDB not good as my database server because it's a transactional DB? (for storing all data let's say data for e-commerce)? How can I know which one to use, MongoDB or a regular SQL database.
Thanks for your answer.
You have a couple of concepts wrong.
First, Angular is a frontend framework not a backend. Angular runs in the browser. Perhaps you mean you will use as your "admin" panel or whatever but it's a frontend technology. It will need to talk to an API server, which is the backend part.
Second, database engine selection is chosen depending on the system non-functional requirements. There are plenty of articles you can research so that you can make the decision, such as this one from MongoDB official site. There's also a video on it too.

App creation with AmpersandJs and Database connectivity

I am creating a nodejs app and as per clients suggestion trying to implement it in AmpersandJs. I have installed framework and created application by following documentation &js installation.
The app is running with some sample data
I found that the sample data is coming from ampersand-app module from an index.js file.
But I want to do database connectivity with it -- How should I achieve this? I have Googled but not found any good link for it.
Did &js is good choice to develop application or it is for an specific type of projects?
But I want to do database connectivity with it -- How should I achieve this?
Ampersand.js is running in the browser. If you want to access data stored in a database you have two options:
Request data from a database running on a server somewhere accessible over the network. In this case you want to use the url property of models/collections
Use an in-browser database (maybe you want to have look at pouchdb as API)
Did &js is good choice to develop applications?
Definitely yes!

Can Meteor be used with PaaS services?

Am I correct in the assumption that without access to the MongoDB server, there is not much point developing with Meteor?
Meteor is a great framework for building, packaging and deploy apps and sites. From a development POV, the templating and responsive DB work make prototyping so much easier than most MVC's.
I understand that underneath the hood, websockets and DDP provide the realtime sync'ing magic which means that you need access to the MongoDB server, something you don't have with PaaS solutions like GoogleAppEngine, Parse or Kinvey.
So, for the backend developer, they don't derive much benefit from Meteor since they need to maintain the server stack and scalability issues.
Is there a path to create and deploy products with Meteor without having to build and maintain the backend infrastructure? Heroku is still pretty close to the bone when it comes to managing infrastructure.
Wondering if there's a way to have CRUD operations through a REST driver that maps out to whatever PaaS you want and have the PaaS post log changes to a server that strictly handles websocket connections. Basically, pass the CRUD operation to a PaaS and maintain your own websocket server/s.
MeteorPedia has a page on deploying to PaaS: http://www.meteorpedia.com/read/Category:PaaS_providers
Recently, Google AppEngine has added support for custom VMs.
You can also use MongoHQ or similar for the database.

Is this a good web application architecture?

I'm trying to build a website myself but I also want to build a native mobile application that will access the same DB in the future.
What I'm thinking now is using Node.js to build Web Services wrapper for the DB and every DB operation will be executed via web service API. And for the website framework, I'm going to use Rails.
Please let me know whether this is a good architecture or not. I'm not sure whether encapsulate data with Web Services is a good idea. Will there be any performance issue? And if it's feasible, which DB should I use? And can rails communicate with DB via web services?
Thanks a lot!
Update
Why do people down vote this question??
I think you have more technology than needed in your architecture right now.
Personally I would create a REST api on top of the DB (using either node or Rails - both are super easy to do this with and both can use pretty well any db)
Then you can write any number of "apps" for the front end process, whether they are web apps, ios apps, android apps, etc... They will all get their data from your REST api on the backend.
You might even consider writing the front end as a single page app using Angular, Knockout or Backbone, something like that. If you do that with node, your entire stack will essentially be written in javascript. It can get confusing for a newb, but it's super powerful.

Resources