⚠️ Work in Progress: This template is currently in beta. While functional and suitable for development, it may have rough edges and is actively being improved. Use as a starting point and expect updates. Please consider using this template and passing back any improvements you have made (of which there will be many) to make it better for everyone. Thank you!
Hey there! Looking to develop a Go application with an API, web interface and command-line interface (CLI) all within a single repository? You've come to the right place!
This template repository is a good starting point for building an application consisting of a server, a command line interface and a web interface. Rather than starting from scratch every time you want to create a new Go app, just grab this template and you'll already be 60–80% of the way there. Just add your business or personal logic and you're ready to go!
With the rise of AI-powered development tools, the barrier to entry for building custom software has never been lower. This template is designed to help you build custom software quickly.
This template exists partly to help you build custom personal software faster and more easily. It gets you started with the boilerplate and provides a relatively simple way to run and use a piece of software from both the command line and a web interface.
This template is also useful for building internal tools and on-premises applications within your organisation's infrastructure. Whether you're creating dashboards for operations teams, admin interfaces for managing company resources, data processing tools for analysts or specialised workflow automation systems, this template offers a solid foundation.
Most problems need custom software, not massive scale. This template is designed for the 90% of business problems that need internal tools, team productivity apps, and custom solutions - not the 1% that need to handle millions of users.
Skip the boilerplate. Every Go web app needs the same basic stuff - routing, auth, database connections, CLI parsing, tests, build scripts. This template provides all of that, already integrated and working together.
Deploy anywhere, no infrastructure team needed. Single binary with embedded SQLite means you can deploy to any server without coordinating with DevOps teams. No Redis to provision, no PostgreSQL to configure, no additional services to maintain. Just a binary and SQLite database file.
AI-powered rapid development. With today's AI coding assistants, starting with a solid foundation means you can build a custom internal tool in hours instead of days or weeks. Focus on solving your actual business problem, not setting up infrastructure and boilerplate code.
Ready to customize. The example echo API shows you exactly how to add your own endpoints. The web interface demonstrates user management. The CLI shows different output formats. Just follow the patterns and add your business logic.
We've done the boring setup work for you:
- A working HTTP API server (with an echo example to show you the patterns)
- A simple web interface with login and user management
- A CLI tool that talks to your API
- Database integration (SQLite - simple and portable)
- Authentication that actually works (API keys + web sessions)
- Tests, build scripts, and CI/CD setup
The echo server example is just there to show you how everything connects. Replace it with whatever your app actually needs to do!
Want to see it in action? It takes about 2 minutes to get everything running:
# Clone and build
git clone https://github.com/ccollicutt/go-app-skeleton-template
cd go-app-skeleton-template
make build
# Generate certificates for HTTPS
./bin/app-server generate-certs
# Set up and start the server
mkdir -p data
export SERVER_PORT=8081 DATABASE_PATH=./data/app.db API_KEY=dev-secret
export ADMIN_USERNAME=admin ADMIN_PASSWORD=SecureAdmin123
./bin/app-server
Then in another terminal, try the CLI:
export SERVER_URL=http://localhost:8081 API_KEY=dev-secret
./bin/app-cli health
./bin/app-cli echo-public "Hello World"
Or visit http://localhost:8081
in your browser (login: admin/SecureAdmin123).
That's it! You now have a working API server, web interface, and CLI tool.
That's all you need to get started!
Here's a quick look at the GUI:
Ready to build something? Here's how to make this template your own:
- Clone it: Fork this repo or use it as a template
- Customize it: Replace the echo API with your actual business logic
- Extend it: Add new endpoints, database tables, CLI commands, or web pages
- Deploy it: The build system and CI/CD pipeline are ready to go
├── cmd/
│ ├── server/ # Server entry point
│ └── cli/ # CLI entry point
├── internal/
│ ├── server/ # Server implementation
│ ├── cli/ # CLI implementation
│ └── assets/ # Web assets (HTML, CSS, JS)
├── pkg/
│ ├── config/ # Configuration management
│ ├── database/ # Database interface
│ ├── logger/ # Logging utilities
│ └── version/ # Version information
├── tests/ # Integration tests
└── Makefile # Build and development tasks
make build # Build server and CLI binaries
make run # Run the server locally
make clean # Clean build artifacts
make help # Show all available commands
SERVER_PORT
- HTTP server port (default: 8080)DATABASE_PATH
- SQLite database path (default: ./app.db)API_KEY
- API authentication keyADMIN_USERNAME
- Admin username for web interfaceADMIN_PASSWORD
- Admin password for web interfaceSESSION_SECRET
- Secret key for session management
SERVER_URL
- Server URL (default: http://localhost:8080)API_KEY
- API authentication keyDEBUG
- Enable debug output (true/false)
- Add your handler in
internal/server/handlers/
- Register the route in
internal/server/routes.go
- Add corresponding CLI command in
internal/cli/commands/
- Create migration in
pkg/database/migrations.go
- Add model struct in
pkg/database/models.go
- Implement CRUD operations
- Create HTML template in
internal/assets/templates/
- Add route handler in
internal/server/web_handlers.go
- Update navigation in base template
- API Key Authentication - Secure API access
- Session Management - Cookie-based web sessions
- Password Hashing - bcrypt for password storage
- HTTPS Support - TLS certificate generation included
- Input Validation - Request validation and sanitization
The application builds to a single binary that can be deployed anywhere:
# Build for production
make build
# Copy binary and run
scp bin/app-server your-server:/usr/local/bin/
ssh your-server
app-server --port 8080 --database /var/lib/app/data.db
- Go 1.23 or higher
- Make (for build automation)
- Git (for version control)
Go 1.23+ • Gorilla Mux • SQLite • bcrypt • Cobra CLI • GitHub Actions
The template uses proven libraries and follows Go best practices.
MIT License