A production-ready task management REST API built as Week 3 of my 8-week coding journey. Demonstrates advanced Go architecture, goroutines, real-time email notifications, and scalable backend design.
- Advanced Go architecture with clean separation of concerns and industry-standard project structure
- Complete CRUD operations for Projects and Tasks with sophisticated filtering and relationships
- Async email notifications using goroutines for non-blocking background processing
- Production-grade security with JWT authentication, input validation, and data integrity protection
- Interactive API documentation with Swagger/OpenAPI for seamless developer experience
| Category | Technology | Purpose |
|---|---|---|
| Backend | Go 1.24.5 + Gin Framework | High-performance HTTP server |
| Database | PostgreSQL + GORM | Relational database with ORM |
| Authentication | JWT + bcrypt | Secure token-based authentication |
| SMTP + Gmail | Real-time email notifications | |
| Documentation | Swagger/OpenAPI | Interactive API documentation |
| Deployment | Railway + Neon | Cloud hosting with managed database |
cmd/server/ # Application entry point
internal/
βββ handlers/ # HTTP request handlers
βββ middleware/ # Authentication & validation middleware
βββ models/ # Database models with GORM
βββ services/ # Business logic & email service
βββ database/ # Database connection & configuration
βββ utils/ # Shared utilities
docs/ # Auto-generated Swagger documentation
users: id, name, email, password_hash, role, timestamps
projects: id, name, description, owner_id, timestamps (soft delete)
tasks: id, title, description, project_id, assignee_id, creator_id,
status, priority, estimate, due_date, timestamps (soft delete)- Async processing with goroutines for instant API responses
- Beautiful HTML templates with responsive design and priority color coding
- Change tracking showing detailed before/after values
- SMTP integration with Gmail for reliable delivery
- User registration with password hashing and validation
- JWT-based login with secure token generation
- Profile management with duplicate email prevention
- Protected routes with middleware authentication
- Complete CRUD operations with ownership validation
- Duplicate prevention ensuring unique project names per user
- Cascading delete protection preventing data loss
- Owner relationship with automatic assignment
- Rich task model with status, priority, estimate, and due dates
- Project relationships with transfer capabilities between owned projects
- Advanced filtering by project, status, priority, estimate, and date ranges
- Enum validation with clear error messages for invalid values
- Change tracking for email notifications
POST /auth/register # User registration
POST /auth/login # User login
GET /users/me # Get current user profile
PUT /users/me # Update user profile
POST /projects # Create new project
GET /projects # List user's projects
GET /projects/:id # Get project details with task count
PUT /projects/:id # Update project information
DELETE /projects/:id # Delete project (only if no tasks exist)
POST /tasks # Create new task with email notification
GET /tasks # List tasks with advanced filtering
GET /tasks/:id # Get detailed task information
PUT /tasks/:id # Update task with change notifications
DELETE /tasks/:id # Delete task
GET /tasks?project_id=1&status=In%20Progress&priority=High&estimate=L&due_date_from=2025-07-25&due_date_to=2025-07-31
- Go 1.24.5+
- PostgreSQL database (or Neon account)
- Gmail account with App Password for email notifications
# Clone the repository
git clone https://github.com/P4rz1val22/task-management-api.git
cd task-management-api
# Install dependencies
go mod download
# Set up environment variables
cp .env.example .env
# Edit .env with your credentials
# Run database migrations
go run cmd/server/main.go
# Generate Swagger documentation
go run github.com/swaggo/swag/cmd/swag@latest init -g cmd/server/main.go
# Start development server
go run cmd/server/main.go# Database Configuration
DATABASE_URL=your_postgresql_connection_string
# JWT Configuration
JWT_SECRET=your_secure_jwt_secret_key
# Email Configuration (Optional)
SMTP_USERNAME=your-gmail@gmail.com
SMTP_PASSWORD=your-gmail-app-password
# Server Configuration
GIN_MODE=debug
PORT=8080- Enable 2-Factor Authentication on your Gmail account
- Generate App Password:
- Go to myaccount.google.com/apppasswords
- Select "Mail" β Generate β Copy 16-character password
- Set environment variables with your Gmail and app password
- Goroutines mastery: Non-blocking email processing with async patterns
- Production security: JWT authentication, input validation, and SQL injection prevention
- Data integrity: Cascading delete protection and ownership validation
- Developer experience: Interactive Swagger documentation with authentication support
- Email reliability: SMTP integration with error handling and retry logic
- Advanced filtering: Complex query building with multiple filter combinations
- Password hashing with bcrypt for secure storage
- JWT tokens with configurable expiration and secure signing
- Input validation with comprehensive error messages
- SQL injection prevention through GORM's parameterized queries
- Ownership validation ensuring users can only access their own data
Live interactive documentation available at: https://task-management-api-production-0512.up.railway.app/swagger/index.html
MIT License - see the LICENSE file for details.
Built with β€οΈ by Luis | Part of 8-Week Coding Journey | Week 3: Advanced Backend Development