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?

Start a personal dev blog on your domain for free and grow your readership.

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

Comments (6)

j's photo

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.

Show +3 replies
j's photo

Ankit Singh tbh I would have to research that all myself as well, I've just wrote the first ideas that came to mind and my experiences, sorry :)

Ankit Singh's photo

Thanks anyway. Got some directions at least. 馃槂