URL shortener app made using:
- Frontend: React, Typescript
- Backend: Go, Redis, PostgreSQL
- Deployment: Docker, Kubernetes, GCP, Heroku, Vercel
Frontend React App is hosted on Vercel@ https://url-shortener-gamma-lilac.vercel.app/
Backend Go App is hosted on Heroku@ https://url-shortener-137d2d729d3e.herokuapp.com/
To run the project locally, follow these steps:
-
Sign up for a PostgreSQL cloud service such as Aiven, AWS RDS, or others.
-
I used Aiven
-
Obtain the connection string with SSL settings. Update the
POSTGRES_CONNECTION_STRING
in yourapp.env
file which is shown below
- Sign up for free "Redis as a Service" providers online.
- I used Redis Labs
# app.env
# PostgreSQL Connection String
POSTGRES_CONNECTION_STRING=postgres://username:password@host:port/database?sslmode=verify-ca&sslrootcert=path/to/ca.pem
# Redis Connection Details
REDIS_CONNECTION_ADDR=redis-host:redis-port
REDIS_CONNECTION_PASSWORD=redis-password
# Client Origin for CORS
CLIENT_ORIGIN=http://localhost:8081
# Token Configuration
TOKEN_EXPIRED_IN=180m
TOKEN_MAXAGE=180
TOKEN_SECRET=my-ultra-secure-json-web-token-string
GCP's GKE gave me an external IP exposing my backend service/APIs. But when I deployed my frontend app on Vercel which had a different
domain like ****vercel.com and my backend external IP address didn't match with the frontend Vercel's domain and hence even though I used CORS on my backend go code Vercel blocked the API requests to my backend, and hence I had to deploy it on Heroku as a single app.