π 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.
Update a Post βοΈ
Automatically pre-fills previous content for quick editing.
Error Handling β οΈ
Robust validation and user-friendly error messages.
π Advanced Search Capabilities
ID-Based Search π’
Retrieve posts using a unique identifier.
Similarity-Based Search π§
Find posts based on content relevance.
Paginated Fetching π
Optimizes performance by fetching posts in batches.
π οΈ 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! π
Top comments (0)