{"id":17625371,"url":"https://github.com/mikededo/stack","last_synced_at":"2025-05-05T15:26:45.735Z","repository":{"id":253386421,"uuid":"831624500","full_name":"mikededo/stack","owner":"mikededo","description":"Monorepo setup for my Svelte side projects","archived":false,"fork":false,"pushed_at":"2025-04-10T16:52:37.000Z","size":3453,"stargazers_count":5,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-10T18:10:46.451Z","etag":null,"topics":["bun","coolify","svelte","sveltekit","turborepo"],"latest_commit_sha":null,"homepage":"https://stack-advent.vercel.app","language":"Svelte","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/mikededo.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":"2024-07-21T06:07:51.000Z","updated_at":"2025-04-10T16:52:40.000Z","dependencies_parsed_at":"2024-08-28T09:24:00.703Z","dependency_job_id":"a847ff2e-b144-4940-bb12-2a921b8d731c","html_url":"https://github.com/mikededo/stack","commit_stats":{"total_commits":319,"total_committers":2,"mean_commits":159.5,"dds":0.006269592476489061,"last_synced_commit":"02ec5ae0bc79484d4ae492e79611e96910dc5729"},"previous_names":["mikededo/stack"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikededo%2Fstack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikededo%2Fstack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikededo%2Fstack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikededo%2Fstack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mikededo","download_url":"https://codeload.github.com/mikededo/stack/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252523255,"owners_count":21761884,"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":["bun","coolify","svelte","sveltekit","turborepo"],"created_at":"2024-10-22T22:42:18.643Z","updated_at":"2025-05-05T15:26:45.671Z","avatar_url":"https://github.com/mikededo.png","language":"Svelte","readme":"# Stack\n\nMonorepo setup for the current side projects that I'm working on, made with\n[Svelte](https://svelte.dev) and [SvelteKit](https://kit.svelte.dev).\nSelf-hosted on a [Coolify](https://coolify.io) instance, with\n[Supabase](https://supabase.com) as the backend.\n\n\u003e Some of the projects that I plan on adding are simply because I plan on\n\u003e learning in different subjects, which could seem unnecessary for the overall\n\u003e project.\n\n## Running locally\n\nIn order to run the project locally, there's no need to configure Coolify, as\nyou can simply run a local Supabase instance. You can do so by running:\n\n```bash\nbunx db:start\n# Shortcut for bunx supabase start\n```\n\nThis will start the Supabase server locally, using the\n[`config.toml`](./supabase/config.toml) file. Once the supabase server is\nrunning, you can create a new SQL query (`SQL Editor`) by copying the contents\nof the `.sql` files in the [`supabase/sql`](./supabase/sql) folder.  \nFinally, you'll need to create an `.env` file for each application that you want\nto run. Aside from each app-specific `.env` variables, they all share the same\nfor supabase:\n\n```bash\nPUBLIC_SUPABASE_URL=\nPUBLIC_SUPABASE_ANON_KEY=\n```\n\nAll migrations are stored in [`supabase/migrations`](./supabase/migrations). On\nstarting the database with `bunx supabase start`, the migrations will be\napplied automatically. To apply any migrations manually (i.e., after any update)\nrun:\n\n```bash\n# This URL would work as long as you keep the config as provided. If there's\n# any change in the config, you'll have to update the URL accordingly.\n# More in the following sections\nbunx supabase db push --db-url postgresql://postgres:\u003cpostgres-password\u003e@api.coolify.orb.local:54322\n```\n\n\u003e In order to know the url and anon key, you can run: `bunx supabase status`\n\n## Running with Coolify\n\nThe idea of having Coolify is to simulate a production environment. I'm\ncurrently running Coolify's instance on an [OrbStack Linux\nMachine](https://docs.orbstack.dev/machines). So, first, create a new Linux\nmachine, which your preferred distro, and install Coolify on it. Finally, you\nshould be able to access the instance at `http://\u003cmachine-name\u003e.orb.local:8000`.\n\n### Supabase setup\n\nWe'll have to create a Supabase project and create the database for it. A\nSupabase instance can easily be created as Coolify provides a set of projects\nthat you can use. Therefore, create a new project and a Supabase service\nafterwards.  \nOnce the project is created, update the following configurations:\n\n- Kong container:\n  - Optionally rename the container to `Kong` or `Api`\n  - Update the link to `api.\u003cmachine-name\u003e.orb.local`.\n- Studio container:\n  - Optionally rename the container to `Studio`\n  - Update the link to `studio.\u003cmachine-name\u003e.orb.local`.\n\n\u003e If you have already deployed the services, the changes will be reflected once\n\u003e you restart the containers.\n\nIn order to be able to run `supabase` CLI related commands, against the\ninstance, you will have to expose the pg port. In order to do so, modify the\n`docker-compose.yml` provided by Coolify, by adding the following lines in the\n`supabase-db` container definition:\n\n```yaml\nports:\n  - \"54322:${POSTGRES_PORT}\"\n```\n\nAgain, restart the service in case your service was already running. Now, you\nshould be able to run commands such as `subapase dump` with:\n\n```bash\n# The SERVICE_PASSWORD_POSTGRES can be found in the Environment Variables\n# section of your instance\nbunx supabase db dump --db-url postgresql://postgres:${SERVICE_PASSWORD_POSTGRES}@api.\u003cmachine-name\u003e.orb.local:54322/postgres\n```\n\n### Application setup\n\nIn order to run the application locally, you'll simply need to create a new\nPublic Repository service in the project dashboard. Make sure to set `main` as\nthe branch. Using Nixpacks as an alternative to docker is recommended, as no\ndocker configuration is provided in this repo. Next, you will need to:\n\n- Optional but recommended: rename the service to `Stack - \u003cApp name\u003e`\n- Update the domain to `\u003capp-name\u003e.\u003cmachine-name\u003e.orb.local`\n- Modify the commands in the `General \u003e Build` section to:\n  - Update the `Install command` command to `bun install --frozen-lockfile --production --ignore-scripts`.\n    We are ignoring the scripts because they are not needed for the application\n    to be executed in production more (`prepare` script currently only runs\n    `husky`, and therefore it is not required).\n  - Update the `Build command` command to `turbo build --ui stream --filter @stack/\u003capp-name\u003e`\n  - Update the `Start command` command to `bun --cwd apps/\u003capp-name\u003e ./build/index.js`\n- Update the port mapping to:\n  - `Ports exposes`: 80\n  - `Ports mappings`: `\u003capp-port\u003e:80`\n- Update the `Environment variables` to:\n  - `PUBLIC_SUPABASE_URL`: `http://api.\u003cmachine-name\u003e.orb.local:8000`\n  - `PUBLIC_SUPABASE_ANON_KEY`: `\u003canon-key\u003e`\n\nFinally, you can deploy the service. Once deployed, you should be able to\naccess it at `http://\u003capp-name\u003e.\u003cmachine-name\u003e.orb.local`.\n\n#### App ports\n\nHere's the list of the apps and ports in which they are served by default:\n\n| App name       | Port |\n| -------------- | ---- |\n| @stack/finance | 3000 |\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikededo%2Fstack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmikededo%2Fstack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikededo%2Fstack/lists"}