๐Ÿ‘‹ Hey Dev Community!

Let me introduce you all to my latest project: Pblog! ๐ŸŽ‰

Pblog is a Dockerized terminal-based user interface (TUI) blogging application designed to make blog management seamless. It allows users to create, read, update, and delete posts efficiently while supporting similarity-based search and paginated fetching for optimized performance and to prevent database overload.


๐Ÿค” Why This Project?

I started this project as a way to learn Docker and how to integrate a database into a backend. Through this journey, I discovered how a database like PostgreSQL communicates with another container over the same network, and it was a game-changer! ๐Ÿš€


โœจ Features

๐Ÿ“ CRUD Operations โ€“ Manage Your Blog with Ease

Pblog provides an intuitive way to handle blog posts with confirmation prompts and error handling.

  • Create a Post ๐Ÿ“

    Effortlessly add new blog entries.

    Post Creation Screenshot

  • Read a Post ๐Ÿ“–

    View detailed content with ease.

    Post Content Screenshot

  • Update a Post โœ๏ธ

    Automatically pre-fills previous content for quick editing.

    Post Update Screenshot

  • CRUD with Confirmation โœ…

    A confirmation of work done.

    Confirmation Screenshot

  • Error Handling โš ๏ธ

    Robust validation and user-friendly error messages.

    Error Handling Screenshot


๐Ÿ” Advanced Search Capabilities

  • ID-Based Search ๐Ÿ”ข

    Retrieve posts using a unique identifier.

    ID Search Screenshot

  • Similarity-Based Search ๐Ÿง

    Find posts based on content relevance.

    Choice Screenshot

  • Paginated Fetching ๐Ÿ“Œ

    Optimizes performance by fetching posts in batches.

    Title Search Screenshot


๐Ÿ› ๏ธ Technical Details

Pblog is built using:

  • Docker ๐Ÿณ โ€“ For containerization and environment consistency.
  • Go ๐Ÿš€ โ€“ Chosen for its concurrency, performance, and simplicity in backend development.
  • PostgreSQL ๐Ÿ›ข๏ธ โ€“ Reliable, scalable, and feature-rich database.
  • GORM ๐Ÿ”Œ โ€“ An ORM that simplifies database interactions.
  • tview ๐ŸŽจ โ€“ A powerful library for building TUI applications in Go.

โšก Challenges Faced & Solutions

1๏ธโƒฃ Switching Focus in TUI ๐Ÿ–ฅ๏ธ

Problem: Initially, I struggled to shift focus between different sections of the TUI.
Solution: Using tview.Pages, I was able to split the TUI into different sections and switch between them dynamically.

2๏ธโƒฃ Docker Compose Database Integration ๐Ÿณ๐Ÿ”—

Problem: The app couldn't communicate with the PostgreSQL database container.
Solution: The issue was that the app sometimes started before the database was fully ready. Adding depends_on in docker-compose.yml ensured the database initialized before the app started.

3๏ธโƒฃ Terminal Capture Issue โŒจ๏ธ

Problem: The database logs occupied the terminal, preventing the app from displaying the TUI.
Solution: Running the compose setup in detached mode (-d) and then using docker attach on the app container ensured the TUI appeared correctly.


๐Ÿš€ What's Next?

๐Ÿ” Search Filtering โ€“ Filter results through categories.

๐Ÿ” Authentication โ€“ Implement login and write permissions.

๐Ÿท๏ธ User Preferences โ€“ Recommend posts based on tags.

๐Ÿ’ฐ Payment Gateway โ€“ Enable monetization options.

๐Ÿ—๏ธ PostgreSQL Deployment โ€“ Deploy on a public server for worldwide sharing.


๐ŸŽ‰ Conclusion

Thanks for making it this far! ๐Ÿ™Œ This journey was incredibly rewarding as I went from knowing very little about Docker and database integration to building a fully functional application. If you find this project useful, check it out on GitHub and feel free to contribute! ๐Ÿš€

๐Ÿ‘‰ GitHub Repo

Happy coding! ๐Ÿ˜ƒ