GithubHelp home page GithubHelp logo

torenware / go-vite-docker Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 0.0 39 KB

Demo project on doing frontend development with golang using Vite, Docker and SSL

Dockerfile 5.23% Shell 3.62% JavaScript 0.87% HTML 4.43% TypeScript 37.83% CSS 5.84% Go 42.17%

go-vite-docker's Introduction

Doing Frontend In Golang Apps

This repository is for a series of articles on doing front end work together with Golang web apps. Different parts of the series are branches in this repo. I start with a simple Go web application, and build on it until we get the finished system.

  1. Starting version of the app. Just Go, with a bit of Bootstrap 5.
  2. Adding Vite, Javascript and CSS. Link the Go app up with Vite 3, and add a bit of Javascript and CSS using Vite.
  3. Dockerizing Vite and the Go Project. Create containers for Vite and for the Go application, and wire them together using a docker-compose.yaml file.
  4. Adding an Nginx Router. Set up an Nginx reverse proxy to access our Go and Vite links.
  5. Creating Certificates and Adding SSL to the Router. Create our certs with mkcert, and modify our Nginx reverse proxy to terminate our links with SSL.

The Articles

The pieces of the "Doing Frontend Development with Golang, JavaScript and Docker" series are now up on Medium:

Reading List

A number of articles and software packages were essential in figuring out how to do this tutorial. Here are my main sources:

  • How to set up an easy and secure reverse proxy with Docker, Nginx & Letsencrypt. This freeCodeCamp piece is my major source for setting up Nginx as a reverse proxy on Docker. If you need to learn how to do that, this is your article.
  • How to handle https with docker-compose and mkcert for local development Excellent instructions on how to set up and use mkcert to create certificates. As for Traefik, another solution for the reverse proxy: I just couldn't get it to work. Not the article's fault.
  • Vite 3 configuration docs. Generally great, although the sections on websocket configuration are somewhat lacking. It took a fair bit of trial and error to figure out how to configure HMR.
  • vite-go: Tooting my own horn here. My Vite integration module for Go.
  • Air, an easy to use development build utility for Go. Air rocks, and the Air docs rock too. Using the author's docker image was truly easy to do.
  • DDEV, a Docker Compose based development environment popular with the PHP community. DDEV is a great tool, and learning how DDEV works helped a great deal in getting my much more bare-boned solution to work for Go. If you do PHP development, DDEV should be an essential part of your toolset.
  • Working with Microservices in Go (Golang) (Udemy course). Trevor Sawler's Go courses are excellent, and this course in particular helped me get this tutorial to work. Good background on using Docker Compose in Go development.
  • Websocket Handshaking: article on how a websocket connection gets set up. Useful to know, especially when things aren't working as you expect.

Copyright © 2022 Rob Thorne

Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.

go-vite-docker's People

Contributors

torenware avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.