Skip to content

Latest commit

 

History

History
69 lines (45 loc) · 1.82 KB

README.md

File metadata and controls

69 lines (45 loc) · 1.82 KB

Advanced URL Shortener

High-Level Architecture

HLD


Installation

  1. Create an .env file in the root directory.

  2. Obtain the Client Secret and Client ID from your Google Service Account.
    If you don’t already have one, create it via the Google Cloud Console.

  3. Add the following environment variables to your .env file:

    # Server Configuration
    PORT=3000
    
    # Database Configuration
    DB_URI=postgresql://url_shortener_5sot_user:tP8ltTz2tXEdwvHGznVII4ZrH0leiFYh@dpg-cu4peft2ng1s73fcmaf0-a.singapore-postgres.render.com/url_shortener_5sot
    
    # Google OAuth Configuration
    GOOGLE_CLIENT_ID=
    GOOGLE_CLIENT_SECRET=
    GOOGLE_REDIRECT_URI=http://localhost:3000/api/auth/google-callback
    
    # URL Shortener Configuration
    SHORT_URL_PREFIX=https://short.en/
    
    # JWT Configuration
    JWT_SECRET=advanced-url-shortener
  4. Run the application using Docker Compose:
    Execute the following command in the terminal:

    docker compose up
  5. Access the application:
    Open your browser and navigate to:
    http://localhost:3000

  6. Deployed


Tutorial: Getting the JWT Key

  1. Sign in using the /api/auth route:
    Visit: http://localhost:3000/api/auth

  2. Once authenticated, copy the token provided in the response.
    This token can be used for authenticated requests.


API Documentation

The full API documentation can be found here.


Notes:

  • Ensure the .env file is kept secure and not shared publicly.