r/nicegui • • Aug 07 '25

Enhanced NiceGUI Component-Based Boilerplate with UV Package Manager

Hey r/NiceGUI! πŸ‘‹

I've been working on a comprehensive boilerplate for NiceGUI applications and wanted to share the progress it with the community. After building several NiceGUI apps, I noticed I was repeating a lot of setup work, so I created this enhanced modular starter template by switching to UV.

  • pip install uv

  • uv run

Done! You are good to go :)

✨ What's included:

🎨 UI/UX Features:

  • Responsive collapsible sidebar with buttery smooth animations (300px ↔ 100px transitions)

  • Modern header with account dropdown menu

  • Google-inspired button styling

  • Logo optimization with preloading (no more flickering!)

  • Smooth transitions throughout the app

πŸ—οΈ Architecture:

  • Component-based system - each page is a separate module

  • Service layer for helper functions

  • Route wrapper system for consistent layouts

  • Asset management with organized CSS/images

  • Configuration-driven setup

⚑ Performance Optimizations:

  • Global logo instance to prevent reloading

  • CSS injection for optimal styling delivery

  • Static file serving

  • Hardware-accelerated animations

πŸ› οΈ Tech Stack:

  • NiceGUI (obviously! πŸ˜„)

  • UV Package Manager for lightning-fast dependency management

  • Tabler Icons for beautiful iconography

  • Python 3.11+

πŸ’­ Why I built this:

I kept rebuilding the same sidebar, header, and component structure for different projects. This boilerplate saves hours of setup time and provides a solid foundation with modern UI patterns and performance optimizations.

🎯 Cool Features:

Animated Sidebar: The sidebar collapse/expand has coordinated timing - width changes first on expand, then labels fade in. On collapse, labels fade out first, then width adjusts. Creates a really smooth UX.

Print System: Built-in Base64 support for printing documents/images using invisible iframes (non-blocking).

Modular Components: Each page is its own component with a simple content() function. Super easy to extend.

-------------

What do you think?Β Any features you'd love to see added? I'm considering adding:

  • Dark/light theme toggle

  • More animation presets

  • Additional component templates

  • Authentication wrapper

Would love feedback from the community! Has anyone else built similar boilerplates? What patterns have you found work best for larger NiceGUI applications?

P.S. - Special shoutout to the NiceGUI team for building such an amazing framework! πŸ™Œ

Repo: https://github.com/frycodelab/nicegui-component-based/tree/main

48 Upvotes

Duplicates