This is a simple url shortener written in golang. It uses pulumi to deploy to AWS Lambda with API Gateway.
- Support for multiple database storage options (in-memory, PostgreSQL).
- Deploy to AWS Lambda using Pulumi
- Integration of custom domains via ACM.
- Encode IDs using a base-62
- Rest API Format
- Using Snowflake ID Generator (Epoch + NodeID + Sequence)
- Epoch is 2023-10-29 00:00:00`
- Add e2e tests
- Add Frontend Web UI
Deployed to AWS Lambda with API Gateway.
curl -X POST https://s.m0ai.dev/shorten\?url\=https://google.com | jq
> {
> "short_url": "https://s.m0ai.dev/AaecfgMo",
> "url": "https://google.com"
> }
curl -X GET https://s.m0ai.dev/AaecfgMo
> HTTP/1.1 308 Permanent Redirect
> Content-Type: text/html; charset=utf-8
> Location: https://google.com
> Date: Sun, 29 Oct 2023 08:26:53 GMT
# clone the repo
make deploy
# if you want to deploy to your own domain
# Domain and ACM is required
DOMAIN=yourdomain.com make deploy