Skip to content

A straightforward application that transforms lengthy URLs into concise, shareable links, built with Express.js.

Notifications You must be signed in to change notification settings

GabrielMorettii/url-shortener

Repository files navigation

URL Shortening Service

A straightforward application that transforms lengthy URLs into concise, shareable links, built with Express.js.

Documentation

The URL Shortening Service provides comprehensive API documentation via Swagger. You can access the documentation by navigating to the following endpoint in your browser after the application is running:

Swagger Docs: http://localhost:3030/api-docs

This interactive documentation allows you to explore the available endpoints, their parameters, and responses, making it easier to understand how to integrate with the service.

Getting Started

Using Docker Compose

  1. Clone the repository:

    git clone [email protected]:GabrielMorettii/url-shortener.git
    cd url-shortener
  2. Set up the .env file: Create a .env file in the root directory, and populate it with the required environment variables. You can find examples in the provided .env.example file.

  3. Start the application with Docker:

    docker-compose up -d --build

    This command will compile the Docker images and initiate the application along with any necessary services like the database.

Manual Installation

  1. Clone the repository:

    git clone [email protected]:GabrielMorettii/url-shortener.git
    cd url-shortener
  2. Install dependencies:

    npm install
  3. Configure environment variables: Create a .env file in the root directory and configure the necessary environment variables as outlined in the .env.example file.

  4. Generate database schemas:

    npx prisma generate
  5. Deploy the database migrations:

    npx prisma migrate deploy
  6. Launch the application:

    npm run dev

Postman Collection

A Postman collection is available in the root of the project to facilitate testing the API endpoints. You can import this collection into Postman and create a new environment with the following variable:

  • BASE_URL=http://localhost:3030

This environment variable ensures the requests are directed to the correct base URL for local testing.

Design Patterns

This project applies a range of design patterns to build a flexible, modular, and maintainable architecture. Each pattern has been selected to address specific challenges and ensure that the code remains scalable and adaptable to future changes.

  • Factory
  • Adapter
  • Composite
  • Proxy
  • Dependency Injection
  • Abstract Server
  • Composition Root
  • Builder
  • Singleton

Made by

About

A straightforward application that transforms lengthy URLs into concise, shareable links, built with Express.js.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages