https://github.com/valpere/trytrago
API server for a multilanguage dictionary written in Golang.
https://github.com/valpere/trytrago
api-server caching cobra docker docker-compose gin golang gorm jwt openapi protobuf redis rest-api swagger testify uber-zap viper
Last synced: 29 days ago
JSON representation
API server for a multilanguage dictionary written in Golang.
- Host: GitHub
- URL: https://github.com/valpere/trytrago
- Owner: valpere
- License: apache-2.0
- Created: 2025-02-15T08:49:53.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2026-02-16T15:16:16.000Z (3 months ago)
- Last Synced: 2026-02-16T22:14:47.982Z (3 months ago)
- Topics: api-server, caching, cobra, docker, docker-compose, gin, golang, gorm, jwt, openapi, protobuf, redis, rest-api, swagger, testify, uber-zap, viper
- Language: Go
- Homepage:
- Size: 2.47 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Security: docs/SecurityEnhancementsSummary.md
Awesome Lists containing this project
README
# TryTraGo
[](https://goreportcard.com/report/github.com/valpere/trytrago)
[](https://go.dev/)
[](LICENSE)
TryTraGo is a high-performance multilanguage dictionary server designed to support approximately 60 million dictionary entries with robust API functionality, social features, and multi-database support.
## Features
- **Comprehensive Dictionary Functionality**
- Dictionary entries with meanings and translations
- Support for multiple word types (words, compound words, phrases)
- Pronunciation information
- **Social Features**
- Comments on meanings and translations
- Like/unlike functionality
- User profiles and contributions tracking
- **Clean Architecture**
- Domain-driven design with clear separation of concerns
- Four-layer architecture (domain, application, interface, infrastructure)
- Highly testable and maintainable codebase
- **Multi-Database Support**
- PostgreSQL (primary for production)
- MySQL (alternative)
- SQLite (development and testing)
- **Technology Stack**
- Go 1.24+
- Gin web framework
- GORM for database access
- JWT authentication
- Uber-zap for structured logging
- Redis for caching
## Quick Start
### Prerequisites
- Go 1.24 or higher
- Docker and Docker Compose (for local development)
- PostgreSQL, MySQL, or SQLite
### Installation
1. Clone the repository
```bash
git clone https://github.com/valpere/trytrago.git
cd trytrago
```
2. Install dependencies
```bash
make setup
```
3. Build the application
```bash
make build
```
4. Run database migrations
```bash
make db-init
```
5. Start the server
```bash
make run
```
### Docker
Run using Docker:
```bash
make docker-run
```
Or with Docker Compose:
```bash
make docker-compose-up
```
## API Usage
TryTraGo provides a RESTful API for all dictionary operations. You can view the API documentation at:
- Swagger UI: `http://localhost:8080/swagger-ui.html`
- OpenAPI Specification: `http://localhost:8080/v3/api-docs`
### Authentication
```bash
# Register a new user
curl -X POST http://localhost:8080/api/v1/auth/register \
-H "Content-Type: application/json" \
-d '{"username":"testuser","email":"test@example.com","password":"password123"}'
# Login and get a token
curl -X POST http://localhost:8080/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{"username":"testuser","password":"password123"}'
```
### Dictionary Operations
```bash
# List entries
curl http://localhost:8080/api/v1/entries
# Create a new entry (requires authentication)
curl -X POST http://localhost:8080/api/v1/entries \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"word":"example","type":"WORD","pronunciation":"ɪɡˈzæmpəl"}'
```
## Development
### Project Structure
```
trytrago/
├── application/ # Application services and DTOs
├── cmd/ # CLI commands
├── docker/ # Docker configuration
├── docs/ # Documentation
├── domain/ # Core business entities and interfaces
├── infrastructure/ # External details implementations
├── interface/ # HTTP handlers and middleware
├── migrations/ # Database migration files
├── scripts/ # Utility scripts
├── test/ # Test suites
└── main.go # Application entry point
```
### Make Commands
```bash
# Development workflow
make setup # Install development dependencies
make build # Build the application
make run # Run the application
make test # Run unit tests
make test-all # Run all tests (unit, integration, API)
make lint # Run linter
# Database operations
make migrate # Run migrations
make db-init # Initialize database
make db-reset # Reset database
make migration-create # Create new migration files
# Docker
make docker-build # Build Docker image
make docker-run # Run Docker container
# Documentation
make docs # Generate API documentation
```
## Configuration
TryTraGo uses a YAML configuration file. You can specify the configuration file location using the `--config` flag:
```bash
./build/trytrago server --config=/path/to/config.yaml
```
Example configuration:
```yaml
server:
port: 8080
timeout: 30s
database:
type: postgres
host: localhost
port: 5432
name: trytrago
user: postgres
password: postgres
logging:
level: info
format: json
```
## Deployment
For detailed deployment instructions, please refer to [README_DEPLOY.md](docs/README_DEPLOY.md).
## License
This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.
## Weaknesses
Identified Weaknesses and Improvement Opportunities: [Code Analysis: TryTraGo Dictionary Server](docs/WEAKNESSES.md).