The shr.tn
application serves as an intuitive and streamlined gateway to GitHub repositories and potentially other social media platforms. By navigating to shr.tn/
, users can enter minimally unique character sequences to find and share GitHub repositories effortlessly. For instance, navigating to shr.tn/opnai/gpt
could redirect to OpenAI/gpt-2
, and shr.tn/tens
might lead to tensorflow/tensorflow
. The aim is to simplify the sharing and discovery of repositories by replacing long URLs with short, easily shareable links.
Additionally, while the primary focus is GitHub, the foundational logic for fuzzy matching and redirection could readily be extended to other platforms like Facebook, LinkedIn, Instagram, Twitter, and YouTube.
Built with OpenFaaS and Go, the shr.tn
application consists of a custom router (RequestRouter
) and two serverless functions (ExecuteFuzzySearch
, ManageOutboundRouting
). The development will strictly adhere to Test-Driven Development (TDD) principles, especially for the Go functions.
- User Interface: Custom domain
shr.tn/
for user input. - RequestRouter: HTTP router for URL parsing and directive handling.
- OpenFaaS Gateway: Routes to the appropriate serverless function.
- Serverless Functions:
ExecuteFuzzySearch
andManageOutboundRouting
. - Backend: GitHub API.
- Input: Raw URL.
- Output: Parsed URL and HTTP header directive (
X-Function-Invocation
).
- Input: Parsed strings (GitHub username or username/repo).
- Output: Best-matching GitHub username and/or repository.
- Input: Best-matching GitHub username and/or repository.
- Output: HTTP redirect to GitHub repository.
-
Multi-Stage Dockerfile Creation:
- Stage 1: Go build environment.
- Stage 2: Barebones runtime environment.
-
Initial Function Prototyping using TDD:
- Create skeleton Go functions (
ExecuteFuzzySearch
,ManageOutboundRouting
) following Test-Driven Development.
- Create skeleton Go functions (
-
Dockerization of Functions:
- Containerize the Go functions using the multi-stage Dockerfile.
-
OpenFaaS Environment Setup:
- Deploy OpenFaaS and configure the Gateway.
-
RequestRouter Implementation:
- Develop and test the
RequestRouter
.
- Develop and test the
-
Function Logic Implementation using TDD:
- Complete core logic of
ExecuteFuzzySearch
andManageOutboundRouting
following Test-Driven Development.
- Complete core logic of
-
GitHub API Integration:
- Implement API calls for fuzzy search functionality.
-
Testing:
- Unit tests, integration tests, and load tests.
-
Deployment and Scaling:
- Deploy to production and implement scaling strategies.
-
Documentation:
- Code comments, README, and end-user documentation.
- Unit Tests: Utilize Go's testing framework for function logic.
- Integration Tests: Validate GitHub API and OpenFaaS integration.
- Load Tests: Examine performance under simulated high-traffic scenarios.