A forex trading journal application with a SvelteKit frontend and Go backend.
- 📊 Real-time trading analytics and metrics
- 💰 Account balance tracking with deposits/withdrawals
- 📈 Trade management with P/L calculations
- 🎯 Strategy tracking and assignment
- 🌙 Dark terminal-inspired UI
- 🔐 JWT authentication
.
├── web/ # SvelteKit frontend
├── cmd/api/ # Application entry point
├── internal/
│ ├── domain/ # Domain layer (business logic)
│ │ └── user/ # User domain
│ │ ├── entity.go # User entity
│ │ └── repository.go # Repository interface
│ ├── application/ # Application layer (use cases)
│ │ └── auth/ # Authentication use cases
│ │ ├── dto.go # Data transfer objects
│ │ └── service.go # Authentication service
│ ├── infrastructure/ # Infrastructure layer
│ │ ├── persistence/ # Database implementations
│ │ │ └── user_repository.go # User repository implementation
│ │ ├── security/ # Security implementations
│ │ │ └── jwt.go # JWT token generator
│ │ └── http/ # HTTP layer
│ │ ├── handlers/ # HTTP handlers
│ │ │ └── auth_handler.go
│ │ └── middleware/ # HTTP middleware
│ │ └── auth.go
│ └── db/ # Generated sqlc code
├── db/
│ ├── migrations/ # Database migrations (dbmate)
│ └── queries/ # SQL queries (sqlc)
└── .env # Environment variables
This project follows Domain-Driven Design (DDD) principles:
- Domain Layer: Contains business entities and repository interfaces (independent of frameworks)
- Application Layer: Contains use cases and business logic orchestration
- Infrastructure Layer: Contains concrete implementations (database, HTTP, security)
- Presentation Layer: HTTP handlers that translate between HTTP and application layer
- Go 1.24+
- Node.js 18+
- PostgreSQL
- dbmate (database migrations):
brew install dbmateor see dbmate docs - sqlc (SQL code generation):
brew install sqlcor see sqlc docs
Copy .env.example to .env and update the values:
cp .env.example .envOption A: Using Docker (Recommended for Development)
Start PostgreSQL using Docker Compose:
make docker-upRun migrations:
make migrate-upStop the database when done:
make docker-downView logs:
make docker-logsOption B: Using Local PostgreSQL
Create the PostgreSQL database:
createdb trade_journalRun migrations:
make migrate-upmake runThe API will be available at http://localhost:8080
cd web
cp .env.example .envnpm install
npm run devThe frontend will be available at http://localhost:5173
Deploy the entire stack with one command:
./deploy.shOr manually:
docker-compose up -dAccess the application:
- Frontend:
http://localhost:3000 - Backend API:
http://localhost:8080 - MinIO Console:
http://localhost:9001
See DOCKER.md for detailed Docker deployment instructions.
Terminal 1 - Database:
make docker-up
make migrate-upTerminal 2 - Backend:
make runTerminal 3 - Frontend:
cd web
npm run devThen visit:
- Frontend:
http://localhost:5173 - Backend API:
http://localhost:8080
- Echo v4 (Web framework)
- sqlc (Type-safe SQL)
- dbmate (Database migrations)
- PostgreSQL (Database)
- JWT (Authentication)
- SvelteKit
- TailwindCSS
- TypeScript
