# CouchDB + Ext as a Replacement for Server Code

DevFeed: [CouchDB + Ext as a Replacement for Server Code](<https://devfeed.tech/articles/couchdb-ext-as-a-replacement-for-server-code-33351.md>)

Original publisher: [Read original article](<https://timkellogg.me/blog/2010/06/08/couchdb-ext-as-replacement-for-server>)

Published: 2010-06-08T00:00:00Z

Content type: opinion

Language: en

Sources: [Tim Kellogg](<https://devfeed.tech/sources/tim-kellogg.md>)

Topics: [couchdb](<https://devfeed.tech/topics/couchdb.md>), [web applications](<https://devfeed.tech/topics/web-applications.md>), [Database](<https://devfeed.tech/topics/database.md>), [JavaScript](<https://devfeed.tech/topics/javascript.md>), [JSON](<https://devfeed.tech/topics/json.md>), [business logic](<https://devfeed.tech/topics/business-logic.md>), [client](<https://devfeed.tech/topics/client.md>)

Tags: [business-logic](<https://devfeed.tech/tags/business-logic.md>), [client](<https://devfeed.tech/tags/client.md>), [couchdb](<https://devfeed.tech/tags/couchdb.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [json](<https://devfeed.tech/tags/json.md>), [web-apps](<https://devfeed.tech/tags/web-apps.md>)

## AI overview

The article examines whether a web application can move its business logic into the browser while using CouchDB as a web service instead of server-side code. It discusses CouchDB's schema-free document model, JSON documents, relationship modeling, object persistence, and potential scalability, while noting that many-to-many relationships may be more complicated.

## Source excerpt

In a previous post about ExtJS I mentioned the possibility of developing a web application that runs entirely inside the browser and doesn't require any server side code. The idea stems from a) ExtJS is a fully capable widget framework and b) CouchDB is accessible via a web service. At least 80% of web apps are just a HTML interface with a database back-end and a little bit of business logic. So why can't we move all that business logic to the browser, setup calls to a CouchDB web service from the browser and 86 the server-side code? In this post I'm going to analyze this question and see if it's realistic. In a follow up post I'm going to analyze this same question from a business standpoint.A Database Void of SchemaCouchDB is a document oriented database, meaning that it doesn't have tables and keys like you do in relational databases. It just has one big space full of documents. A document in CouchDB is a JSON object, so its attribute values can be strings, booleans, numbers, lists, or other objects (documents). Having complex "rows" means that many of your relationships that you would normally form by using a second table and a primary-foreign key set is simplified down to embedding a list. Consequently, 1-to-1 and 1-to-many relationships are native to the database and require no extra thought or planning. Many-to-many relationships are more complicated, so this approach might break down if you require too many of these. Some other oddities in relational databases like versioning and pivot tables come native with CouchDB. Since the bulk of our database requirements are made easier with CouchDB, querying is going to be generally simpler.The other great thing about having a document formatted in JSON is that you can save any JavaScript object directly to the database. You could save the state of an Ext widget or a whole form. It's like simplified object serialization for the browser! This is definitely a killer argument for making fat client apps with Ext.But What