{"id":18160783,"url":"https://github.com/blankeos/postgis-ts-playground","last_synced_at":"2025-07-27T12:12:54.717Z","repository":{"id":211928832,"uuid":"730290287","full_name":"Blankeos/postgis-ts-playground","owner":"Blankeos","description":"🐘 Playing around with PostGIS in a Bun App","archived":false,"fork":false,"pushed_at":"2024-01-15T16:32:30.000Z","size":106,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-13T08:41:41.923Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/Blankeos.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-12-11T15:53:10.000Z","updated_at":"2024-06-28T03:43:33.000Z","dependencies_parsed_at":"2023-12-11T17:29:19.231Z","dependency_job_id":"4a525aab-20e0-48f7-bc84-3987a3cf91f2","html_url":"https://github.com/Blankeos/postgis-ts-playground","commit_stats":null,"previous_names":["blankeos/postgis-ts-playground"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Blankeos%2Fpostgis-ts-playground","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Blankeos%2Fpostgis-ts-playground/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Blankeos%2Fpostgis-ts-playground/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Blankeos%2Fpostgis-ts-playground/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Blankeos","download_url":"https://codeload.github.com/Blankeos/postgis-ts-playground/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247589831,"owners_count":20963022,"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-11-02T08:09:19.844Z","updated_at":"2025-04-07T03:54:50.545Z","avatar_url":"https://github.com/Blankeos.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# postgis-ts-playground\n\n## Development Requirements\n\nBefore proceeding, please install the following software:\n\n- [Docker][docker-download] - For easy database setup.\n- [Bun][bun-download] - Both a package manager and runtime. I use Elysia here.\n- [Goose][goose-download] - For migrations (a Golang-based migration tool with a compiled executable).\n- Optional: [Beekeeper Studio - Community Edition][beekeeper-download] - For easy database querying and viewing. You can just use `psql` if you're a keyboard elitist.\n\n## Setup Server (3 easy steps)\n\n### 1. Create PostGIS Database (Recommended: Use Docker)\n\nThe easiest way to get PostGIS up and running is with Docker. If you want a\ndifferent way, go to [additional tips](#💡-additional-tips).\n\n```sh\n# To start:\nbun db:start\n\n# To stop:\nbun db:stop\n```\n\n\u003e Based on my configuration, connection string should be:\n\u003e `postgresql://postgres:password123@127.0.0.1:5432/postgis_playground`\n\n\u003e To customize: `scripts/docker-compose.yml` (`POSTGRES_USER` `POSTGRES_PASSWORD` `POSTGRES_DB`)\n\n### 2. Setup Env\n\nAdd your connection string to the .env. Defaults should be fine.\n\n```sh\ncp .apps/server/env.example apps/server/.env\n```\n\n### 3. Install dependencies and Run\n\n```sh\nbun install\nbun server:dev\n```\n\n## Database Workflows\n\nWe use Goose for migrations\n\n```sh\nbun migrate:status # see which migrations are pending or applied.\nbun migrate:create \u003cmigration_name\u003e # create a new migration in src/database/migrations\nbun migrate:up # apply migrations to the upwards\nbun migrate:down # apply migrations downwards\n```\n\n## 💡 Additional Tips\n\n### Test my DB Connection?\n\n\u003e Use **Beekeeper Studio** and pasting the connection string into \"Host\" of\n\u003e **New Connection**. So you know the database is running or if you want to explore.\n\n### Where is the data from my database stored?\n\n\u003e It's in `apps/server/data`, it's passed as a volume into `docker-compose.yml`.\n\u003e You can `sudo rm -rf apps/server/data` to delete this.\n\n### Other ways to create a PostGIS database\n\n\u003e 1. Setup from scratch with just Postgres.\n\u003e\n\u003e Assuming you have no PostGIS installed, just Postgres. Just go here:\n\u003e https://postgis.net/documentation/getting_started/\n\u003e\n\u003e Also make sure to login and create a database\n\u003e\n\u003e ```sh\n\u003e # Login\n\u003e psql -U postgres\n\u003e\n\u003e # Create the database\n\u003e CREATE DATABASE postgis_playground;\n\u003e ```\n\u003e\n\u003e 2. A single Docker Container (Postgis) + multiple databases\n\u003e\n\u003e If you don't want multiple containers running and only want to have 1 container\n\u003e and reuse it for multiple databases, do the following:\n\u003e\n\u003e ```sh\n\u003e # Login to postgres database via Docker\n\u003e docker exec -ti postgis_playground psql -U postgres\n\u003e\n\u003e # Create the database\n\u003e CREATE DATABASE postgis_playground;\n\u003e ```\n\n### Troubleshooting\n\n- **When to use `'POINT(0 0)'` over `st_point(0, 0)`?**\n\n  - When inside `` sql`...`  ``, use `st_point(0, 0)` (SQL Functions)\n  - Otherwise in a regular string or when using `sql()`, `'POINT(0 0)'` use (Refer to my `.patch(\"v1/restaurants\")` endpoint for this).\n\n- **Why is my query working in PSQL but not in PostgresJS?**\n\n  A very likely culprit is using `'POINT(0 0)'` a string value for Geometry types. Look at the first bullet point.\n\n  \u003c!-- # .\n\nTo install dependencies:\n\n```bash\nbun install\n```\n\nTo run:\n\n```bash\nbun run index.ts\n```\n\nThis project was created using `bun init` in bun v1.0.14. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime. --\u003e\n\n[bun-download]: https://bun.sh\n[docker-download]: https://www.docker.com/products/docker-desktop/\n[beekeeper-download]: https://github.com/beekeeper-studio/beekeeper-studio/releases\n[goose-download]: https://pressly.github.io/goose/installation/#linux\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblankeos%2Fpostgis-ts-playground","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblankeos%2Fpostgis-ts-playground","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblankeos%2Fpostgis-ts-playground/lists"}