Skip to content

akfaiz/go-vue-starter-kit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Go-Vue Starter Kit

A full-stack starter kit built with Go and Vue 3, featuring a modern architecture with clean separation of concerns, authentication, and a responsive UI.

🌟 Demo

Check out the live demo: https://go-vue-starter-kit.fly.dev

OpenAPI Docs: https://go-vue-starter-kit.fly.dev/docs

πŸš€ Features

Backend (Go)

  • Clean Architecture with dependency injection using Uber FX
  • RESTful API with Echo framework
  • JWT Authentication with access and refresh tokens
  • Database Migrations with custom migration tool
  • Email Service with SMTP support
  • Internationalization (i18n) support
  • Request Validation with custom validators
  • Structured Logging with configurable levels
  • Health Check endpoints
  • OpenAPI Documentation support

Frontend (Vue 3)

  • Vue 3 with Composition API
  • TypeScript for type safety
  • Vite for fast development and building
  • Vue Router for navigation
  • Pinia for state management
  • Vuetify for UI components
  • Responsive Design with modern layouts
  • Authentication Flow with token management
  • Error Handling with user-friendly messages

DevOps & Deployment

  • Docker support with multi-stage builds
  • Docker Compose for local development
  • Makefile for common development tasks
  • Hot Reload for development

πŸ“‹ Prerequisites

  • Go 1.25+
  • Node.js 22+
  • PNPM (for frontend dependencies)
  • PostgreSQL
  • Docker (optional)

πŸ› οΈ Installation

1. Clone the repository

git clone https://github.com/akfaiz/go-vue-starter-kit.git
cd go-vue-starter-kit

2. Environment Configuration

Copy the environment file and configure your settings:

cp .env.example .env

Update the .env file with your configuration, especially database and SMTP settings.

3. Database Setup

Create a PostgreSQL database and run migrations:

# Install Go dependencies
go mod tidy

# Run database migrations
go run . migrate up

4. Frontend Setup

# Navigate to UI directory
cd ui

# Install dependencies
pnpm install

# Build frontend assets
pnpm build

# Return to root directory
cd ..

πŸš€ Development

Using Makefile (Recommended)

# Install frontend dependencies
make web-install

# Build frontend
make web-build

# Build backend with embedded frontend
make build-embed

# Run in production mode
make run

Manual Commands

Backend Development

# Run server in development mode
DEV=1 go run . serve

# Run database migrations
go run . migrate up

Frontend Development

cd ui

# Start development server
pnpm dev

# Build for production
pnpm build

# Preview production build
pnpm preview

🐳 Docker Development

Using Docker Compose

# Start all services
docker-compose up

# Start in detached mode
docker-compose up -d

# View logs
docker-compose logs -f

# Stop services
docker-compose down

Building Docker Image

# Build the image
docker build -t go-vue-starter-kit .

# Run the container
docker run -p 3000:3000 --env-file .env go-vue-starter-kit

πŸ“ Project Structure

.
β”œβ”€β”€ cmd/                    # CLI commands
β”‚   β”œβ”€β”€ root.go
β”‚   β”œβ”€β”€ migrate/           # Database migration command
β”‚   └── serve/             # Server command
β”œβ”€β”€ internal/              # Private application code
β”‚   β”œβ”€β”€ config/           # Configuration management
β”‚   β”œβ”€β”€ db/               # Database connection
β”‚   β”œβ”€β”€ delivery/         # Delivery layer (HTTP)
β”‚   β”‚   └── http/
β”‚   β”‚       β”œβ”€β”€ handler/  # HTTP handlers
β”‚   β”‚       β”œβ”€β”€ middleware/ # HTTP middleware
β”‚   β”‚       └── routes/   # Route definitions
β”‚   β”œβ”€β”€ domain/           # Business domain interfaces
β”‚   β”œβ”€β”€ hash/             # Hashing utilities
β”‚   β”œβ”€β”€ lang/             # Internationalization
β”‚   β”œβ”€β”€ model/            # Data models
β”‚   β”œβ”€β”€ provider/         # External service providers (e.g., SMTP)
β”‚   β”œβ”€β”€ repository/       # Data access layer
β”‚   β”œβ”€β”€ service/          # Business logic layer
β”‚   └── validator/        # Request validation
β”œβ”€β”€ ui/                   # Vue.js frontend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/   # Vue components
β”‚   β”‚   β”œβ”€β”€ layouts/      # Layout components
β”‚   β”‚   β”œβ”€β”€ pages/        # Page components
β”‚   β”‚   β”œβ”€β”€ services/     # API services
β”‚   β”‚   β”œβ”€β”€ stores/       # Pinia stores
β”‚   β”‚   └── utils/        # Utility functions
β”‚   └── public/           # Static assets
β”œβ”€β”€ web/                  # Embedded web assets
β”œβ”€β”€ db/                   # Database migrations
β”œβ”€β”€ pkg/                  # Public packages
β”œβ”€β”€ docker-compose.yml    # Docker Compose configuration
β”œβ”€β”€ Dockerfile           # Docker build configuration
β”œβ”€β”€ Makefile            # Development automation
└── main.go             # Application entry point

πŸ”§ Available Commands

Go Commands

go run . serve              # Start the server
go run . migrate up         # Run database migrations

Make Commands

make dev                    # Run in development mode
make run                    # Run in production mode
make build                  # Build the application
make build-embed           # Build with embedded frontend
make web-install           # Install frontend dependencies
make web-build             # Build frontend
make clean                 # Clean build artifacts

Frontend Commands (in ui/ directory)

pnpm dev                   # Start development server
pnpm build                 # Build for production
pnpm preview              # Preview production build
pnpm typecheck            # Run TypeScript type checking
pnpm lint                 # Run ESLint

πŸ” Authentication

The application uses JWT-based authentication with:

  • Access tokens (short-lived, 15 minutes)
  • Refresh tokens (long-lived, 7 days)
  • Automatic token refresh on the frontend
  • Secure token storage in HTTP-only cookies

πŸ§ͺ Testing

# Run Go tests
go test ./...

# Run frontend tests
cd ui && pnpm test

🀝 Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“§ Support

If you have any questions or need help, please open an issue on GitHub.

πŸ™ Acknowledgments

  • Echo - High performance, minimalist Go web framework
  • Uber FX - Dependency injection framework
  • Bun - SQL-first Golang ORM
  • Vue 3 - The progressive JavaScript framework
  • Vuetify - Material Design component framework
  • Sneat - Free Vue 3 Admin Template