{"id":13455869,"url":"https://github.com/championswimmer/onepixel_backend","last_synced_at":"2025-04-09T15:04:52.381Z","repository":{"id":184160979,"uuid":"670354683","full_name":"championswimmer/onepixel_backend","owner":"championswimmer","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-19T16:31:48.000Z","size":8111,"stargazers_count":174,"open_issues_count":10,"forks_count":72,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-04-09T15:04:46.534Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://1px.li","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/championswimmer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-24T21:39:27.000Z","updated_at":"2025-04-06T09:34:42.000Z","dependencies_parsed_at":"2024-01-09T11:04:28.520Z","dependency_job_id":"105cdc8b-2bf7-49c2-b8ff-74395fc04be1","html_url":"https://github.com/championswimmer/onepixel_backend","commit_stats":null,"previous_names":["championswimmer/onepixel_backend"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/championswimmer%2Fonepixel_backend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/championswimmer%2Fonepixel_backend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/championswimmer%2Fonepixel_backend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/championswimmer%2Fonepixel_backend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/championswimmer","download_url":"https://codeload.github.com/championswimmer/onepixel_backend/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248055284,"owners_count":21040157,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T08:01:12.551Z","updated_at":"2025-04-09T15:04:52.362Z","avatar_url":"https://github.com/championswimmer.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# onepixel (1px.li)\n\n\"onepixel\" is an API-first URL shortener. \n\n#### Why this name? \nA URL shortener should have a short domain name, possibly 2 or 3 letter in length.   \n\"1 pixel\" is the smallest unit of a screen.   \nSo `1px.li` stands for `one pixel links` - i.e. smallest possible links :) \n\n\n#### Status Badges \n[![codecov](https://codecov.io/gh/championswimmer/onepixel_backend/graph/badge.svg?token=DL3DR6CS40)](https://codecov.io/gh/championswimmer/onepixel_backend)\n[![Build and test](https://github.com/championswimmer/onepixel_backend/actions/workflows/build_test_release.yaml/badge.svg)](https://github.com/championswimmer/onepixel_backend/actions/workflows/build_test_release.yaml)\n\n## Hosted Instance (1px.li) \nThe latest version of the code is automatically deployed via [Railway](https://railway.app?referralCode=T4g5xz)\nto   \n\u003cbig\u003e\u003chttps://onepixel.link\u003e\u003c/big\u003e\n\n\nYou can deploy your own instance too\n[![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/template/xAJ1-J?referralCode=T4g5xz)\n\n## Databases \n\nThere are two databases used in this project \n\n1. **Application DB**  \n   This stores users, shortlinks and link groups \n2. **Events/Analytics DB**   \n   This stores every redirection event used for analytics and stats \n\n\n#### Production Configuration\n\n| Purpose        | Database                                 |\n|----------------|------------------------------------------|\n| Application DB | [PostgreSQL](https://www.postgresql.org) |\n| Events DB      | [Clickhouse](https://clickhouse.com/)    |\n\n#### Test Configuration \nFor tests on CI it is better to use small embedded databases\ninstead of spinning up a full database server. \n\n| Purpose        | Database                                    |\n|----------------|---------------------------------------------|\n| Application DB | [SQLite](https://www.sqlite.org/index.html) |\n| Events DB      | [DuckDB](https://duckdb.org/)               |\n\n\u003e [!NOTE]\n\u003e You can also override `.onepixel.local.env` to use\n\u003e the embedded databases for local development\n\u003e but they are not recommended for production use.\n\n## Development \n\n### Deploy everything (with Docker)\n\nSimplest way to get it running is \n\n1. make a `./data` directory where your database will be stored \n2. run `docker-compose up`\n\n### Run with hot-reload for local development \n\n### With Docker\n\nWe will use docker to run an instance of our databases, but we will run the project using [air](https://github.com/cosmtrek/air) locally  \n\n1. make the following directories where your database will be stored\n   1. `./data` for postgres\n   2. `./clk_data` for clickhouse\n   3. `./clk_logs` for clickhouse logs\n2. run `docker-compose up -d postgres clickhouse`\n3. run `air` in the root directory of the project \u003csup\u003e1\u003c/sup\u003e\n\n### Without Docker\n\nWe will be using the embedded databases for local development without docker\n\n1. Make the following changes in `.onepixel.local.env`\n   ```env\n   DB_DIALECT=sqlite\n   DATABASE_URL=\"app.db\"\n   USE_FILE_DB=true\n   \n   EVENTS_DB_DIALECT=duckdb\n   EVENTDB_URL=\"events.db\"\n   ```\n2. run `air` in the root directory of the project \u003csup\u003e1\u003c/sup\u003e\n\n\u003e Note[1]: you can also run `go run src/main.go` but it will not reload on changes\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchampionswimmer%2Fonepixel_backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchampionswimmer%2Fonepixel_backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchampionswimmer%2Fonepixel_backend/lists"}