{"id":21462725,"url":"https://github.com/mandrasch/ddev-sveltekit-postgres","last_synced_at":"2026-04-30T11:34:09.706Z","repository":{"id":239000396,"uuid":"798200297","full_name":"mandrasch/ddev-sveltekit-postgres","owner":"mandrasch","description":"Simple demo for running SvelteKit with a PostgreSQL database - fully containerized within Docker via DDEV.","archived":false,"fork":false,"pushed_at":"2024-05-20T12:37:21.000Z","size":63,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-30T21:38:01.849Z","etag":null,"topics":["ddev","docker","postgres","postgresql","svelte","sveltekit"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/mandrasch.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-05-09T09:45:49.000Z","updated_at":"2024-05-20T12:37:25.000Z","dependencies_parsed_at":"2025-09-05T23:52:53.245Z","dependency_job_id":"63ad86fd-9d79-49a0-bc25-cca34233075b","html_url":"https://github.com/mandrasch/ddev-sveltekit-postgres","commit_stats":null,"previous_names":["mandrasch/ddev-sveltekit-postgres"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mandrasch/ddev-sveltekit-postgres","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mandrasch%2Fddev-sveltekit-postgres","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mandrasch%2Fddev-sveltekit-postgres/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mandrasch%2Fddev-sveltekit-postgres/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mandrasch%2Fddev-sveltekit-postgres/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mandrasch","download_url":"https://codeload.github.com/mandrasch/ddev-sveltekit-postgres/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mandrasch%2Fddev-sveltekit-postgres/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32463892,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"online","status_checked_at":"2026-04-30T02:00:05.929Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["ddev","docker","postgres","postgresql","svelte","sveltekit"],"created_at":"2024-11-23T07:16:33.594Z","updated_at":"2026-04-30T11:34:04.696Z","avatar_url":"https://github.com/mandrasch.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ddev-sveltekit-postgres\n\nSimple demo for running SvelteKit with a PostgreSQL database - fully containerized within Docker via [DDEV](https://ddev.com). Access to database in SvelteKit is done via [drizzle ORM](https://orm.drizzle.team/).\n\nHuge thanks to Andy Blum for providing the guide [Node.js Development with DDEV](https://www.lullabot.com/articles/nodejs-development-ddev).\n\nStatus: 🚧 Work in Progress 🚧\n\n## Initial Setup\n\nFirst, [install DDEV](https://ddev.com/get-started/) on your local computer.\n\nAfterwards, git clone this repository to your local computer and execute the following commands in the project folder:\n\n```\ncd ddev-sveltekit-postgres/\nddev start\nddev npm install\nddev exec 'cp .env.example .env'\n\n# initial database setup via drizzle\nddev npm run generate\nddev npm run migrate\n```\n\nThese steps are only need to be done for the first time. Afterwards you can just use `ddev start` and `ddev npm run dev` to access your app https://sveltekit-app.ddev-sveltekit-postgres.ddev.site/ (see below).\n\n## Local Development\n\n```\nddev start\n\n# open site in browser\nddev launch\n\n# run this to start Vite dev server, reload browser afterwards:\nddev npm run dev\n```\n\nThe app is now running on https://app.ddev-sveltekit-postgres.ddev.site/, happy developing! 🎉\n\nView the database via `ddev tableplus` (drizzle Studio not yet implemented - needs port expose, etc.). You can add a test row there.\n\n## Configure the project\n\nSee `.ddev/config.yaml` for configuring database type and NodeJS version. Changes need a `ddev restart` afterwards.\n\n## Deployment via Coolify (WIP)\n\nThis setup should be easily self-hostable via Coolify (or other tools like CapRover, ploi.io, Laravel Forge, etc.). See this guide for example: [Deploy Node.js applications on a VPS using Coolify](https://sreyaj.dev/deploy-nodejs-applications-on-a-vps-using-coolify).\n\nI'm currently working on own blog articles about it (could take some time)\n\n## TODOs\n\n- [ ] Route https://orm.drizzle.team/drizzle-studio/overview via Docker / DDEV expose ports\n- [ ] Add dummy data command for demo installation\n- [ ] GitHub Codespaces support (maybe)\n\n## Acknowledgements\n\nThanks very much to ...\n\n- Andy Blum - https://www.lullabot.com/articles/nodejs-development-ddev\n- https://medium.com/@anasmohammed361/drizzle-orm-with-sveltekit-8aecbc8cc39d\n- https://www.tronic247.com/using-drizzle-orm-with-sveltekit/\n- https://sveltekit.io/blog/drizzle-sveltekit-integration\n- also inspired by [Self-hosting SvelteKit with a VPS, Docker, CapRover and GitHub Actions](https://www.youtube.com/watch?v=NLjolI9FwCU) video by Stanislav Khromov\n\n## How was this created?\n\nAdapted the steps of https://www.lullabot.com/articles/nodejs-development-ddev:\n\n```\n# create a new .ddev/config.yaml\nddev config --nodejs-version=20.12.1 --database=postgres:16\n\n# start the local project\nddev start\n\n# Create a new SvelteKit skeleton project\n# selected: skeleton project, JavaScript with JSDoc, ESLint + Prettier + Playwright + Vitest\nddev npm create svelte@latest .\n\n# install dependencies\nddev npm install\n```\n\nAdd additional hostname in .ddev/config.yaml:\n\n```yaml\nadditional_hostnames:\n  - 'sveltekit-app.ddev-sveltekit-postgres'\n```\n\nRan `ddev restart` to apply those changes.\n\nAdd a new nginx conf `.ddev/nginx_full/sveltekit-app.conf`:\n\n```\n# important, otherwise nginx fails with \"[emerg] could not build server_names_hash,\n# you should increase server_names_hash_bucket_size: 64\"\nserver_names_hash_bucket_size 128;\n\nserver {\n\n  server_name sveltekit-app.ddev-sveltekit-postgres.ddev.site;\n\n  location / {\n    proxy_pass http://localhost:5173;\n    proxy_http_version 1.1;\n    proxy_set_header Upgrade $http_upgrade;\n    proxy_set_header Connection 'upgrade';\n    proxy_set_header Host $host;\n    proxy_cache_bypass $http_upgrade;\n  }\n\n  listen 80;\n  listen 443 ssl;\n\n  ssl_certificate /etc/ssl/certs/master.crt;\n  ssl_certificate_key /etc/ssl/certs/master.key;\n\n  include /etc/nginx/monitoring.conf;\n\n  error_log /dev/stdout info;\n  access_log /var/log/nginx/access.log;\n\n  include /etc/nginx/common.d/*.conf;\n  include /mnt/ddev_config/nginx/*.conf;\n}\n```\n\nRan `ddev restart` to apply those changes.\n\nBecause my domain name was first rather long, I ran into\n\n```bash\nnginx: [emerg] could not build server_names_hash, you should increase server_names_hash_bucket_size: 64\n```\n\nFor now I shortened it till I find out how to customize `etc/nginx/nginx.conf` / report the issue to DDEV.\n\nRan `ddev restart` to apply those changes.\n\n### Add drizzle ORM\n\nInstall dependecies (via https://medium.com/@anasmohammed361/drizzle-orm-with-sveltekit-8aecbc8cc39d):\n\n```bash\n# https://orm.drizzle.team/drizzle-studio/overview#quick-start + others:\nddev npm i drizzle-orm\nddev npm i -D drizzle-kit dotenv pg\nddev npm i postgres\n```\n\nCreated schema via following https://medium.com/@anasmohammed361/drizzle-orm-with-sveltekit-8aecbc8cc39d. Added config files and scripts to package.json. Afterwards connection to db should be possible:\n\n```\n# Run Schema Generation\nddev npm run generate\n# Push the Schema changes to Db\nddev npm run migrate\n```\n\nAdded a row to the table via TablePlus and saved it via CMD+S for test purposes.\n\n```\nddev tableplus\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmandrasch%2Fddev-sveltekit-postgres","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmandrasch%2Fddev-sveltekit-postgres","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmandrasch%2Fddev-sveltekit-postgres/lists"}