Skip to content

Instantly share code, notes, and snippets.

@albulescu
Last active May 3, 2017 13:57
Show Gist options
  • Save albulescu/e8717afb60267fda1e16d1f8c808d218 to your computer and use it in GitHub Desktop.
Save albulescu/e8717afb60267fda1e16d1f8c808d218 to your computer and use it in GitHub Desktop.

Code Audit:

Meteor drawbacks:

I. You're stick to the "normal" way of Meteor development and you can't work how you want without installing a package that do some job. That also might be no problem because packages do more than what you want and this increase filesize and this will increase the loading time of the app.

II. Its hard to debug, when there are problems. Its very hard to investigate and find a solution and this increase development time

III. The current app is bound to unnecessary external services like

Algolia - This service has no point for me and also its not cheep, the starter package is $49 just for having a search api. This price is the same price having a dedicated server or Digital Ocean which is $40 for 4G memory and 2 cores. On this type of machine its easy to install Elastic Search and have better speed and control. But the main thing is we dont need a search service/app for now, MongoDb has his own querying api with geolocation to and its fast enough for now

IV. Having backend and frontend on the same place will generate a mess in the code especially when there are more than one contribuitors on the application.

The current backend code its very small, if you take a look on the repo at /backend you will see there is 356 KB of code which is quite few ( frontend has 2,2 MB )

Source code

I. The code is messy and hard to follow and find things

  • Files with +1000 lines of code
  • Its not properly structured on folders

II. Performance This piece of code do the following: For every route within the app will take from database the following informations: settings, messages, lessons, presence, notifications. This is bad way for doing this, data should be loading on demand to avoid increasing load time -- meteor provide realtime communications.

Router.onBeforeAction(globalHooks.siteSettings);
Router.onBeforeAction(globalHooks.grabMessages);
Router.onBeforeAction(globalHooks.grabLessons);
Router.onBeforeAction(globalHooks.userPresence);
Router.onBeforeAction(globalHooks.grabNotifications);

And there might be more.

Action points

Its very important to follow your plans. If you want to go and show something to the clients continuing with this might be the solution but it can not be done because of legacy code and problems that will appear. In time problems will come because if foundation is not good the rest will have problems

I know there is a rush to have things done, but there is a trade between quality and quantity and if things are not done properly from the beginning it will be hard afterwards

What would i do:

  1. Create separate decoupled app for backend using NodeJs or GoLang
    • It will be easy to use the service by other apps ( mobile, third-party )
    • It will be fast
    • Easy to change and add new features
  2. Refactor front-end app using React or Angular

To make my life easy in the future i could do that for free in one week and im pretty sure i can rewrite it. I prefer to be happy to work rather than digging for problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment