DEV Community

Kaustubh
Kaustubh

Posted on

🚀 Introducing Pblog – A Dockerized TUI Blogging App

👋 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! 😃

Heroku

Built for developers, by developers.

Whether you're building a simple prototype or a business-critical product, Heroku's fully-managed platform gives you the simplest path to delivering apps quickly — using the tools and languages you already love!

Learn More

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

DEV shines when you're signed in, unlocking a customized experience with features like dark mode!

Okay