Finishing in half the time

Every time I start out a new project, I have to spend weeks simply getting the skeleton for my project up running. This is a highly repetetive process, and although I’m getting fairly good at it, the fact that I’ll need to do this repetetive task over and over again, is actually quite annoying to be honest. Simply wiring up Fluent nHibernate, Ninject, Mapster, and all the libraries I want in my project, often requires days of searching for solutions on Google and This process also happens to be of such a nature that I rarely seem to remember exactly how to do it correctly from project to project, and the statistical probability of that I’ll do something wrong, is unfortunately very high.

For instance, in my particular industry, which happens to be ForEx and finance, there’s this concept of KYC, which means Know Your Client. For me as a developer, this implies I’ll have to create some controller endpoint, that can accept uploading of files, such that my employer’s clients can upload images of their identity cards, and/or passports. The arguments for this, is to avoid being used to do money laundering on behalf of dubious clients, whom for some reasons are doing dubious things. Regardless of the legal arguments, the task for me is the exact same; Create an HTTP REST controller endpoint, where I can accept files, store these files associated with some client, and make sure the files are secured, such that others cannot access them in any ways. Every time I create a system for my employer, the task is the same. Simply making sure this is correctly created, such that it’s secure, and doesn’t in any ways compromise the safety of our clients, often require days and weeks of coding, every single time I start out a new project.

The problem is that this type of solution doesn’t easily lend itself to libraries either. As far as I know, there doesn’t really exist good libraries allowing me to avoid having to do this task. First of all because every single time I implement this feature, it requires slightly modified code for that particular application. Some apps might want the clients to see the files they have uploaded, and possibly even upload new versions – While other apps only want the client to be able to upload a maximum of 4 files, etc. Other apps might require the uploader to be authorised, others don’t – Etc …

There is no way that I know about to intelligently create libraries that are flexible enough to permanently solve this problem. Still the code is similar enough every time to imply that it’s a problem that should be solved once, for then to never be looked at again. There are also tons of similar problems I face, that are common problems, but doesn’t lend themselves easily to libraries or NuGet packages either, because they require too much customisation to be intelligently reused as libraries. Authorization and authentication comes to mind …

Meet Magic

The purpose of Magic is to provide me with a skeleton for such projects. Basically, a starter kit, allowing me to start out with 50% of the problem already solved, for then to give me extension points where I can modify its source code easily, to accommodate for the particular problem I am currently facing, in whatever application I am currently building at the moment. Uploading of files securely to my web server? Sure, no problem. Already fixed.

With Magic I am able to start out my new projects in such a way that I no longer need to spend weeks applying structure, and implementing these repetetive tasks, I know I’ll have to do every time I start out a new project. At the same time, it’s not a NuGet package, and probably not possible to distribute as one either – But rather exclusively distributed as pure source code. This allows me to modify any aspects of it, by simply editing its existing code. In a way it becomes to my own day job the equivalent of what a box of Tandoori sauce is to my girlfriend. It allows her to rapidly cook Indian food, without having to spend hours creating the sauce. A box of Tandoori sauce has little value by itself, but mixed with some rice, meat, and veggies, it becomes a perfectly valid Indian dish. At the same time, my girlfriend can choose if she wants to add beef to it, chicken, carrots or onions. It doesn’t destroy her ability to think creatively in any ways, it just simply does what she doesn’t want to do, or don’t know how to do. It allows my girlfriend to make an Indian dish in half the time, while it at the same time increasing her ratio of success.

I’ll obviously use Magic myself in my own job. But in addition, I have also created it as a publicly available and open source starter kit for others to use as they see fit. This approach allows me to get valuable feedback about the project(s), and have other developers scrutinise my code, and come with suggestions, which is always a good thing. For open source applications, it’s free of charge to use. For closed source applications I charge €50 for each module in it. This allows you to start out with half the job done, for a handful of EUROs, every time you need to solve similar problems as I need to solve in my job. Arguably doing half your job, making you that more productive, for some 50-150 EUROs every time you start out a new project. Effectively becoming the “Tandoori Sauce of Software Development.”

Check out its source code at GitHub if you wish

Problems currently solved

So far I have created 4 projects. The main project is simply called Magic. The core of Magic provides you with an extendible web API, allowing you to drop in any controller endpoints you wish. It wires up Ninject, nHibernate, allows you to choose your database provider transparently, and does most of the wiring up. Out of the box, it is a simple TODO web API, but the TODO controller is simply there to serve as an example.

Among one of its really nice traits I think, is its ability to rapidly create CRUD controller endpoints, for any type where you need (C)reate, (R)ead, (U)pdate, and (D)elete capabilities. In fact, this process is so simple, you can implement CRUD for any types you wish, literally without coding.

Magic Auth

Magic Auth solves the problem of authenticating and authorising users. It uses BCrypt to hash your users’ passwords, and applies JWT token authorisation to your web APIs with a couple of lines of code. This allows you to simply drop in Magic Auth, for then to start applying [Authorize] attributes to your controller endpoints. It also of course allows your users to change their passwords, and such – But contain no additional “baggage” besides the bare minimums most web APIs require. This allows you to modify the existing User domain model, to apply any amount of customisations you wish. Email field, address fields and phone no fields for instance …?

Magic IO

Magic IO is the project that implements the use case we started out with; Handling files and folders on your server. It allows you to create folders, upload files, download files, and query and delete folders and files on your server as you see fit. It’s effectively a minimalistic implementation of the System.IO namespace from .Net Core. Not entirely finished at the point in time where I am writing this article, but I’ll probably wrap it up during a week or two, and create a release for it.

Magic Email

Magic Email gives you a webmail backend API, allowing you to implement your own version of Gmail if you wish. It features the ability to create POP3 accounts, and then have the system automatically and periodically poll your POP3 server(s) to see if any new emails have arrived. In addition it allows you to easily send rich emails, using MimeKit and MailKit instead of the builtin SmtpServer from .Net Core, which I am sorry to say, never seem to be powerful enough in functionality for my own personal use cases.

Interested in seeing how I can help your own software development efforts? Feel free to use the contact form below.


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.