High-performance SaaS boilerplate built with Go Fiber + Svelte 5 + Inertia.js 3 + SQLite.
Build production-ready web applications faster with a clean, layered architecture that combines the speed of Go with the developer experience of modern frontend frameworks.
# Create new project with CLI
npx create-laju-go my-app
# Navigate to project
cd my-app
# Start development
npm run dev:all
# Clone the repository
git clone https://github.com/maulanashalihin/laju-go.git
cd laju-go
# Install dependencies
go mod download && npm install
# Set up environment
cp .env.example .env
# Start development servers
npm run dev:all
Visit http://localhost:8080 to see your application running.
| Section | Description |
|---|---|
| Getting Started | Introduction, installation, and configuration |
| Architecture Guide | Layered architecture, design patterns, and best practices |
| Routing & Handlers | Route definitions, middleware, and request handling |
| Database | SQLite setup, migrations, and query building |
| Authentication | Auth flows, OAuth, sessions, and password reset |
| Frontend | Svelte 5 components and Inertia.js integration |
| Deployment | Development workflow, production deployment, Docker |
| API Reference | Complete endpoint documentation |
| Troubleshooting | Common issues and solutions |
laju-go/
โโโ main.go # Application entry point
โโโ app/ # Backend Go code
โ โโโ handlers/ # HTTP request handlers
โ โโโ services/ # Business logic layer
โ โโโ repositories/ # Database access layer
โ โโโ middlewares/ # Request middleware
โ โโโ models/ # Data structures
โโโ frontend/ # Svelte 5 frontend
โ โโโ src/
โ โโโ components/ # Reusable UI components
โ โโโ pages/ # Page components
โ โโโ lib/ # Utilities and helpers
โโโ routes/ # Route definitions
โโโ migrations/ # Database migrations
โโโ templates/ # HTML templates
โโโ docs/ # Documentation
๐ See Project Structure for a complete directory reference.
| Layer | Technology | Purpose |
|---|---|---|
| Backend | Go 1.26+ | Programming language |
| Web Framework | Fiber v2 | High-performance HTTP framework (fasthttp) |
| Database | SQLite3 | Embedded SQL database |
| Query Builder | Squirrel | SQL query construction |
| Migrations | Goose | Database schema management |
| Frontend | Svelte 5 | Reactive UI framework |
| Build Tool | Vite 5 | Fast build tooling and dev server |
| Styling | Tailwind CSS 4 | Utility-first CSS framework |
| SPA Bridge | Inertia.js 3 | Server-driven single-page apps |
| Icons | Lucide Svelte | Beautiful, consistent icons |
The easiest way to create a new Laju Go project:
# Create new project
npx create-laju-go my-app
# Navigate to project
cd my-app
# Install Air for hot reload (recommended)
go install github.com/air-verse/air@latest
# Start development
npm run dev:all
The CLI will:
Clone the repository
git clone https://github.com/maulanashalihin/laju-go.git
cd laju-go
Install Go dependencies
go mod download
Install Node.js dependencies
npm install
Configure environment
cp .env.example .env
Edit .env with your settings. At minimum, set:
APP_ENV=development
SESSION_SECRET=your-32-character-secret-key
Set up Google OAuth (Optional)
http://localhost:8080/auth/google/callback to authorized redirect URIs.envSet up Email/SMTP (Optional - for password reset)
.envStart both Vite and Go servers with hot reload:
npm run dev:all
Terminal 1 - Vite dev server (frontend HMR):
npm run dev
Terminal 2 - Go server with hot reload:
air
# Or via npm
npm run dev:go
# Go server (manual restart after changes)
go run main.go
# Vite dev server
npm run dev
# Development
npm run dev # Start Vite dev server
npm run dev:go # Start Go server with Air hot reload
npm run dev:all # Run both Vite and Air concurrently
# Production
npm run build # Build frontend and Go binary
npm run serve # Run production binary
# Testing
npm run test:run # Run frontend tests
| You Edit | What Happens |
|---|---|
.svelte files |
Vite HMR updates instantly |
.go files |
Air rebuilds and restarts (~1-2 sec) |
.css files |
Hot reload (instant) |
migrations/ |
Auto-run on server start |
# Build frontend assets
npm run build
# Build Go binary
go build -o laju-go .
# Run the server
./laju-go
# Build the image
docker build -t laju-go .
# Run the container
docker run -p 8080:8080 \
-v $(pwd)/data:/root/data \
-v $(pwd)/storage:/root/storage \
laju-go
For complete production deployment instructions including systemd service setup, Nginx reverse proxy, and SSL configuration, see Production Deployment Guide.
After your first registration, promote your user to admin via SQLite:
sqlite3 data/app.db "UPDATE users SET role = 'admin' WHERE email = '[email protected]';"
Migrations run automatically on startup. Manual commands:
# Install goose
go install github.com/pressly/goose/v3/cmd/goose@latest
# Run all migrations
goose -dir migrations sqlite3 data/app.db up
# Check migration status
goose -dir migrations sqlite3 data/app.db status
# Rollback last migration
goose -dir migrations sqlite3 data/app.db down
# Run all tests
go test ./...
# Run tests with coverage report
go test -cover ./...
The application includes these optimizations by default, tuned for Vultr High Frequency 1-2GB RAM:
| Setting | Value | Benefit |
|---|---|---|
journal_mode |
WAL | Better write concurrency |
synchronous |
NORMAL | Faster writes with safety |
cache_size |
16MB | Reduced disk I/O (optimized for 1-2GB RAM) |
mmap_size |
256MB | NVMe memory-mapped I/O |
temp_store |
MEMORY | Faster temp table operations |
busy_timeout |
5000ms | Automatic retry on locks |
| Connection Pool | 15 max | Efficient connection reuse |
Different RAM size? See the complete SQLite Configuration Guide for optimal settings:
| Server RAM | MaxOpenConns | cache_size | mmap_size |
|---|---|---|---|
| 512MB โ ๏ธ | 10 | 8MB | 128MB |
| 1-2GB โ | 15 | 16MB | 256MB |
| 4GB | 25 | 32MB | 512MB |
| 8GB | 50 | 256MB | 1GB |
| 16GB+ | 100 | 500MB+ | 2GB |
๐ Full guide: SQLite Configuration Guide - Complete reference for tuning SQLite based on RAM, CPU, storage type, and workload patterns.
Contributions are welcome! Please follow these steps:
git checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)MIT License - see LICENSE for details.