Skip to content

Modern, lightweight, planet-scale link shortener for teams πŸŽ‰

License

Notifications You must be signed in to change notification settings

denzuko-forked/blink

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Welcome to Blink πŸ‘‹

CircleCI Prettier code style Deploy to Heroku

Modern, lightweight, planet-scale link shortener for teams πŸŽ‰

Easy to setup, connect with your org's SSO, and hook up analytics!

See the documentation for more information about the project itself (including screenshots)

Development

Prerequisites

You need the following components to develop and run Blink locally:

  • mkcert
  • docker & docker-compose (note that on Linux, docker & docker-compose are two separate deps)

Before you start

  1. Run make cert to generate the SSL certs required for HTTPS local development

  2. Run make up to stand up the containers

And once you're done with development, you can run make down to shut down and cleanup all the containers that spun up.

NOTE: that you actually do not have to run the cleanup every time you npm start; you can shut down the npm start server/frontend combo and re-boot it as many times as you'd like without needing to make up every time - the migrations and the build process will run fine even with existing data(!)

Starting Blink

Run make run to boot up backend express server and frontend react "live-loader". You can access the app at https://localhost/app (or localhost/app, both works)! Both the frontend and the backend will live-reload as you make changes. You can login as the user specified at the end of config/keycloak.json (username: user, password: Password1).

Behind the scenes, the frontend (a create-react-app app) is running at http://localhost:4000/app and is being reverse proxied from https://localhost/app, and everything else in https://localhost gets proxied to the backend at http://localhost:3000. Yes, there are two processes running in the container pretending to be one "site", but this kind of routing (thanks Traefik!) allows us to not have horrible routing issues (stemming from the fact that even though they're both http://localhost, the different port means they're effectively two different sites and leads to a whole host of routing, CORS, and other integration issues), and allows testing of features that are only available for HTTPS in order to simulate real-world usage as much as possible.

Troubleshooting

If you can't reach any service or if you suspect the routing is messed up, first check https://traefik.localhost to make sure that everything is configured correctly.

If you need to run a one-off command with the app container, run make run COMMAND=$whatever, and if you want to hook into the existing app container, run make exec COMMAND=sh.

Note that for performance/security reasons, the app container is built end-to-end with alpine-based images, so you won't have access to anything fancy like, say, bash.

Run tests

NODE_ENV=test make run COMMAND='npm test'

# or, for interactive testing:
NODE_ENV=test make run COMMAND=sh
$ npm run test:watch

The test also automatically runs before you push your commits.

Note that whatever NODE_ENV you set during... well, basically any docker-compose command will be automatically passed down to the underlying dockerfile/image/container.

Author

πŸ‘€ Jane Jeon

🀝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!

πŸ“ License

Copyright Β© 2021 Jane Jeon.
This project is AGPL-3.0 licensed (TL;DR: please contribute back improvements to this application).


This project is based off of Express-Objection-Template, and heavily uses objection-authorize and objection-hashid to drive much of "hidden" logic and make isomorphism possible.

About

Modern, lightweight, planet-scale link shortener for teams πŸŽ‰

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 90.8%
  • CSS 2.4%
  • HTML 2.1%
  • Dockerfile 1.9%
  • Shell 1.5%
  • Makefile 1.3%