A full-stack template repository with a React + TypeScript frontend and Go + Echo backend.
| Layer | Technology |
|---|---|
| Frontend | React 18, TypeScript, Vite, TailwindCSS |
| Backend | Go 1.21+, Echo v4, MongoDB |
| Auth | JWT tokens with bcrypt password hashing |
- Frontend: Modern React SPA with TypeScript, Vite for fast builds, and TailwindCSS for styling
- Backend: RESTful API built with Echo framework
- Database: MongoDB for persistent storage
- Authentication: JWT-based auth with secure password hashing (bcrypt cost 14)
- Middleware: CORS, logging, and recovery middleware configured
- Frontend: Node.js 18+, npm
- Backend: Go 1.21+, Docker (for MongoDB)
- Optional:
airfor live reload
# Clone the repository
git clone <your-repo-url>
cd go-react-scaffoldcd backend
# Copy environment file and configure
cp .env.example .env
# Start MongoDB via Docker
make docker-run
# Run the backend
make runThe backend will start on http://localhost:8080.
cd frontend
# Install dependencies
npm install
# Start development server
npm run devThe frontend will start on http://localhost:5173 (default Vite port).
.
├── frontend/ # React + TypeScript frontend
│ ├── src/
│ │ ├── App.tsx # Main app component
│ │ ├── main.tsx # Entry point
│ │ └── index.css # Tailwind directives
│ ├── package.json
│ ├── tailwind.config.js
│ ├── tsconfig.json
│ └── vite.config.ts
│
├── backend/ # Go + Echo backend
│ ├── main.go # Application entry point
│ ├── auth/ # Authentication handlers & JWT
│ │ ├── auth.go # JWT token handling
│ │ ├── configs.go # Auth configuration
│ │ ├── controller.go # Auth business logic
│ │ └── routes.go # Auth route handlers
│ ├── users/
│ │ └── model.go # User data model
│ ├── configs/
│ │ ├── db.go # MongoDB connection
│ │ └── env.go # Environment variables
│ ├── integrations/ # External API integrations
│ │ ├── paypack.go
│ │ ├── telegram-bot.go
│ │ └── useplunk.go
│ ├── utils/
│ │ └── emails.go # Email utilities
│ ├── Makefile
│ ├── go.mod
│ └── .env.example
│
├── AGENTS.md # Coding guidelines
└── README.md # This file
Configure the backend by editing backend/.env:
| Variable | Description | Default |
|---|---|---|
APP_ENV |
Application environment | development |
PORT |
Server port | 8080 |
MONGODB_URI |
MongoDB connection string | mongodb://localhost:27017 |
SESSION_KEY |
Secret key for JWT signing | Required |
REDIS_URL |
Redis connection string | Optional |
PAYPACK_CLIENT_ID |
Paypack API client ID | Optional |
PAYPACK_CLIENT_SECRET |
Paypack API secret | Optional |
USE_PLUNK |
Enable Plunk email integration | Optional |
TELEGRAM_BOT_ID |
Telegram bot token | Optional |
TELEGRAM_CHAT_ID |
Telegram chat ID for notifications | Optional |
cd frontend
# Start development server with HMR
npm run dev
# Build for production
npm run build
# Preview production build
npm run preview
# Run linter
npm run lintcd backend
# Build the application
make build
# Run the application
make run
# Run tests
make test
# Live reload (requires air)
make watch
# Start MongoDB container
make docker-run
# Stop MongoDB container
make docker-down
# Clean build artifacts
make clean| Method | Endpoint | Description |
|---|---|---|
POST |
/register |
Register a new user |
POST |
/login |
Authenticate user and get JWT token |
curl -X POST http://localhost:8080/register \
-H "Content-Type: application/json" \
-d '{"email": "user@example.com", "password": "yourpassword"}'curl -X POST http://localhost:8080/login \
-H "Content-Type: application/json" \
-d '{"email": "user@example.com", "password": "yourpassword"}'Response includes a JWT token for authenticated requests.
-
Fork the repository
-
Create a feature branch:
git checkout -b feature/your-feature -
Follow the coding guidelines in AGENTS.md
-
Run tests and lint before committing:
# Backend cd backend && make test # Frontend cd frontend && npm run lint
-
Commit with a clear message
-
Push to your fork and submit a Pull Request
- Frontend: Strict TypeScript, ESLint configured, 2-space indentation
- Backend: Standard Go formatting (gofmt), proper error handling, context-based DB operations
- Both: Write tests for new features, validate inputs, never expose secrets
- Never commit
.envfiles or secrets - Passwords are hashed with bcrypt (cost 14)
- JWT tokens used for authentication
- CORS configured for development (adjust for production)
- Input validation on all endpoints
MIT