Git Product home page Git Product logo

swiftlink's Introduction

image 138

Contributors Forks Stargazers Issues MIT License LinkedIn

๐Ÿ“ SwiftLink - Modern Shortener Link Project

dotnet-version

Introduction and Architecture

Welcome to the SwiftLink project, a .NET 8 application designed to streamline link shortening. This README provides comprehensive instructions on how to clone, restore, build, and run the project. Additionally, it covers database migration and the usage of a Redis container via Docker.

For More Information, Please Read Our Documentation

Architecture

Core Features

Link Shortening: Allows users to generate shortened URLs from longer ones, making them easier to share and manage.

Customizable Shortened Paths: Through the Back-Half Option feature, users can customize the path or identifier that follows the base URL of a shortened link.

Tagging for Shortened Links The tagging feature in SwiftLink allows users to add multiple tags to a shortened link for better identification and organization. This feature enhances the usability of the system by enabling users to categorize and manage their links more effectively. Tags are simple yet powerful identifiers that help users classify their shortened links based on various criteria such as project names, link types, urgency levels, or any other categorization scheme the user finds useful. By attaching tags to links, users can easily filter and locate their links within the SwiftLink dashboard or through API queries.

  • Benefits Enhanced Organization: Users can categorize their links in a way that makes sense for their personal or organizational needs. Improved Searchability: Tags make it easier to search for and filter links, especially when dealing with a large number of shortened URLs. Customization: The ability to define custom tags provides flexibility, allowing users to tailor the system to their specific use cases.

Password Protection for Shortened Links The password protection feature in SwiftLink allows users to set a password for a shortened link. This ensures that only individuals with the password can access the original URL linked to the shortened link. This feature is particularly useful for securing direct access to files or sensitive content.

  • Benefits Enhanced Security: Password protection adds an extra layer of security, ensuring that only authorized users can access the content linked to the shortened URL. Flexibility: By allowing the password to be nullable, the system offers flexibility in how links are secured, catering to both sensitive and non-sensitive content.

Link Expiration Reminder The SwiftLink system includes a feature that allows users to set reminders for their shortened links. This feature is designed to notify users via email when their links are approaching expiration.

  • Benefits Proactive Notifications: Users are proactively notified about the expiration of their links, allowing them to take necessary actions, such as extending the link's life or notifying their audience. Enhanced User Experience: By ensuring users are aware of link expirations, SwiftLink improves the overall user experience, making link management more efficient and less prone to oversight. Customizable Reminders: Users can set reminders based on their specific needs, offering flexibility in how they manage their links.

Link Resolution and Visiting: The application handles the resolution of shortened URLs to their original URLs and tracks visits.

Analytics: Tracks and provides insights into the number of users who click on a shortened link via the LinkVisit entity.

Resilience and Transient-Fault-Handling: Utilizes Polly for resilience strategies, ensuring the application can handle and recover from transient faults effectively.

Authentication for Subscribers: Implements an authentication mechanism for subscribers, allowing for the creation and management of subscriber accounts.

Link Management: Users can create, disable, enable, and manage links, including setting expiration dates and adding tags for organization.

Subscriber Management: Allows for the creation and management of subscriber accounts, including activation and deactivation of accounts.

Technical Features

Clean Architecture: The project is structured using Clean Architecture principles, separating concerns and making the codebase more maintainable.

Domain-Driven Design (DDD): Implements DDD principles in the domain layer, organizing the code around the business domain and its logic.

Caching with Redis: Utilizes Redis for caching, enhancing performance and scalability.

Resilience with Polly: Integrates Polly for advanced resilience policies, including retries and circuit breakers.

API Documentation: Provides Swagger integration for API documentation and testing.

Global Exception Handling: Implements global exception handling for centralized error management.

Validation: Uses FluentValidation for input validation, ensuring data integrity and providing meaningful error messages.

Logging and Monitoring: Incorporates logging and potentially monitoring mechanisms to track the application's health and usage.

Dependency Injection: Utilizes dependency injection for managing dependencies, improving code modularity and testability.

Entity Framework Core: Leverages EF Core for data access and management, including support for migrations.

Docker Support: Includes instructions for setting up a Redis container via Docker, indicating support for containerization.

Development and Deployment Features

.NET 8 Application: Built with .NET 8, ensuring modern features and performance optimizations.

Database Migration Support: Offers guidance on database migration, facilitating deployment and updates.

Docker Integration: Provides instructions for using Docker, particularly for Redis, which suggests the application is designed with containerization in mind.

This summary encapsulates the features and capabilities of the SwiftLink application as inferred from the provided documentation and code structure.

๐Ÿ’พ Getting Started

Prerequisites

Make sure you have the following tools installed on your machine:

.NET 8 SDK Git Docker Cloning the Repository Open your terminal or command prompt and run the following command:

  • bash
git clone https://github.com/mohammadKarimi/SwiftLink.git

This will create a local copy of the SwiftLink repository on your machine.

Restoring Dependencies

Navigate to the project directory:

  • bash
cd SwiftLink

Run the following command to restore project dependencies:

  • bash
dotnet restore

Updating Database and Connection String

For Adding Your Connection String(in Development phase) please add a user-sercret file with visual-studio and locate your connection string there. For Adding Your Connection String(In Production phase) please add your connection string in appsettings.Production.json, locate the connection string and update it accordingly. This connection string is crucial for updating the database during migrations.

  • json
{
  "ConnectionStrings": {
    "DefaultConnection": "YourUpdatedConnectionString"
  },
  // Other configurations...
}

Next, apply the database migrations using the following command:

  • bash
dotnet ef database update

OR

  • PMC (package manager console)
Update-Database

Redis Container

This project utilizes a Redis container to manage caching. Ensure that Docker is running and execute the following command to pull the Redis image:

  • bash
docker pull redis

Once the image is downloaded, start a Redis container:

  • bash
docker run -d -p 6379:6379 --name swiftlink-redis redis

Building and Running the Project

Now that everything is set up, build and run the SwiftLink project using the following commands:

  • bash
dotnet build
dotnet run

Access the application by navigating to https://localhost:44314 in your web browser.

That's it! You've successfully cloned, restored, and run the SwiftLink project with database migration and a Redis container. If you encounter any issues, refer to the project documentation or seek help from the community. Happy coding!

Contributions and bug reports are welcome.

๐ŸŒˆ Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

๐ŸŒŸ Support this project

If you believe this project has potential, feel free to star this repo just like many amazing people have.

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

swiftlink's People

Contributors

alliir3za avatar dependabot[bot] avatar kamyab7 avatar mohamadreza-khani avatar mohammadkarimi avatar parhamdarvishi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

swiftlink's Issues

namespace typo

Hey @mohammadKarimi Thanks for creating such a good URL shortener service.

After reviewing your repository I found a small typo in these namespaces:

  • namespace SwiftLink.Application.UseCases.Links.Commmands;
  • namespace SwiftLink.Application.UseCases.Links.Commmands;
  • namespace SwiftLink.Application.UseCases.Links.Commmands;
  • namespace SwiftLink.Application.UseCases.Links.Commmands;
  • using SwiftLink.Application.UseCases.Links.Commmands;

Tagging Search

The current implementation supports tags and grouping. You could enhance this by implementing features like tag-based search or group management, allowing users to organize and find their links more efficiently.

Generating random numbers from multiple threads

Hey @mohammadKarimi

In HashBasedShortCodeGenerator you are trying to use the lock keyword to make it thread-safe and it's totally fine but I want to suggest Random.Shared.

As I know, recording to this article building-a-thread-safe-random-implementation written by @andrewlock, The humble Random class has been around since .NET Framework 1.0, but an important thing to bear in mind is that it's not thread-safe by default.
I'm going to describe. If you're generating random numbers in .NET 6+, you don't need to control the "seed" value, and you need thread-safe access, then you can use Random.Shared.

Add database Initializer

Just a small enhancement :)
Implement a functionality like @jasontaylordev did in here to update database and seed required data for development automatically, for instance, seed a default subscriber in development mode for boost development speed.

Add cusyom back-half to original link

In this issue we want to get a shortenKey from customer instead of generated by ourself.

For instance:
Customer can give us a back-half like "tvfinder" for hiz link

Result :
Swiftlink.com/tvfinder
Instead of
Swiftlink.com/bv76XcY8vS90

Add cusyom back-half to original link

In this issue we want to get a shortenKey from customer instead of generated by ourself.

For instance:
Customer can give us a back-half like "tvfinder" for hiz link

Result :
Swiftlink.com/tvfinder
Instead of
Swiftlink.com/bv76XcY8vS90

Add UserSecret File and Move the connectionString Into it.

A security concern has been identified regarding the inclusion of the connection string in the appsettings.json file. To address this issue and enhance security measures, it is imperative to relocate the connection string to the User secret file.

Custom Back Half Validation

The GenerateShortCodeValidator ensures that the custom back half is not already in use. You might also want to enforce a consistent format for custom back halves (e.g., length restrictions, allowed characters) to ensure they meet your URL shortening service's standards.

Retrieve a Swiftlink with ID

let's create a scenario for retrieving a SwiftLink by its ID. This scenario will be for a hypothetical RetrieveLinkByIdQueryHandler, which is not explicitly defined in the provided context but follows a similar pattern to the VisitShortenLinkQueryHandler.

Scenario: Retrieve a SwiftLink by ID
Objective: To retrieve a SwiftLink's details by its unique identifier (ID).

Actors
User: Initiates the request to retrieve the SwiftLink details.
System/Application: Processes the request and returns the SwiftLink details.
Preconditions
The user has the unique ID of the SwiftLink they wish to retrieve.
The SwiftLink with the specified ID exists in the database.

Analytics Dashboard for SwiftLinks

Is your feature request related to a problem? Please describe. Users currently have no way to track the performance of their SwiftLinks. They cannot see how many times a link has been clicked, where the traffic is coming from, or when the link is most active. This lack of insight makes it difficult for users to understand the impact of their shared links.

Describe the solution you'd like I would like to see an analytics dashboard feature implemented. This dashboard would provide users with detailed statistics about their SwiftLinks, including:

Total clicks over time
Click-through rate (CTR)
Geographic distribution of clicks
Referrer information (where the clicks are coming from)
Time of day/week analytics
The dashboard should be accessible through the user's account, with the ability to filter data by date range and link.

Describe alternatives you've considered An alternative solution could be to integrate with existing analytics platforms like Google Analytics or Matomo by providing users with a way to add tracking codes to their SwiftLinks. However, this might increase complexity for users who are not familiar with these platforms.

Additional context Adding an analytics dashboard would significantly enhance the value proposition of SwiftLink by enabling users to measure the effectiveness of their links. This feature could also open up opportunities for advanced functionalities in the future, such as A/B testing different link versions to optimize click-through rates.

Database connection string

I am not sure but I think SSMS provides a server instance which name is (localdb)\mssqllocaldb as default which means we can replace this personal connection string Server=DESKTOP-TVCSFN3\\MHA;Database=SwiftLink;Trusted_Connection=True;Encrypt=false by Server=(localdb)\\mssqllocaldb;Database=SwiftLink;Trusted_Connection=True;MultipleActiveResultSets=true by doing so we can remove Updating Database and Connection String part from readme file cause it will already correct for all the machines.

Add .editorconfig

A .editorconfig file for enforcing best practices like the naming convention and treating unused uses as errors can be a great enhancement.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.