Secure Data Storage API

underscoreanuj profile image Anuj Singh ・3 min read


This is one of the few projects close to my heart, probably because I've written it from scratch. It showcases the use of IPFS as a secure & scalable persistence module for a data service exposed as an easy to use REST API, built using django.

The API can be harnessed to efficiently store data in desired order. I used this API to store medical records of patients in a secure and chronological manner.


I decided that every event in someone's medical history can be grouped into episodes each of which may contain multiple encounters with a lab/pharmacy/doctor/.. etc, also a person can have multiple episodes running simultaneously (you can have a broken hand and fall sick of the flu sometimes, assuming the worst case scenario).

Now, all we need is a simple mechanism which allows us to use the current episode to track the next episode which subsequently allows us to track the next episode and so on.

This is done by using hashes (think of a linked list) which are generated by the IPFS client as a response of any data that gets successfully added. These hashes can be used to fetch the data from IPFS.

IPFS storage order

While I was working on the back-end, my other teammate designed a great front-end which allowed us to transform the API calls into a user-friendly application which followed the following activity diagram.

activity flow

Demo Link

This dropbox link contains the detailed demo and explanation of the project.
I created the back-end and my friend created the front-end. It also has an explanation of the architecture and other features in detail.

Link to Code

How I built it

I used django to create the REST API and ipfs client library for python.
The major challenges I faced while making the project was creating a link between django and the IPFS daemon and ensuring that the data is pushed and retrieved in the appropriate order, also writing a REST API in django requires you to write serializers which helps in making the class objects and json data inter-convertible, and since I was using a group of interconnected classes with inheritance writing the serializers such that they would be generic enough was a painstaking task. I learnt a lot about how serailization and deserialization of a class based object works and why is it important.

Additional Thoughts

Once the API was ready I sat down with my teammate who created the front-end and we helped each other in merging the two so that the entire project worked seamlessly. All this while our other two teammates were working hard to work up a good paper on the project which we could present. All in all it was a great experience making this project and working alongside my team.

Why I'm proud of it

This project was shortlisted in top 10 projects out of 1400+ projects for a hackathon organized by hackerearth.

Thanks to github's student developer pack for providing a free subscription to the following:

  1. PyCharm Pro (a great IDE with great support for django)
  2. Heroku (which we used to deploy the project upon, the free hobby dyno is very helpful)
  3. Github (makes working in teams an easy and fun task).


markdown guide