A modern, production-ready Go web application framework built on Fiber v2 with server-side rendering, authentication, and MySQL database integration.
- 🚀 Fast & Modern: Built on Go Fiber v2 for high performance
- 🔐 Authentication System: Complete user registration, login, and session management
- 🗄️ Database Ready: MySQL integration with GORM and migration support
- 🎨 Server-Side Rendering: Django template engine with Bootstrap 5.2
- 🛡️ Security: CSRF protection, Argon2id password hashing, secure sessions
- 📦 Clean Architecture: Repository pattern with clear separation of concerns
- 🔥 Hot Reload: Development-ready with Air for instant feedback
- ⚡ Middleware: Logging, compression, recovery, and more out of the box
- Go 1.24+ - Programming language
- Fiber v2 - Fast HTTP web framework for Go
- GORM - Feature-rich ORM for database operations
- Django Template Language - Server-side templating
- Bootstrap 5.2 - Responsive CSS framework
- Alpine.js - Lightweight JavaScript framework
- MySQL 8.0+ - Primary database
- MySQL Session Storage - Secure session management
- fiber-hashing - Argon2id password hashing
- CSRF Protection - Built-in token validation
- Secure Sessions - MySQL-backed session storage
- Go 1.24 or higher
- MySQL 8.0 or higher
- Git
-
Clone the repository
git clone <repository-url> cd FiberStarter
-
Install dependencies
go mod download
-
Configure environment
cp .env.example .env # Edit .env with your database credentials -
Set up database
# Create the database mysql -u root -p -e "CREATE DATABASE fiberstarter;" # Run migrations mysql -u root -p fiberstarter < migrations/m_00001_Up.sql
-
Run the application
go run main.go
-
Visit the application Open your browser to
http://localhost:8080
FiberStarter/ ├── app.go # Application initialization and setup ├── main.go # Entry point ├── controllers/ # HTTP request handlers │ ├── Auth.go # Authentication logic │ └── Index.go # Home and protected routes ├── routes/ # Route definitions │ └── routes.go # All route mappings ├── middleware/ # HTTP middleware │ └── middleware.go # CSRF, logging, sessions, etc. ├── models/ # GORM database models │ ├── user.go # User model │ └── book.go # Example resource model ├── repos/ # Data access layer │ ├── user.go # User repository │ └── book.go # Book repository ├── database/ # Database connection │ └── database.go # GORM initialization ├── providers/ # Service providers │ ├── config.go # Configuration management │ ├── session.go # Session provider │ ├── auth.go # Authentication provider │ └── hash.go # Password hashing provider ├── utils/ # Utility functions │ └── utils.go # Helpers for auth, cookies, etc. ├── migrations/ # SQL migrations │ ├── m_00001_Up.sql # Initial schema │ └── m_00001_Down.sql # Rollback scripts ├── views/ # Django template files │ ├── layouts/ # Base templates │ ├── partials/ # Reusable components │ ├── Auth/ # Authentication views │ ├── Home/ # Home page views │ └── Common/ # Common views (errors, etc.) └── public/ # Static assets └── site.js # Frontend JavaScript Configure your application using environment variables in .env:
# Application Settings APP_NAME=FiberStarter SERVER_PORT=8080 ENABLE_DEBUG=true ENABLE_PREFORK=false ENABLE_COMPRESSION=true ENABLE_RECOVERY=true CONCURRENCY_LEVEL=200 # Database Configuration DB_USER=root DB_PASSWORD=password DB_NAME=fiberstarter DB_HOST=localhost DB_PORT=3306- User registration with email validation
- Secure login with Argon2id password hashing
- Session-based authentication
- Protected routes with middleware
- Logout functionality
- GORM ORM with MySQL
- Repository pattern for data access
- SQL-based migrations
- Soft delete support
- Connection pooling
- Request ID tracking
- Structured logging
- Static file serving
- CSRF protection
- Session management
- Panic recovery
- Gzip compression
- Custom 404 handling
- Django template engine
- Layout inheritance
- Partial templates
- Bootstrap 5.2 styling
- Alpine.js for interactivity
- CSRF token injection
For detailed guides, see:
- Getting Started Guide - Detailed setup and first steps
- Authentication Guide - Working with user authentication
- Database & Migrations - Database operations and migrations
- Creating Features - Step-by-step guide to add new features
- Deployment - Production deployment guide
For development with automatic reloading:
# Install Air go install github.com/cosmtrek/air@latest # Run with hot reload airgo test ./...A launch configuration is included in .vscode/launch.json. Press F5 to start debugging.
GET /- Home pageGET /Login- Login formPOST /Login- Process loginGET /Register- Registration formPOST /Register- Process registration
GET /Secret- Example protected pageGET /Logout- Logout and clear session
- Password Security: Argon2id hashing (industry standard)
- Session Security: MySQL-backed sessions with secure cookies
- CSRF Protection: Token validation on all POST requests
- SQL Injection Prevention: GORM parameterized queries
- Access Control: Middleware-based authentication checks
- 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
This project is open source and available under the MIT License.
For issues, questions, or contributions, please open an issue on the repository.
Built with ❤️ using Go Fiber