svelte-go-starterkit Svelte Themes

Svelte Go Starterkit

Full-stack e-commerce starterkit with SvelteKit 5 and Go Echo

Svelte + Go Echo Starterkit

A production-ready e-commerce starter kit with SvelteKit frontend and Go Echo backend.

Features

  • Authentication: JWT-based with dual scope (internal/customer), OTP-ready
  • Role System: Admin, Manager, Staff, Customer with granular permissions
  • Activity Logs: Full audit trail for all actions
  • Payment Gateway: Pluggable interface (ready for Duitku, Midtrans, etc.)
  • Theme System: Dark/light mode with customizable primary color
  • E-Commerce Core: Products, Orders, Users management

Tech Stack

Frontend Backend
SvelteKit 5 Go Echo v4
Tailwind CSS 4 GORM
TypeScript PostgreSQL/SQLite
Lucide Icons JWT Auth

Quick Start

Prerequisites

  • Go 1.21+
  • Node.js 18+
  • PostgreSQL (optional, SQLite works for dev)

Backend Setup

cd backend

# Copy environment file
cp .env.example .env

# Edit .env with your settings
# DATABASE_URL=./data/starterkit.db  (SQLite for dev)
# DATABASE_URL=postgres://user:pass@host:5432/db  (PostgreSQL for prod)
# JWT_SECRET=change-this-to-a-secure-random-string

# Install dependencies
go mod tidy

# Run database migrations (creates tables)
go run cmd/main.go -migrate

# Seed default data (admin user)
go run cmd/main.go -seed

# Start development server
make dev
# or
go run cmd/main.go

Backend runs on: http://localhost:3078

Frontend Setup

cd frontend

# Install dependencies
npm install

# Start development server
npm run dev

Frontend runs on: http://localhost:5173

Default Credentials

After seeding:

Role Username Password
Admin admin admin123
Staff staff staff123

Important: Change these immediately in production!

Project Structure

svelte-go-starterkit/
├── backend/
│   ├── cmd/main.go           # Entry point
│   ├── internal/
│   │   ├── config/           # Configuration
│   │   ├── handler/          # HTTP handlers (in service package)
│   │   ├── middleware/       # Auth, Role middleware
│   │   ├── model/           # Database models
│   │   ├── repository/       # Data access layer
│   │   ├── service/          # Business logic
│   │   └── payment/         # Payment gateway interface
│   └── pkg/utils/            # Shared utilities
│
└── frontend/
    └── src/
        ├── lib/
        │   ├── api/          # API client
        │   ├── stores/       # Svelte stores (auth, theme)
        │   └── components/   # UI components
        └── routes/
            ├── +page.svelte  # Landing page
            ├── (auth)/        # Login, Register
            ├── (app)/         # Customer dashboard
            └── admin/         # Admin panel

API Endpoints

Public

Method Path Description
GET /api/public/settings App branding & config
POST /api/auth/register Customer registration
POST /api/auth/login Login
POST /api/auth/refresh Refresh access token

Customer (Authenticated)

Method Path Description
GET /api/customer/me Get current user
PUT /api/customer/profile Update profile
GET /api/customer/orders List own orders
GET /api/customer/orders/:id Get order details

Admin (Authenticated)

Method Path Description
GET /api/admin/users List users
POST /api/admin/users Create user
GET /api/admin/products List products
POST /api/admin/products Create product
PUT /api/admin/products/:id Update product
DELETE /api/admin/products/:id Delete product
GET /api/admin/orders List all orders
PUT /api/admin/orders/:id Update order
GET /api/admin/activity-logs Activity logs
GET/PUT /api/admin/settings Settings

Role Permissions

Role Permissions
admin All permissions
manager manage_orders, manage_products, view_reports
staff view_orders, update_order_status
customer own_orders, own_profile

OTP Configuration

OTP can be enabled via settings:

# In admin settings panel or directly in database:
otp_enabled = true
otp_provider = whatsapp  # or email, sms

Theme Customization

Users can customize the theme via settings:

{
  "ui_theme_mode": "dark" | "light",
  "ui_theme_primary": "#0ea5e9"
}

Available color presets: Sky, Blue, Pink, Violet, Rose, Emerald, Amber, Orange

Development

Running Tests

# Backend
cd backend
go test ./...

# Frontend
cd frontend
npm run test

Building for Production

# Backend
cd backend
make build
# Binary: bin/server

# Frontend
cd frontend
npm run build
# Output: frontend/build/

License

MIT

Top categories

Loading Svelte Themes