Skip to content

A powerful .NET 8 URL shortener with JWT auth analytics and caching designed for scalability and security.

License

Notifications You must be signed in to change notification settings

ScriptSage001/Shortify.NET

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

162 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shortify.NET

logo

project-image

A powerful .NET 8 URL shortener with JWT auth analytics and caching designed for scalability and security.


Code Quality

Qodana


✨ Why Use Shortify.NET?

  • Scalable and Secure: Built with .NET 8, ensuring high performance and strong security measures.
  • JWT Authentication: Secure user management and role-based access control.
  • Caching: Accelerated redirection using Redis for optimal performance.
  • Ease of Use: A simple API interface, designed to integrate seamlessly into any application.
  • Analytics: Gain insights into URL usage patterns. (Coming Soon)

🧩 Features

  • Generate short URLs quickly and efficiently.
  • Secure endpoints with JWT authentication.
  • Track detailed analytics for shortened URLs.
  • Support for custom aliases.
  • Scalable design for high availability.
  • Dockerized for easy deployment.

🚀 Tech Stack

  • Backend: .NET 8
  • Database: PostgreSQL (Supabase-hosted)
  • Caching: Redis
  • Containerization: Docker
  • API Documentation: Swagger
  • CI/CD: GitHub Actions
  • Hosting Platform: Render
  • Static Code Analysis: Qodana

🛠️ Installation and Setup:

Using Docker

1. Pull the Docker Image:

docker pull thescriptsage/shortifynetapi

2. Set Up Required Environment Variables:

Ensure the following environment variables are set before running the container:
  • DB_CONNECTION: Connection string for the PostgreSQL database (e.g., Host=localhost;Port=5432;Database=Shortify;Username=yourUsername;Password=yourPassword).
  • REDIS_CONNECTION: Connection string for Redis (e.g., localhost:6379).
  • APP_SECRET: A secret key for signing JWT tokens.
  • CLIENT_SECRET: Client-specific secret for enhanced security.
  • SENDER_EMAIL: Email address for sending OTPs or notifications.
  • SENDER_EMAIL_PASSWORD: Password for the sender email.
  • ALLOWED_HOST: A comma-separated list of allowed host URLs.

3. Run the Docker Container:

docker run -d -p 5000:80 \
  -e DB_CONNECTION="Host=localhost;Port=5432;Database=Shortify;Username=yourUsername;Password=yourPassword" \
  -e REDIS_CONNECTION="localhost:6379" \
  -e APP_SECRET="yourAppSecret" \
  -e CLIENT_SECRET="yourClientSecret" \
  -e SENDER_EMAIL="yourEmail@gmail.com" \
  -e SENDER_EMAIL_PASSWORD="yourEmailPassword" \
  -e ALLOWED_HOST="http://localhost,http://example.com" \
  thescriptsage/shortifynetapi

3. Access the Swagger UI:

Visit http://localhost:5000/swagger/index.html to explore the API.



Local Development

1. Clone the Repository:

git clone https://github.com/ScriptSage001/Shortify.NET.git
cd Shortify.NET

2. Configure Environment Variables:

Use an environment variable manager or .env file to configure the following values:
  • DB_CONNECTION: Connection string for the PostgreSQL database (e.g., Host=localhost;Port=5432;Database=Shortify;Username=yourUsername;Password=yourPassword).
  • REDIS_CONNECTION: Connection string for Redis (e.g., localhost:6379).
  • APP_SECRET: A secret key for signing JWT tokens.
  • CLIENT_SECRET: Client-specific secret for enhanced security.
  • SENDER_EMAIL: Email address for sending OTPs or notifications.
  • SENDER_EMAIL_PASSWORD: Password for the sender email.
  • ALLOWED_HOST: A comma-separated list of allowed host URLs.

Example .env file:

DB_CONNECTION=Host=localhost;Port=5432;Database=Shortify;Username=yourUsername;Password=yourPassword
REDIS_CONNECTION=localhost:6379
APP_SECRET=yourAppSecret
CLIENT_SECRET=yourClientSecret
SENDER_EMAIL=yourEmail@gmail.com
SENDER_EMAIL_PASSWORD=yourEmailPassword
ALLOWED_HOST=http://localhost,http://example.com

3. Install Dependencies:

Ensure you have the .NET 8 SDK installed. Then, restore the NuGet packages:
dotnet restore

4. Run the Application:

dotnet run

5. Access the Swagger UI:

Swagger UI will be available at http://localhost:5000/swagger/index.html or the port specified in the console logs.


📚 API Documentation

The API is fully documented using Swagger. Access the live documentation here:

🍰 Contribution Guidelines:

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!

How to Contribute

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


📸 Screenshots

Swagger UI

swagger-ui-01

swagger-ui-02

swagger-ui-03


🛡️ License:

This project is licensed under the Apache License. See the LICENSE file for details.


🌟 Acknowledgments

  • Inspiration from modern URL shorteners like Bitly.
  • Thanks to the .NET community for continuous support and tools.

About

A powerful .NET 8 URL shortener with JWT auth analytics and caching designed for scalability and security.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages