A starter Go application with PostgreSQL and NATS integration, ready for use in Gitpod.
- RESTful API for Todo management
- PostgreSQL database integration
- NATS messaging for event-driven architecture
- Simple web frontend
- Development environment using Docker Compose
- Gitpod integration for cloud development
- Go (backend)
- PostgreSQL (database)
- NATS (message broker)
- HTML/CSS/JavaScript (frontend)
- Docker Compose (containerization)
- Gitpod (cloud development)
The easiest way to get started is to use Gitpod:
- Click the button below to open in Gitpod:
- Gitpod will automatically start your development environment with all dependencies.
- Your application will be available at port 8080.
To run the application locally:
- Install Go 1.24 or later
- Install Docker and Docker Compose
- Clone the repository:
git clone https://github.com/matthewJamesBoyle/go-starter.git cd go-starter
- Start the development environment:
docker-compose up -d
- Run the application:
go run cmd/main.go
- Open http://localhost:8080 in your browser
├── cmd/ # Command line applications
│ └── main.go # Main application entry point
├── internal/ # Private application code
│ ├── api/ # API handlers and routes
│ ├── config/ # Configuration management
│ ├── database/ # Database access layer
│ ├── nats/ # NATS integration
│ └── models/ # Domain models
├── web/ # Web assets
│ └── static/ # Static files for the frontend
├── .devcontainer.json # VS Code development container configuration
├── docker-compose.yaml # Docker compose configuration
├── go.mod # Go module definition
└── README.md # This file
GET /api/todos
- List all todosPOST /api/todos
- Create a new todoPATCH /api/todos/:id
- Update a todo's completion statusDELETE /api/todos/:id
- Delete a todo
The application can be configured using environment variables:
SERVER_PORT
- Port for the HTTP server (default: 8080)DATABASE_URL
- PostgreSQL connection string (default: postgres://todos:todos@db:5432/todos?sslmode=disable)NATS_URL
- NATS server URL (default: nats://nats:4222)NATS_SUBJECT
- NATS subject name (default: todos)
MIT