Code Monkey home page Code Monkey logo

url-shortener's Introduction

URL Shortener

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/

Table of Contents

  1. How To Run it Locally

    1.1. Setup PostgreSQL Cloud Service

    1.2. Setup Redis Cloud Service

  2. Why couldn't I deploy my app using Docker + GCP Kubernetes?

How To Run it Locally

To run the project locally, follow these steps:

Get PostgreSQL Cloud Service Connection Details

  1. Sign up for a PostgreSQL cloud service such as Aiven, AWS RDS, or others.

  2. I used Aiven

  3. Obtain the connection string with SSL settings. Update the POSTGRES_CONNECTION_STRING in your app.env file which is shown below

Get Redis Cloud Service Connection Details

  1. Sign up for free "Redis as a Service" providers online.
  2. 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

Why couldn't I deploy my app using Docker + GCP Kubernetes?

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.

url-shortener's People

Contributors

tarunsunny3 avatar

Watchers

 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.