A straightforward application that transforms lengthy URLs into concise, shareable links, built with Express.js.
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.
-
Clone the repository:
git clone [email protected]:GabrielMorettii/url-shortener.git cd url-shortener
-
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. -
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.
-
Clone the repository:
git clone [email protected]:GabrielMorettii/url-shortener.git cd url-shortener
-
Install dependencies:
npm install
-
Configure environment variables: Create a
.env
file in the root directory and configure the necessary environment variables as outlined in the.env.example
file. -
Generate database schemas:
npx prisma generate
-
Deploy the database migrations:
npx prisma migrate deploy
-
Launch the application:
npm run dev
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.
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