How do online code editors store code files?
What types of storage techniques are used? What is stored in database and what is stored on file system? How to store and retrieve the correct syntax format?
3.4K+ developers have started their personal blogs on Hashnode in the last one month.
Write in Markdown · Publish articles on custom domain · Gain readership on day zero · Automatic GitHub backup and more
well this is a taste question. since the only thing you actually need to do is store the right encoding and plaintext.
just to avoid side effects like wrong escaping or inline html tags and such. I personally would store them in a file system and use git for versioning, but it depends if you want concurrent editing or even shared editing than it gets more complex if two dev simultaniously write on the same file synced by a websocket.
At this momenet a p2p network would make sense and you would need in memory versions maybe with update queues / vectors that can be merged and compared.
It gets tricky..... but in the end .... it's about scale and intention that's how you pick the storage system.
For the syntax I would use a drop-down so the person could select his language and I would map the extension of the saved file / the meta information of the file so it automatically gets selected the next time or on creation if possible.
There are a lot of design questions needed but as always .... start with what you know .... keep metrics .... decide accordingly .... scale accordingly.