Giter Site home page Giter Site logo

short-d / short Goto Github PK

View Code? Open in Web Editor NEW
865.0 865.0 146.0 22.58 MB

URL shortening service written in Go and React

Home Page: https://short-d.com

License: MIT License

Go 67.36% HTML 0.89% CSS 4.17% JavaScript 0.88% TypeScript 25.41% Shell 1.05% Dockerfile 0.19% TSQL 0.04%
clean-architecture codeclimate codecov continuous-delivery datadog gitops go grpc ipstack kubernetes microservices-architecture oauth postgresql react recaptcha scss segement solid-principles typescript unit-testing

short's People

Contributors

akrifari avatar arberiii avatar ashakibp avatar coderworld10 avatar coteh avatar dawntomm avatar dean430 avatar dedifferentiator avatar dependabot[bot] avatar jackieyjc avatar kamalashreen avatar kapillamba4 avatar lucifercr07 avatar mrclan avatar nathan815 avatar oatovar avatar richardbertozzo avatar rohithbalaji123 avatar shade34321 avatar tlac avatar zhenhangtung 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

short's Issues

Refactor the frontend to use Redux

App behaviors are currently delegated to Home page component. This lead to very messy code that are hard to read, change, or test. Home page component should use Redux to decouple state management away from presentation.

Allowing user to edit their short links

User should be able to edit the short links they created. This involves:

  • Add edit & delete button to the Short links that are created by the user in React
  • Add GraphQL API to update the mutated short links

Please create a separate issue for each litem listed here and link them back to this one.

[Feature] Add private / public option when creating short link

Currently, all the short links created are private to their authors. We want to encourage people to share some of their short links with others to give back to the community.

To achieve this:

  • Add a toggle button on the short link creation panel to allow use to specify whether the short link created will be publicly available. By default, the short link should be private by default.
  • Add a database attribute to indicate whether the short link is public.
  • Update GraphQL short link creation API with new argument

Please create a separate issue for each litem listed here and link them back to this one.

Show public short links on index page

When users visit https://short-d.com/public, they should see all the public short links This involves:

  • Add React route & components to show the list of public short links
  • Add GraphQL API to query all public short links

Please create a separate issue for each litem listed here and link them back to this one.

Log URL redirections

Currently, there is no log user requests to track service usage statistics.

As a data analyst, I want to log all the url redirect requests, with city code and timestamp, in order to understand which city those redirections are coming from and how many redirection the service has to process every hour.

Configure staging environment

Currently, the changes will be deployed onto production server after merging pull request to production branch. Ideally, the PR should be deployed to pre-production environment after merging to master branch so that the developer can preview & verify the changes.

Support daily database backup

It has been two times when I had to recover data from previous manual database backups. This is very unreliable and time consuming.

Create health check API

Currently, there is no standardized way for load balancer to automatically determine the liveness of a service in order to route the traffic to the available server.

Receive "auth token is invalid" when creating a link

Was trying to get the development environment setup to make a contribution, and opened up the app to make a short link. I authenticated with GitHub, defined a link and clicked "Create Short Link". It asked me to authenticate with GitHub again. I peered into the Network tab and noticed the following response from the createUrl GraphQL path:

auth token is invalid

I tried the same thing in production and noticed that production was getting the same error, so I decided to post this here. Let me know if you want more info, thanks!

Migrate production to Kubernetes

Currently, we are using Docker compose file to manage Short production deployment. However, Short replies on Key Generation Service in order to correctly operate. In the future, Short may reply on more microservices. To ease container management and debugging, we are migrating Short production to kubernetes.

Add sample ReCAPTCHA configuration to README

The current README did not mention how to properly setup ReCAPTCHA in order for new developers to test their new features locally.

Success criteria

A new developer should be able to setup ReCAPTCHA for local testing with no effort.

Add change log modal

Is your feature request related to a problem? Please describe.
Many updates are made to Short. Users don't know them.

Describe the solution you'd like
Add updates modal to remind users. Once users closed the modal for this release, it shouldn't automatically popup again. Users should be able to reopen it by clicking on a button in the footer.

image

Configure Drone CI to run DB integration tests

Currently, there are only unit tests running on the CI. There is no integration tests covering the GraphQL and RESTful. To avoid breaking critical features in the future, we want to add integration tests to automatically verify those feature are not breaking when merging to master branch.

Success criteria

Integration tests are running for the branches that have pull requests opened for.

Configure Kubernetes

Short is now depending on Key Gen service. It will also be depending on auth service, feature toggle service, etc... Kubernetes is here to help manage all those services.

Decouple queries & mutations from authentication

API consumers have to pass authToken and captchaResponse to createURL endpoint. However, createURL only cares who the user is instead of how to identify the user. Add authQuery and authMutation to handle user identification.

Examples:

Query

query {
  authQuery(authToken: "token") {
     URL(alias: "test1") {
      alias
      originalURL
      expireAt
    }
  }
}

Mutation

mutation createURL($url: URLInput!){
  authMutation(authToken: "token", captchaResponse: "captchaResponse") {
     createURL(url: $url) {
      alias
      originalURL
      expireAt
    }
  }
}

Add query parameter to automatically fill in long URL.

Scenario

After the user clicks the icon of the Chrome Extension
Screen Shot 2019-10-07 at 8 47 10 AM
, the extension will grab the URL of the current page and redirect the user to the app’s home page with &long_link=http://the_current_page_url appended in the URL. The page automatically fill in the URL of the current page, and move the cursor to the alias text field, waiting for the user to create a the short link.

Success criteria

The page automatically fill in the URL of the current page if the URL has &long_link=http://the_current_page_urlappended. It then move the cursor to the alias text field, waiting for the user to create a the short link.

Setting Up Alert Manager on Kubernetes

Is your feature request related to a problem? Please describe.
Kubernetes pods enter crash loop without alert .

Describe the solution you'd like
Configure Prometheus Monitoring & Alert manager to send notifications to devops Slack channel when service crashes.

[Feature] Configure testing environment

What is the problem?
Currently, developers don't have their own sandboxed environment to verify their feature is working properly with the underlying infrastructure.

Your solution
Configure testing environment and automatically deploy PR branch ending with *-testing. Delete the environment when the branch is deleted.

Alternatives considered
Launch Kubernete cluster on local machine. This involves extensive configurations and complex setup. It's forces each new team members to spend weeks to months to learn Kubernetes in order to configure their local environment.

[Refactor] Move construction code closer to struct definition

What is the problem?
Constructor is put at bottom of code which makes it hard to find for developers.

Your solution
Put constructor close to struct definition.

Alternatives considered
Leave constructor as it is, because it's less likely to be changed.

Error when build the container using docker-compose

From the README:

Start server

docker-compose up

When I want to build the container using docker-compose up. It returns this following error

WARNING: The DOCKERHUB_USERNAME variable is not set. Defaulting to a blank string.
Pulling app (/short:)...
ERROR: invalid reference format

So I ended up added DOCKERHUB_USERNAME variable explicitly when running docker-compose up and it sucessfully builds, for instance

DOCKERHUB_USERNAME=byliuyang docker-compose up

Is this intended?

Improve test coverage

Currently, code coverage is only 55%. We want to add more unit tests to the backend APIs to improve developer confidence. Refactor may be needed to improve the testability of the code. Let's do it incrementally.

Success criteria

Increase code coverage for app/usecase/url package to 100%.

Repeatedly request sign in

The sign in dialog shows up repeatedly when trying to create a short link. This happens when user's Github email is empty.

Screen Shot 2019-09-30 at 10 33 19 PM

Create feature toggle service

Feature toggle allows us to:

  • Temporarily turn off a feature until it's ready for launch
  • Performance A / B testing to validate different designs of a feature

Multi-stage build for frontend and backend

I found out that one can use either image from the hub or pre-build frontend application locally to pack it to docker.

That means that you have to have yarn installed locally if you make changes to the frontend.

There is a similar problem with backend. Distribution can carry only binary (which will make it much more lightweight) instead of carrying the whole golang sdk.

I would suggest enabling frontend build with docker multi-stage build for frontend (and possibly for backend). I'm working on PR for that.

Add sample Github OAuth configuration to README

The current README did not mention how to properly setup Github OAuth in order for new developers to test their new features locally.

Success criteria

A new developer should be able to setup Github OAuth for local testing with no effort.

Create admin dashboard

Currently, we are manual logging into the server to manage Short's database. This is very inconvenient.

Let's create a admin dashboard so that we can:

  1. Add a short link
  2. List all the short links and their owners
  3. Attach a short link to a user
  4. Edit existing short links
  5. Delete short links
  6. The admin can upgrade an user to admin
  7. The admin can downgrade an admin to an normal user
  8. The admin can disable user account.

This involves:

  1. Create user role database table to manage permissions
  2. Create required GraphQL apis
  3. Create admin UI in React

Bonus features:

  1. visualize the traffics and usage data.

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.