DEV Community

Dsysd Dev
Dsysd Dev

Posted on

Building a Golang Project from Scratch — Zero to Hero — Part 2

In this part of the series, we will be designing the whole system which we will be coding in go in the future videos
dsysd dev

Youtube Link

https://www.youtube.com/watch?v=yiCXjacyOVU

Brief Explanation

We will have users interact with out system.

They will be saving their data in the postgres database which is the database we will be using in the backend.
Schema

Table blogs     (id, name, content, created_at, updated_at, deleted_at)
Table user       (id, username, created_at, updated_at, deleted_at)
Table tag         (id, name)
Table blog_user   (user_id, blog_id)
Table blog_tag   (blog_id, tag_id)
Enter fullscreen mode Exit fullscreen mode

The tables blog_user and blog_tag will be for keeping the relationships.

One user can have many blogs and one blog can have many tags

Architecture

The user will interact with the system. All data will be saved to postgres database.

The data will be synced to elasticsearch in the backend. This sync will take place at regular intervals.

The user will be able to search the data using keywords (which will be fetched from elasticsearch).

Elasticsearch is a highly available nosql database optimised for searching.

We cannot fire

select * from postgres_table where content like %VALUE%
Enter fullscreen mode Exit fullscreen mode

The query above is super costly especially if have 10s of 1000s of blogs.

Subscribe to my Youtube channel

Subscribe to my youtube channel if you are on the lookout for more such awesome content in video format.

https://www.youtube.com/@dsysd-dev

Follow me on twitter 🐥

Join me on Twitter for a daily dose of knowledge, fascinating trivia, and valuable insights. Let’s embark on a journey of continuous learning and discovery together! Follow me to stay inspired and informed. 🚀

https://twitter.com/dsysd_dev

Subscribe to my Newsletter

If you like my content, then consider subscribing to my free newsletter, to get exclusive, educational, technical, interesting and career related content directly delivered to your inbox

https://dsysd.beehiiv.com/subscribe

Important Links

Thanks for reading the post, be sure to follow the links below for even more awesome content in the future.

Twitter: https://twitter.com/dsysd_dev
Youtube: https://www.youtube.com/@dsysd-dev
Github: https://github.com/dsysd-dev
Medium: https://medium.com/@dsysd-dev
Email: dsysd.mail@gmail.com
Telegram 📚: https://t.me/dsysd_dev_channel
Linkedin: https://www.linkedin.com/in/dsysd-dev/
Newsletter: https://dsysd.beehiiv.com/subscribe
Gumroad: https://dsysd.gumroad.com/
Dev.to: https://dev.to/dsysd_dev/

Top comments (0)