Skip to content

SnehanjanChatterjee/url-shortener-nextjs-frontend

Repository files navigation

Overview

Frontend of Url Shortener project for Next.js in TypeScript. Backend Repository: url-shortener-java-backend

Access the website at https://url-shortener-nextjs-frontend.vercel.app/

Note

The backend app is hosted on Render's free tier. Render spins down a Free web service that goes 15 minutes without receiving inbound traffic. Render spins the service back up whenever it next receives a request to process.

So if the website appears unresponsive, the backend is likely in "sleep" mode after being idle for 15 minutes.

It’s currently waking up, which may take up to a minute. Kindly wait for a moment, and the app will be ready shortly. Thank you for your understanding!

Tech Stack

  • Next.js
  • React.js
  • TypeScript
  • Tailwind CSS
  • Daisy UI
  • Auth.js
  • Google OAuth 2.0

Hosting

  • Next.js App - Hosted on Vercel

Demo

image image image

How to Create & Deploy a new Next.js App

This is a Next.js project bootstrapped with create-next-app.

Getting Started

First, run the development server:

npm run dev
# or
yarn dev
# or
pnpm dev

Open http://localhost:3000 with your browser to see the result.

You can start editing the page by modifying app/page.tsx. The page auto-updates as you edit the file.

This project uses next/font to automatically optimize and load Geist, a new font family for Vercel.

Learn More

To learn more about Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

Deploy on Vercel

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Check out our Next.js deployment documentation for more details.

How to run the app locally

Prerequisites

  1. Node.js 22+ - Ensure you have Node.js version 22 or later installed. You can download it from Node.js Official Site.

  2. npm or yarn or pnpm - A package manager to install dependencies. npm comes with Node.js, but you can also use yarn / pnpm if preferred.

Clone the Repository

  1. Fork the repository using the Fork button at the top-right corner of the repository page.
  2. Clone the forked repository:
git clone https://github.com/yourusername/nextjs-app.git
cd nextjs-app

Install Dependencies

Run the following command in the project directory to install all required dependencies:

npm install

or

yarn install

or

pnpm install

Configure Environment Variables

If your project uses environment variables, create a .env file in the root directory and add the required variables. Example:

NEXT_PUBLIC_BACKEND_CLOUD_ENDPOINT=<base-url-of-hosted-backend-server>
NEXT_PUBLIC_BACKEND_REST_PATH=<rest-api-path-of-backend-service>
NEXT_PUBLIC_SHOW_INFO_BUTTON=true [If you need to show the info. message button on bottom right of page]
NEXT_PUBLIC_INFO_MESSAGE_LINE1=<line-1-of-message>
NEXT_PUBLIC_INFO_MESSAGE_LINE2=<line-2-of-message> [Optional]
AUTH_SECRET= [Should be added by AuthJS automatically when you run npx auth secret]
AUTH_GOOGLE_ID=<create-a-new-app-in-google-cloud-console-and-create-a-credential>
AUTH_GOOGLE_SECRET=<create-a-new-app-in-google-cloud-console-and-create-a-credential>

Ensure you do not commit sensitive data by adding .env to .gitignore:

echo ".env*" >> .gitignore

Run the Development Server

Start the development server using:

npm run dev

or

yarn dev

or

pnpm dev

The server will start, and the application will be accessible at http://localhost:3000.