Skip to content

Repository files navigation

Task Hub

CI/CD Pipeline Dependencies Performance Go Report Card Coverage

A modern task management application with both web and desktop interfaces built with Go, PostgreSQL, and NATS messaging.

πŸš€ Features

  • Dual Interface: Web application and native desktop app
  • Modern UI: Clean, responsive design with Fyne desktop framework
  • Real-time Updates: NATS-powered messaging for instant sync
  • Secure Authentication: JWT-based authentication system
  • Task Management: Create, update, and organize tasks
  • Docker Support: Full containerization for easy deployment
  • Database: PostgreSQL for reliable data storage

πŸ“‹ Prerequisites

  • Go: 1.24 or higher
  • PostgreSQL: 16 or higher
  • NATS Server: 2.9 or higher
  • Docker: 20.10 or higher (for containerized deployment)
  • Task: Task runner for development tasks

πŸ› οΈ Quick Start

Using Task Runner (Recommended)

# Install Task (if not already installed)
go install github.com/go-task/task/v3/cmd/task@latest

# Clone and set up
git clone <repository-url>
cd task-hub

# Create environment file (required)
cat > .env << EOF
PORT=8080
NATS_URL=nats://localhost:4222
JWT_SECRET=your_jwt_secret_key_at_least_32_characters
DB_HOST=localhost
DB_PORT=5432
DB_USER=taskhub
DB_PASSWORD=dev_password
DB_NAME=taskhub
EOF

# Start development services (PostgreSQL + NATS)
task run

# Run web version locally
task run-web

# Run desktop version locally
task run-desktop

Using Docker

# Start all services with Docker Compose
task run

# Or directly with docker-compose
docker compose up -d

Manual Setup

# Install dependencies
go mod download

# Start PostgreSQL and NATS
docker run --name taskhub-postgres -e POSTGRES_USER=taskhub -e POSTGRES_PASSWORD=dev_password -e POSTGRES_DB=taskhub -p 5432:5432 -d postgres:16-alpine
docker run --name taskhub-nats -p 4222:4222 -d nats:2.9-alpine

# Run web application
go run cmd/main.go

# Run desktop application
go run cmd/desktop/main.go

πŸ“ Project Structure

task-hub/
β”œβ”€β”€ cmd/                    # Application entry points
β”‚   β”œβ”€β”€ main.go            # Web application
β”‚   └── desktop/           # Desktop application
β”‚       └── main.go        # Desktop app entry point
β”œβ”€β”€ internal/              # Private application code
β”‚   β”œβ”€β”€ app/               # Application services (auth, tasks, etc.)
β”‚   β”œβ”€β”€ desktop/           # Desktop UI components and themes
β”‚   β”œβ”€β”€ domains/           # Domain models and business logic
β”‚   β”œβ”€β”€ gateway/           # External service integration
β”‚   └── handler/           # HTTP handlers
β”œβ”€β”€ pkg/                   # Public library code
β”‚   β”œβ”€β”€ base/entity/       # Base entity types
β”‚   β”œβ”€β”€ db/                # Database configuration
β”‚   β”œβ”€β”€ logger/            # Logging utilities
β”‚   β”œβ”€β”€ middleware/        # HTTP middleware
β”‚   β”œβ”€β”€ nats/              # NATS messaging
β”‚   └── utils/             # Utility functions
β”œβ”€β”€ web/                   # Web assets
β”‚   β”œβ”€β”€ static/            # CSS, JS, images
β”‚   └── templates/         # HTML templates
β”œβ”€β”€ config/                # Configuration management
β”œβ”€β”€ docs/                  # Documentation
β”œβ”€β”€ Taskfile.yml           # Task runner configuration
β”œβ”€β”€ docker-compose.yml     # Docker services
β”œβ”€β”€ Dockerfile             # Web app container
└── README.md

🎨 UI Components

Web Interface

  • Built with standard Go net/http and html/template
  • HTMX for dynamic interactions
  • Responsive CSS design
  • RESTful API endpoints

Desktop Interface

  • Built with Fyne cross-platform framework
  • Modern Material Design-inspired theme
  • Native desktop experience
  • Same backend services as web version

πŸ”§ Available Tasks

The project uses Task for development automation. Available commands:

# Build and deployment
task build                # Build web Docker image
task build-desktop        # Build desktop Docker image

# Running applications
task run                  # Run web version with Docker
task run-web              # Run web version locally
task run-desktop          # Run desktop version locally

# Docker management
task down                 # Stop all services
task clean                # Clean Docker images, volumes, containers

🌐 API Endpoints

Authentication

  • POST /api/auth/login - User login
  • POST /api/auth/register - User registration

Tasks

  • GET /api/tasks - List user tasks
  • POST /api/tasks - Create new task
  • PUT /api/tasks/{id} - Update task
  • DELETE /api/tasks/{id} - Delete task

Web Pages

  • GET / - Dashboard (authenticated)
  • GET /login - Login page
  • GET /register - Registration page

πŸ” Configuration

Create a .env file in the project root:

# Server
PORT=8080

# Database
DB_HOST=localhost
DB_PORT=5432
DB_USER=taskhub
DB_PASSWORD=your_password
DB_NAME=taskhub

# Authentication
JWT_SECRET=your_jwt_secret_key_at_least_32_characters

# NATS
NATS_URL=nats://localhost:4222

πŸ§ͺ Testing

# Run all tests
go test ./...

# Run tests with coverage
go test -cover ./...

# Run tests with race detection
go test -race ./...

πŸ“± Desktop UI Features

The desktop application includes:

  • Modern Theme: Indigo-based color scheme with proper contrast
  • Enhanced Forms: Better layout, icons, and placeholders
  • Responsive Design: Proper window sizing and scaling
  • Professional Layout: Card-based components with visual hierarchy
  • Native Experience: Platform-specific optimizations

πŸš€ Deployment

Production Docker

# Build production images
docker build -t task-hub:latest .
docker build -f Dockerfile.desktop -t task-hub-desktop:latest .

# Deploy with Docker Compose
docker compose -f docker-compose.yml up -d

Development

# Start development environment
task run

# Run desktop app (native)
task run-desktop

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Run tests and ensure they pass
  6. Submit a pull request

πŸ“š Documentation

πŸ› Troubleshooting

Common Issues

  1. Desktop app won't start on Mac M3/M4

    • The desktop app runs natively (not in Docker) on Mac for proper GUI support
    • Use task run-desktop which starts services in Docker but runs the app natively
  2. Database connection errors

    • Ensure PostgreSQL is running: docker ps | grep postgres
    • Check .env configuration matches database settings
  3. NATS connection issues

    • Verify NATS is running: docker ps | grep nats
    • Check NATS URL configuration

For more troubleshooting, see the Development Guide.

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


Task Hub - Modern task management for teams and individuals.

About

WIP

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages