Gns
Production-ready full-stack starter kit with Go, Next.js 16, and shadcn/ui, featuring JWT auth, RBAC, i18n, and clean architecture.
Install / Use
/learn @yogameleniawan/GnsREADME
✨ Features
- JWT Authentication — Login, register, Google OAuth, token refresh, session management
- Role-Based Access Control — Roles, permissions, and module-level access
- Clean Architecture — Consistent structure on both backend and frontend
- Dependency Injection — uber/dig for automatic wiring on the backend
- Internationalization — English & Indonesian out of the box (next-intl)
- Theme System — Light & dark mode with next-themes + shadcn/ui
- Database Migrations — Auto-run on startup with golang-migrate
- Docker Ready — Development and production Docker Compose configs
- API Rate Limiting — Built-in rate limiter middleware
- Security Headers — HSTS, X-Frame-Options, Content-Type sniffing protection
🏗️ Tech Stack
| Layer | Technology | | ------------ | ------------------------------------------------ | | Backend | Go, Chi Router, uber/dig, PostgreSQL, Redis | | Frontend | Next.js 16, React 19, Tailwind CSS v4, shadcn/ui | | Auth | JWT (access + refresh tokens), Google OAuth | | State | TanStack Query, Zustand | | i18n | next-intl (EN, ID) | | DevOps | Docker, Docker Compose, Makefile |
🚀 Quick Start
Prerequisites
- Go 1.21+
- Node.js 18+ or Bun
- Docker & Docker Compose
1. Clone
git clone https://github.com/yogameleniawan/gns.git
cd gns
2. Backend
cd backend
cp .env.example .env
cp config/config.template.yaml config/config.development.yaml
# Option A: Docker (recommended)
make dev
# Option B: Local (requires PostgreSQL & Redis)
go mod download
make init
make run
3. Frontend
cd frontend
bun install # or: npm install
bun dev # or: npm run dev
4. Open
- Frontend: http://localhost:3000
- Backend API: http://localhost:8080
Default Admin Account
| Field | Value |
| -------- | --------------- |
| Email | admin@gns.com |
| Password | admin123 |
📁 Project Structure
gns/
├── backend/
│ ├── cmd/api/ # Entry point (main, config, migration, server)
│ ├── config/ # YAML config per environment
│ ├── container/ # Dependency injection (uber/dig)
│ ├── internal/ # Business modules
│ │ ├── auth/ # Authentication (dto, repo, service, handler)
│ │ └── rbac/ # Roles & permissions
│ ├── migrations/ # SQL migrations & seeders
│ └── pkg/ # Shared packages (middleware, router, utils, etc.)
│
├── frontend/
│ ├── app/ # Next.js App Router pages
│ ├── src/
│ │ ├── domain/ # Types & interfaces
│ │ ├── application/ # Hooks & state management
│ │ ├── infrastructure/ # API clients & stores
│ │ └── presentation/ # Components & pages
│ └── locales/ # i18n translations
🔧 Backend Commands
make dev # Start dev environment (Docker)
make dev-down # Stop dev containers
make run # Run locally
make build # Build binary
make create-migration name=X # Create migration
make migrate-up # Run migrations
make migrate-down # Rollback migrations
make db-shell # PostgreSQL shell
📖 Adding a New Module
Each backend module follows a 4-file pattern inside internal/:
internal/your_module/
├── dto.go # Request/response structs
├── repository.go # Database queries
├── service.go # Business logic
└── handler.go # HTTP handlers
Then wire it in container/container.go and add routes in pkg/router/router.go.
See the Documentation page for detailed guides.
🌐 API Routes
All routes are prefixed with /v1.
| Method | Path | Description |
| ------ | ------------------- | --------------------------- |
| POST | /auth/register | Register |
| POST | /auth/login | Login |
| POST | /auth/refresh | Refresh token |
| GET | /auth/profile | Get profile (🔒) |
| GET | /users | List users (🔒 Admin) |
| POST | /users | Create user (🔒 Admin) |
| GET | /rbac/roles | List roles (🔒 Admin) |
| GET | /rbac/permissions | List permissions (🔒 Admin) |
🔒 = Requires authentication
📝 License
This project is open source and available under the MIT License.
🤝 Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
