Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/doomspork/bitty
A Phoenix powered API for shorting URLs
https://github.com/doomspork/bitty
Last synced: 6 days ago
JSON representation
A Phoenix powered API for shorting URLs
- Host: GitHub
- URL: https://github.com/doomspork/bitty
- Owner: doomspork
- License: apache-2.0
- Created: 2021-04-25T14:37:26.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-07-03T14:49:15.000Z (over 3 years ago)
- Last Synced: 2024-11-05T14:54:43.605Z (about 2 months ago)
- Language: Elixir
- Size: 239 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Bitty
> The IttyBitty URL shortener.
Bitty is a Phoenix Framework powered URL Shortener. This project is an example of migrating a React/API pairing to
a LiveView application.## Local Development
### Starting our database
Within our repository can be found `docker-compose.yml` that defines our external dependencies, at this time just a Postgres database. Thanks to Docker and Docker Compose to get things started for local development and test we just need to run:
```shell
$ docker-compose up
```Note: `down` can be used to shut things down gracefully when work is done
### Fetching our dependencies
This example is built using Elixir and Phoenix and kept pretty standard. As a result, those with even limited exposure should find these steps familiar.
```shell
$ mix deps.get
$ mix compile
```### Setting up our database
Now that we've fetched our dependencies and compiled our project, we can leverage our Mix tasks to do the hard work for us; included with Phoenix is a useful alias we can use here:
```shell
$ mix ecto.setup
```At any point if we need to bring our database back to square one we can leverage the similarly useful `ecto.reset`:
```shell
$ mix ecto.reset
```### Adding features
Step 1. Write great code.
Step 2. Write great tests.
Step 3. Print money.### Testing our code
Once you've developed your money printing features and ensured adequate test coverage, we need to run those tests:
```elixir
$ mix test
```### Keeping things clean
We like our code to be clean. We can make use of 2 popular methods in the Elixir ecosystem: formatter and Credo. This project makes use of both.
The formatter will take care of adjusting any small style changes necessary to maintain compliance with our styleguide.
Credo applies another best practice and styleguide rules to us, helping prevent complexity and other pitfalls.
It's always a good practice to run both before committing and pushing your code:
```elixir
$ mix format
$ mix credo
```With tests passing, code formatted, and Credo happy it's time to commit!
## Deployments
Docker and Heroku's container stack were used to deploy this. The deployment target could be updated to elsewhere easy enough.
## Continous Integration & Delivery
GitHub Actions.