Home » People & Blogs » Go Realtime Chat Part 1: authentication + db connection setup (clean architecture, cookie-based JWT)

Go Realtime Chat Part 1: authentication + db connection setup (clean architecture, cookie-based JWT)

Written By david hwang on Wednesday, Dec 07, 2022 | 08:06 PM

 
This is part 1 of the realtime chat application built with Go, Next, and Typescript. In the following part, we will set up the websocket endpoint and test our connection. In this part, we will: 1. Pull the postgres image from the Docker hub and create the go-chat database 2. Set up our database to connect to the postgres on the specified port, and add a db migration file with golang-migrate 3. Start building the architecture with the handler, service, and repository layers to create the /signup, /login, and /logout endpoints @TECHSCHOOLGURU does an awesome job explaining at how you can use the refresh token to manage user session here: https://www.youtube.com/watch?v=rT20ylRLm5U&t=17s&ab_channel=TECHSCHOOL Github repo: https://github.com/dhij/go-next-ts_chat sql library: https://pkg.go.dev/database/sql lib/pq: https://github.com/lib/pq golang-migrate: https://github.com/golang-migrate/migrate golang-jwt: https://github.com/golang-jwt/jwt bcrypt: https://pkg.go.dev/golang.org/x/crypto/bcrypt gin: https://github.com/gin-gonic/gin