Tracks is a GTD™ web application, built with Ruby on Rails https://www.getontracks.org/
Find a file
Claude f0eb4bdef5
Rewrite Tracks application in Golang
This commit introduces a complete rewrite of the Tracks GTD application
in Go (Golang), providing a modern, performant alternative to the Ruby
on Rails implementation.

## Architecture & Technology Stack

- Language: Go 1.21+
- Web Framework: Gin
- ORM: GORM with SQLite/MySQL/PostgreSQL support
- Authentication: JWT with bcrypt password hashing
- Clean Architecture: Separated models, services, handlers, and middleware

## Implemented Features

### Core Models
- User: Authentication and user management
- Context: GTD contexts (@home, @work, etc.)
- Project: Project grouping and tracking
- Todo: Task management with state machine (active, completed, deferred, pending)
- Tag: Flexible tagging system with polymorphic associations
- Dependency: Todo dependencies with circular dependency detection
- Preference: User preferences and settings
- Note: Project notes
- Attachment: File attachment support (model only)
- RecurringTodo: Recurring task template (model only)

### API Endpoints

**Authentication:**
- POST /api/auth/login - User login
- POST /api/auth/register - User registration
- POST /api/auth/logout - User logout
- GET /api/me - Get current user

**Todos:**
- GET /api/todos - List todos with filtering
- POST /api/todos - Create todo
- GET /api/todos/:id - Get todo details
- PUT /api/todos/:id - Update todo
- DELETE /api/todos/:id - Delete todo
- POST /api/todos/:id/complete - Mark as completed
- POST /api/todos/:id/activate - Mark as active
- POST /api/todos/:id/defer - Defer to future date
- POST /api/todos/:id/dependencies - Add dependency
- DELETE /api/todos/:id/dependencies/:successor_id - Remove dependency

**Projects:**
- GET /api/projects - List projects
- POST /api/projects - Create project
- GET /api/projects/:id - Get project details
- PUT /api/projects/:id - Update project
- DELETE /api/projects/:id - Delete project
- POST /api/projects/:id/complete - Complete project
- POST /api/projects/:id/activate - Activate project
- POST /api/projects/:id/hide - Hide project
- POST /api/projects/:id/review - Mark as reviewed
- GET /api/projects/:id/stats - Get project statistics

**Contexts:**
- GET /api/contexts - List contexts
- POST /api/contexts - Create context
- GET /api/contexts/:id - Get context details
- PUT /api/contexts/:id - Update context
- DELETE /api/contexts/:id - Delete context
- POST /api/contexts/:id/hide - Hide context
- POST /api/contexts/:id/activate - Activate context
- POST /api/contexts/:id/close - Close context
- GET /api/contexts/:id/stats - Get context statistics

### Business Logic

**Todo State Management:**
- Active: Ready to work on
- Completed: Finished tasks
- Deferred: Future actions (show_from date)
- Pending: Blocked by dependencies

**Dependency Management:**
- Create blocking relationships between todos
- Automatic state transitions when blocking todos complete
- Circular dependency detection
- Automatic unblocking when prerequisites complete

**Tag System:**
- Polymorphic tagging for todos and recurring todos
- Automatic tag creation on first use
- Tag cloud support

**Project & Context Tracking:**
- State management (active, hidden, closed/completed)
- Statistics and health indicators
- Review tracking for projects

### Infrastructure

**Configuration:**
- Environment-based configuration
- Support for SQLite, MySQL, and PostgreSQL
- Configurable JWT secrets and token expiry
- Flexible server settings

**Database:**
- GORM for ORM
- Automatic migrations
- Connection pooling
- Multi-database support

**Authentication & Security:**
- JWT-based authentication
- Bcrypt password hashing
- Secure cookie support
- Token refresh mechanism

**Docker Support:**
- Multi-stage Dockerfile for optimized builds
- Docker Compose with PostgreSQL
- Volume mounting for data persistence
- Production-ready configuration

## Project Structure

```
cmd/tracks/              # Application entry point
internal/
  config/               # Configuration management
  database/             # Database setup and migrations
  handlers/             # HTTP request handlers
  middleware/           # Authentication middleware
  models/              # Database models
  services/            # Business logic layer
```

## Documentation

- README_GOLANG.md: Comprehensive documentation
- .env.example: Configuration template
- API documentation included in README
- Code comments for complex logic

## Future Work

The following features from the original Rails app are not yet implemented:
- Recurring todo instantiation logic
- Email integration (Mailgun/CloudMailin)
- Advanced statistics and analytics
- Import/Export functionality (CSV, YAML, XML)
- File upload handling for attachments
- Mobile views
- RSS/Atom feeds
- iCalendar export

## Benefits Over Rails Version

- Performance: Compiled binary, lower resource usage
- Deployment: Single binary, no runtime dependencies
- Type Safety: Compile-time type checking
- Concurrency: Better handling of concurrent requests
- Memory: Lower memory footprint
- Portability: Easy cross-platform compilation

## Testing

The code structure supports testing, though tests are not yet implemented.
Future work includes adding unit and integration tests.
2025-11-05 10:46:59 +00:00
.github Dependabot Ruby version 2025-06-29 14:51:18 +03:00
app Add Traditional Chinese (Taiwan) localization support 2025-09-05 16:19:23 +08:00
bin Change to a new JS preprocessor, change from MySQL to MariaDB and fix polling 2025-06-29 21:27:27 +03:00
cmd/tracks Rewrite Tracks application in Golang 2025-11-05 10:46:59 +00:00
config Add Traditional Chinese (Taiwan) localization support 2025-09-05 16:19:23 +08:00
db Update schema.rb for Postgres support 2024-07-19 14:00:19 +03:00
doc Release 2.7.1 2024-07-25 23:54:52 +03:00
internal Rewrite Tracks application in Golang 2025-11-05 10:46:59 +00:00
lib Upgrade to RoR 7.0 2025-06-28 16:25:52 +03:00
log update gitignore rules to match rails 3.2.8 defaults 2012-09-27 10:37:36 -04:00
public Error message fixes for CSV import. Add the necessary directory to Docker image. 2022-02-09 11:28:05 +02:00
script Change to a new JS preprocessor, change from MySQL to MariaDB and fix polling 2025-06-29 21:27:27 +03:00
test Update the date formatting syntax 2025-06-29 13:25:14 +03:00
test-envs Use MariaDB instead of MySQL also in tests 2025-06-30 00:49:34 +03:00
vendor/assets Drop vendored SWFObject. Included in swf_fu. 2017-02-12 15:16:05 -05:00
.codeclimate.yml Rubocop still doesn't support Ruby > 2.5, so let's disable that. 2024-06-06 00:31:07 +03:00
.dockerignore Replace the version-specific Dockerfiles with one staged Dockerfile 2024-07-18 21:09:04 +03:00
.env.example Rewrite Tracks application in Golang 2025-11-05 10:46:59 +00:00
.gitignore Rewrite Tracks application in Golang 2025-11-05 10:46:59 +00:00
.rubocop.yml Relax the Rubocop limits a bit to make CodeClimate more useful 2022-02-22 23:23:14 +02:00
.ruby-version Dependabot Ruby version 2025-06-29 14:51:18 +03:00
.yardopts Yardoc - show private and protected methods in api doc 2011-10-24 21:40:18 +02:00
config.ru Revert to stock config.ru 2015-03-08 20:50:27 -04:00
CONTRIBUTING.md Document coding style and adding tests 2022-09-07 15:09:41 +03:00
COPYING Add GPLv2 license text 2013-01-26 12:59:25 -05:00
docker-compose.yml Rewrite Tracks application in Golang 2025-11-05 10:46:59 +00:00
docker-entrypoint.sh Hopefully the final fixes based on fresh installs with both Docker install methods 2020-07-20 00:58:45 +03:00
Dockerfile Rewrite Tracks application in Golang 2025-11-05 10:46:59 +00:00
Gemfile Bump rubocop from 1.78.0 to 1.81.1 2025-09-29 00:01:45 +00:00
Gemfile.lock Bump rubocop from 1.81.6 to 1.81.7 2025-11-03 00:01:34 +00:00
go.mod Rewrite Tracks application in Golang 2025-11-05 10:46:59 +00:00
mkdocs.yml Specify pages for MkDocs 2014-10-02 11:15:13 -04:00
Rakefile Bring a few details in line with Rails 4.1 2014-06-19 12:33:38 -04:00
README.md Remove the IRC channel for now 2024-07-25 23:59:05 +03:00
README_GOLANG.md Rewrite Tracks application in Golang 2025-11-05 10:46:59 +00:00
SECURITY.md Merge pull request #2491 from TracksApp/release_2.5.1 2020-09-24 13:03:55 +03:00

Tracks: a GTD™ compatible web application built with Ruby on Rails

Build Status Code Climate Translation status CII Best Practices

About

Full instructions for both new installations and upgrades from older installations of Tracks can be found in the wiki.

As always, make sure that you take sensible precautions and back up all your data frequently, taking particular care when you are upgrading.

Enjoy being productive!

Contributors and consulting

If you are thinking about contributing towards the development of Tracks, please read /CONTRIBUTING.md for general information. Also you can find some information on development, testing and contributing on the wiki.