biswodip.← All projects
02 / Links and application APIsFull-Stack Software Engineer (Sole Developer)

NanoLink

Production-style URL management application with custom links, passwords, expiry and click tracking.

01 / The Problem & Analysis

Standard URL shorteners lack security controls, expose private redirects to scraping, and lack programmatic lifecycle and one-time deactivation rules.

02 / Engineering & BA Role

Full-Stack Software Engineer (Sole Developer)

03 / Outcome

Redirects check the stored expiry date and deactivate single-use links after their first visit.

Overview

NanoLink is a URL shortening application that lets users create short links with optional custom aliases, password protection, expiration and one-time use. The application also records click counts and link activity.

What I built

Engineered REST API routes in Next.js App Router with Zod schema validation, Prisma ORM transactions, and conditional redirect resolution.

Product Interface

nanl.vercel.app
Live
NanoLink real application interface from the deployed site

Engineering Decisions

Validate link requests

What
The create-link API checks the submitted URL and options.
Why
Invalid input should return a useful error before a link is saved.
How
The route validates the request, normalizes the URL and checks it before creating the record.

Keep identifiers unique

What
Short codes and custom aliases have database uniqueness constraints.
Why
A short link must identify one destination.
How
The API checks existing codes and PostgreSQL also enforces unique values.

Apply link rules

What
Links can require a password, expire or allow one use.
Why
The person sharing a link needs control over how it is opened.
How
The redirect workflow checks the stored options. One-time links become inactive after use.

Record link activity

What
A link stores its click count and last visit.
Why
The owner can see whether the link is being used.
How
The application updates the link record when handling a visit.

Data Architecture & Schema

The PostgreSQL Link model stores the original URL, short code, optional alias, password hash, expiry, activity status and click information. Short codes and custom aliases are unique. This keeps link options together with the destination they control.

originalUrl
Destination URL
shortCode
Unique short identifier
customAlias
Optional, unique alias
password
Optional password hash
expiresAt
Optional expiry date
oneTimeUse
Single-use setting
clicks
Visit count
lastVisited
Last visit time
isActive
Whether the link is active

API & System Workflow

POST /api/links receives the URL and options, validates the request, checks the alias, hashes a supplied password and creates the link record. A successful creation returns the new link with HTTP 201. Invalid input returns an error response.

  1. Request
  2. Zod Validation
  3. Application Logic
  4. PostgreSQL
  5. Response

End-to-end system lifecycle

Representative Implementation

API validation & persistence · Creating the Link record. Excerpt from the repository source.

src/app/api/links/route.tsTypeScript
const newLink = await prisma.link.create({
  data: {
    userId,
    originalUrl: normalizedUrl,
    shortCode,
    customAlias: parsed.customAlias || null,
    password: hashedPassword,
    expiresAt: parsed.expiresAt ? new Date(parsed.expiresAt) : null,
    oneTimeUse: parsed.oneTimeUse,
  },
})
API validation & persistence · Creating the Link record
Read file on GitHub

Interface & Features

The form connects the destination URL and optional link settings to the create-link API. The result gives the user a short link to share.

  • Request validation
  • Custom aliases and unique links
  • Password and expiry checks
  • Click tracking and one-time use

Technology Stack

  • Next.js
  • TypeScript
  • Node.js
  • PostgreSQL

TypeScript · Next.js · Node.js · PostgreSQL · REST APIs · Authentication/security-related application logic · Database constraints · Error handling

Source Repositories

Open GitHub repository

Live Deployment

Run NanoLink