When we set out to create Konzilo we had a few ideas in mind:
- The frontend was going to be completely separate from the backend.
- The backend should be in the form of a REST web service and should do as little as possible.
- The data model should be flexible but we still need to ensure some form of consistency.
What we didn't know at the time was that the data model that we set out to build would turn out to be highly relational in nature. We thought of each article in the system as one document, and that document could be big and possibly consist of many sub documents. This worked out great in the beginning, but as we moved forward with the application architecture we found difficulties with this approach.
An article consists of multiple parts. These parts have revisions and possibly different authors assigned on them. Only the authors should be allowed to edit their part. It made sense to separate article parts out so that they could be fetched individually.
We used MongoDB as our primary storage in Konzilo. We used the Mongoose ODM to help with validation and consistency of the data. In the end we realized that what we really needed could be done a lot better with a traditional RDBMS.
Our current stack is a fairly common MEAN stack:
- MongoDB
- Mongoose ODM
- Expressjs
Express is well suited for the job of creating a web service, but it's a microframework which means you will end up spending a lot of time re-inventing common patterns.
We are looking into going to mariaDB for storage. In order to do that easily we need at least:
- A system to provision our schema
- A framework with routing
- A database abstraction layer
- Some form of entity framework to work with our storage more easily.
In short, we need a framework. We have several preferred languages that are our go to languages for differnt tasks: PHP, Javascript and Python. To make it simple, we just picked three frameworks in the different languages to compare:
Javascript: Sails JS PHP: Laravel Python Django + Django REST
We will create a sample rest application which is a subset of what we need for our full application and measure the following:
- Performance
- Lines of code
- Subjective opinion
The application will be a simple user and company management service. Some resources will be protected with Oauth 2.
Register a new user with the following parameters:
{
username: username
password: password
email: email
}
Update an existing user. Requires an oauth token.
{
username: username
oldPassword: password
email: email
}
Index existing users. This callback should only return the users you have access to, which is your own user and users in the organisation you belong to.
Get a user with a particular ID.
Create a new organistaion. Protected with oauth.
{
name: "name"
user: uid
members: []
}
Update an existing organistaion
{
name: "name"
members: []
}