Skip to content

brainplusplus/boilerplate-saas-fullstack-go-react

Repository files navigation

Boilerplate SaaS Fullstack Go React

A full-stack SaaS boilerplate with Go backend, React frontend, and Go reverse proxy.

Features

🔐 Authentication & Authorization

  • Secure Login: JWT-based authentication (HS256).
  • OTP Verification: Email-based One-Time Password verification for login.
  • Password Management: Forgot password and reset password flows with secure email tokens.
  • Role-Based Access Control (RBAC): Fine-grained permissions for Admin and User roles.

📊 Advanced DataTables

  • Filtering: Advanced filtering with operators (equals, contains, greater than, etc.) via SQL-like query builder.
  • Column Customization:
    • Visibility: Toggle columns on/off.
    • Reordering: Drag-and-drop column reordering.
    • Resizing: Adjustable column widths.
  • Persistence: User preferences (visibility, order, size) are saved to the database per user/table.
  • Mass Actions: Multi-select support for bulk operations (e.g., Mass Delete).
  • Export: Export selected or filtered data to Excel (.xlsx).

🧭 Navigation & UI

  • Tree Sidebar: Multi-level collapsible sidebar menu with active state highlighting.
  • Responsive Design: Mobile-friendly layout with collapsible sidebar.
  • Internationalization (i18n):
    • Multi-language Support: Built-in support for Indonesian (id) and English (en).
    • Easy Translation: JSON-based locale files.

⚙️ Backend & Infrastructure

  • Background Jobs: Robust job queue system for async tasks with status monitoring.
  • Email Templates: HTML email templates for polished communication (OTP, Reset Password).
  • Docker Ready: Production-ready Dockerfile and docker-compose.yml.

Tech Stack

Layer Technology
Backend Go 1.24, Echo v4, GORM, PostgreSQL
Frontend React 19, Vite 7, TypeScript, Tailwind CSS v4
Proxy Go reverse proxy with static file serving
Database PostgreSQL with schema support
Auth JWT (HS256) + OTP via email
Email SMTP with HTML templates

Project Structure

boilerplate-saas-fullstack-go-react/
├── apps/
│   ├── backend/         # Go API server
│   ├── frontend/        # React SPA
│   └── reverse-proxy/   # Go reverse proxy
├── docker-compose.yml
├── .env.docker.example
├── architecture.md
└── codebase.md

Quick Start

Prerequisites

  • Go 1.24+
  • Node.js 22+
  • PostgreSQL 16+

Generating a New Project

Use the interactive generator to create a new SaaS application based on this boilerplate. This will generate a complete project with Go (Echo, GORM) backend and React (Vite, Tailwind) frontend, powered by Bun.

bun install
bun run generate

Follow the prompts to configure:

  1. App Name: Human-readable name (e.g., "My SaaS")
  2. Backend Module Name: Go module name (e.g., "my-saas-backend")
  3. Backend Port: API server port (default: 3001)
  4. Frontend Port: Vite dev server port (default: 3002)
  5. Reverse Proxy Port: Unified entry point (default: 7777)
  6. Target Directory: Where to create the new project

The script will automatically:

  • Copy the boilerplate files
  • Rename the module in go.mod and imports
  • Update docker-compose.yml, .env, and package.json with your configuration
  • Update frontend title and vite config

Development

  1. Backend:

    cd apps/backend
    cp .env.example .env
    # Edit .env with your database credentials
    go mod tidy
    go run .
  2. Frontend:

    cd apps/frontend
    cp .env.example .env
    bun install
    bun run dev
  3. Reverse Proxy (optional, for unified port):

    cd apps/reverse-proxy
    cp .env.example .env
    go run .

    Access at: http://localhost:7777

Docker Deployment

cp .env.docker.example .env.docker
# Edit .env.docker with your settings
docker compose up --build

Access at: http://localhost:7777

API Endpoints

Method Path Auth Description
POST /api/auth/login No Login
POST /api/auth/verify-otp No Verify OTP
POST /api/auth/forgot-password No Request password reset
POST /api/auth/reset-password No Reset password with token
GET /api/auth/me Yes Get current user
POST /api/auth/change-password Yes Change password
GET /api/users Yes List all users
GET /api/users/:id Yes Get user by ID
POST /api/users Yes Create user
PUT /api/users/:id Yes Update user
DELETE /api/users/:id Yes Deactivate user
GET /api/table-settings/:module Yes Get table settings
POST /api/table-settings/:module Yes Save table settings
DELETE /api/table-settings/:module Yes Delete table settings
GET /api/background-jobs Yes List all jobs
GET /api/background-jobs/active Yes List active jobs
GET /api/background-jobs/:id Yes Get job by ID
POST /api/background-jobs/search Yes Search jobs

Default Admin Credentials

⚠️ Change these in production via ADMIN_EMAIL and ADMIN_PASSWORD environment variables.

Environment Variables

See .env.example files in each app directory and .env.docker.example at the root.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors