My personal template for building web server using Go and ViteJS
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Antonio De Lucreziis c4bc6697e7
1 year ago
backend Initial commit 1 year ago
cmd Initial commit 1 year ago
frontend chore: Some fixes and removed old stuff 1 year ago
.gitignore Initial commit 1 year ago
Makefile Update Makefile 1 year ago Update 1 year ago
go.mod chore: Some fixes and removed old stuff 1 year ago
go.sum Initial commit 1 year ago
package.json Initial commit 1 year ago
pnpm-lock.yaml Initial commit 1 year ago
vite.config.js Initial commit 1 year ago

Go & ViteJS Boilerplate

This will repo is a template for a larger application based on ideas from, this uses the following technologies

  • The frontend is made using ViteJS and for now is just a SPA that uses (I have a working prototype of a multi-page version with full integration between the dev-client and the server but its still a bit rough)

  • The backend is made using Go and Fiber is very similar to ExpressJS and uses the fasthttp Go stack that should be a bit better that the Go default HTTP library.



The following command will start the backend (by default on :4000) and the ViteJS development server (by default on :3000).

$ go run -v ./cmd/develop


$ npm run build
$ go run -v ./cmd/server

# or just run...
$ make


  • As sad before, polish the ViteJS plugin for the dev-server for server side rendering.

    • Define routes once in Go by just referencing files from frontend/pages folder (internally this works by serving a special route in the backend while developing that lists all routes to mount for the ViteJS server)

    • Javascript-less pages and view engine support (as before when ViteJS is asked to render a server-dynamic page it will first do its processing to the HTML file and then ask the backend to render just that page on demand)

    • Remove Preact by-default

  • Add SQLite by default and more boilerplate for the DB

  • Go now supports embedded files in the binary so this could actually be shipped to a single binary with all frontend assets bundled in