https://github.com/vzsoares/shortener
URL Shortener - Go - AWS Free tier - Terraform | Lambda DynamoDB S3
https://github.com/vzsoares/shortener
go shortener url-shortener
Last synced: 3 months ago
JSON representation
URL Shortener - Go - AWS Free tier - Terraform | Lambda DynamoDB S3
- Host: GitHub
- URL: https://github.com/vzsoares/shortener
- Owner: vzsoares
- License: mit
- Created: 2024-06-01T17:17:02.000Z (about 1 year ago)
- Default Branch: prod
- Last Pushed: 2024-10-01T23:57:35.000Z (9 months ago)
- Last Synced: 2025-01-25T21:55:22.503Z (5 months ago)
- Topics: go, shortener, url-shortener
- Language: Go
- Homepage: https://s.zenhalab.com
- Size: 13.2 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Shortener





[](https://www.linkedin.com/in/vinicius-zenha/)
![]()
Deploy your own shortener service in the aws free tier. Made in Go with minimal dependencies. Raw HTML JS and _tailwind_ front. Main _engine_ to integrate with other internal services.
## Features 🚀
- Fully serverless pay per request
- Terraform infra
- Github actions
- Generic main engine
- Easily integrate using a api-key
- Bff implementation example### Requirements 🛠️
- make
- aws-cli
- terraform
- go
- node
- yarn## Setup 🦩
Make sure to have all requirements.
local:
1. Clone the repo
2. Install node dependencies with `yarn install`
3. Copy `.env.example` to `.env.dev` and `.env.prod` and fill the values
> Some values only exist after running Terraform apply
1. configure aws credentials
4. Configure your runner in `nx.json tasksRunnerOptions`
5. ⚠️Configure the Terraform provider `backend` by changing or removing the `provider.tf backend` section in each environment
6. export AWS_PROFILE={your-profile}
7. Deploy **once** with `nx run shortener:first-deploy:dev` and `nx run shortener:first-deploy:prod`
8. Get the cloudfront distribution id and put it on your envs
9. Finally deploy with `nx run shortener:deploy:dev` and `nx run shortener:deploy:prod`github actions:
- configure a `prod` and `dev` environment with:
- secrets:
- AWS_ACCESS_KEY_ID
- AWS_PROFILE
- AWS_REGION
- AWS_SECRET_ACCESS_KEY
- variables:
> same as .env
- API_BASE_URL
- API_BASE_URL_DOMAIN
- ARTIFACTS_BUCKET_NAME
- DYNAMO_URL_TABLE_NAME
- FRONT_BASE_URL
- FRONT_BASE_URL_DOMAIN
- FRONT_BUCKET_NAME
- FRONT_CLOUDFRONT_DISTRIBUTION_ID
- GATEWAY_API_NAME
- NX_RUNNER
- STAGE## Usage ☃️
See all available commands bellow and use with: `nx run {project}:{task}:{environment}`.
Ex: `nx run engine:serve:dev` to start a local api.| Projects | Tasks |
|--------------|----------------------------------------------------------|
| engine | build, lint, serve, test, tidy |
| front | build, lint, publish, serve, test, tidy |
| public-api | build, lint, serve, test, tidy |
| utils | lint, test, tidy |
| shortener | deploy, first-deploy |## Architecture 🎨
See in [/docs](/docs)
| [](./docs/deployment.md) | [](./docs/sequence.md) |
| -------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| [](./docs/entity.md) | [](./docs/use-case.md) |
| [](./docs/swagger-public-api.yml) | [](./docs/swagger-engine.yml) |