{"id":13719520,"url":"https://github.com/nzambello/punk-stack","last_synced_at":"2025-04-28T02:32:08.021Z","repository":{"id":40000421,"uuid":"479718095","full_name":"nzambello/punk-stack","owner":"nzambello","description":"Remix stack with supabase, tailwind, jest, cypress and fly deploy and some opinionated tools.","archived":false,"fork":false,"pushed_at":"2022-09-10T10:49:35.000Z","size":256,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-05T05:33:21.150Z","etag":null,"topics":["react","remix","remix-run","remix-stack","remix-stacks","supabase","supabase-auth"],"latest_commit_sha":null,"homepage":"","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/nzambello.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}},"created_at":"2022-04-09T12:21:36.000Z","updated_at":"2024-02-06T18:43:56.000Z","dependencies_parsed_at":"2022-07-23T11:16:25.424Z","dependency_job_id":null,"html_url":"https://github.com/nzambello/punk-stack","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nzambello%2Fpunk-stack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nzambello%2Fpunk-stack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nzambello%2Fpunk-stack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nzambello%2Fpunk-stack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nzambello","download_url":"https://codeload.github.com/nzambello/punk-stack/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251238217,"owners_count":21557420,"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":["react","remix","remix-run","remix-stack","remix-stacks","supabase","supabase-auth"],"created_at":"2024-08-03T01:00:50.661Z","updated_at":"2025-04-28T02:32:07.728Z","avatar_url":"https://github.com/nzambello.png","language":"TypeScript","readme":"# Remix Punk Stack\n\n[Remix](https://remix.run/stacks) stack with supabase, tailwind, jest, cypress and fly deploy and some opinionated tools.\n\n![The Remix Punk Stack](https://repository-images.githubusercontent.com/479718095/26db9b7c-961b-4bb7-a212-d58bf64d4aaa)\n\nDerived from [The Remix Blues Stack](https://github.com/remix-run/blues-stack) by @remix-run. Ref commit [7cdd098](https://github.com/remix-run/blues-stack/commit/7cdd0985b4c96b7c14ef234a3ee53fbf028c8f47).\n\nLearn more about [Remix Stacks](https://remix.run/stacks).\n\n```\nnpx create-remix --template nzambello/punk-stack\n```\n\n## What's in the stack\n\n- [Multi-region Fly app deployment](https://fly.io/docs/reference/scaling/) with [Docker](https://www.docker.com/)\n- Healthcheck endpoint for [Fly backups region fallbacks](https://fly.io/docs/reference/configuration/#services-http_checks)\n- [Supabase Database integration](https://supabase.com/)\n- Email/Password Authentication with [Supabase Auth](https://supabase.com/docs/auth/)\n- [GitHub Actions](https://github.com/features/actions) for deploy on merge to production and staging environments\n- Styling with [Tailwind](https://tailwindcss.com/)\n- End-to-end testing with [Cypress](https://cypress.io)\n- Local third party request mocking with [MSW](https://mswjs.io)\n- Unit testing with [Vitest](https://vitest.dev) and [Testing Library](https://testing-library.com)\n- Code formatting with [Prettier](https://prettier.io)\n- Linting with [ESLint](https://eslint.org)\n- Static Types with [TypeScript](https://typescriptlang.org)\n- Husky pre-commit hooks running tests and linting\n- [Commmitlint](https://commitlint.js.org/) for commit message validation based on [Conventional Commits](https://www.conventionalcommits.org/en/)\n- Changelog and release management with [release-it](https://github.com/release-it/release-it), using convential changellog\n\nNot a fan of bits of the stack? Fork it, change it, and use `npx create-remix --template your/repo`! Make it your own.\n\n## Setup and development\n\n- Install dependencies\n\n  ```sh\n  yarn\n  # or npm install\n  # or pnpm install\n  ```\n\n- Create a supabase project on [app.supabase.io](https://app.supabase.io)\n\n- Create a new supabase database (refer to the [supabase docs](https://supabase.com/docs/getting-started) for more information). Follow types definition for table structures.\n\n- Setup supabase environment variables in `.env`, example:\n\n  ```env\n    SUPABASE_ANON_KEY=\u003cyour supabase anon public key\u003e\n    SUPABASE_API_URL=\u003cyour supabase url\u003e\n    SESSION_SECRET=\"super-duper-s3cret\"\n\n    # supabase user to use for authentication in e2e tests\n    # signup once in the browser to create your test user\n    # DISCLAIMER: didn't find a better way, please don't use this in production\n    # see https://github.com/supabase/supabase/discussions/6177\n    SUPABASE_E2ETEST_USERMAIL=\"user@provider.mail\"\n    SUPABASE_E2ETEST_PASSWORD=\"your-supabase-user-password\"\n  ```\n\n- Start dev server:\n\n  ```sh\n  npm run dev\n  ```\n\nThis starts your app in development mode, rebuilding assets on file changes.\n\n### Relevant code:\n\nThis is a pretty simple note-taking app, but it's a good example of how you can build a full stack app with Prisma and Remix. The main functionality is creating users, logging in and out, and creating and deleting notes.\n\n- creating users, and logging in and out [./app/models/user.server.ts](./app/models/user.server.ts)\n- user sessions, and verifying them [./app/session.server.ts](./app/session.server.ts)\n- creating, and deleting notes [./app/models/note.server.ts](./app/models/note.server.ts)\n\n## Update types from supabase\n\n```sh\nnpx openapi-typescript https://your-project-id.supabase.co/rest/v1/?apikey=your-anon-key --output types/supabase.ts\n```\n\n## Deployment\n\nThis Remix Stack comes with two GitHub Actions that handle automatically deploying your app to production and staging environments.\n\nPrior to your first deployment, you'll need to do a few things:\n\n- [Install Fly](https://fly.io/docs/getting-started/installing-flyctl/)\n\n- Sign up and log in to Fly\n\n  ```sh\n  fly auth signup\n  ```\n\n  \u003e **Note:** If you have more than one Fly account, ensure that you are signed into the same account in the Fly CLI as you are in the browser. In your terminal, run `fly auth whoami` and ensure the email matches the Fly account signed into the browser.\n\n- Create two apps on Fly, one for staging and one for production:\n\n  ```sh\n  fly create maileditor-app-13b9\n  fly create maileditor-app-13b9-staging\n  ```\n\n- Initialize Git.\n\n  ```sh\n  git init\n  ```\n\n- Create a new [GitHub Repository](https://repo.new), and then add it as the remote for your project. **Do not push your app yet!**\n\n  ```sh\n  git remote add origin \u003cORIGIN_URL\u003e\n  ```\n\n- Add a `FLY_API_TOKEN` to your GitHub repo. To do this, go to your user settings on Fly and create a new [token](https://web.fly.io/user/personal_access_tokens/new), then add it to [your repo secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets) with the name `FLY_API_TOKEN`.\n\n- Setup supabase environment variables in `.env`, example:\n\n  ```env\n    SUPABASE_ANON_KEY=\u003cyour supabase anon public key\u003e\n    SUPABASE_API_URL=\u003cyour supabase url\u003e\n    SESSION_SECRET=\"super-duper-s3cret\"\n  ```\n\n- Add a `SESSION_SECRET` to your fly app secrets, to do this you can run the following commands:\n\n  ```sh\n  fly secrets set SESSION_SECRET=$(openssl rand -hex 32) --app maileditor-app-13b9\n  fly secrets set SESSION_SECRET=$(openssl rand -hex 32) --app maileditor-app-13b9-staging\n  ```\n\n  \u003e **Note:** When creating the staging secret, you may get a warning from the Fly CLI that looks like this:\n  \u003e\n  \u003e ```\n  \u003e WARN app flag 'maileditor-app-13b9-staging' does not match app name in config file 'maileditor-app-13b9'\n  \u003e ```\n  \u003e\n  \u003e This simply means that the current directory contains a config that references the production app we created in the first step. Ignore this warning and proceed to create the secret.\n\n  If you don't have openssl installed, you can also use [1password](https://1password.com/generate-password) to generate a random secret, just replace `$(openssl rand -hex 32)` with the generated secret.\n\n- Create a database for both your staging and production environments. Run the following:\n\n  ```sh\n  fly postgres create --name maileditor-app-13b9-db\n  fly postgres attach --postgres-app maileditor-app-13b9-db --app maileditor-app-13b9\n\n  fly postgres create --name maileditor-app-13b9-staging-db\n  fly postgres attach --postgres-app maileditor-app-13b9-staging-db --app maileditor-app-13b9-staging\n  ```\n\n  \u003e **Note:** You'll get the same warning for the same reason when attaching the staging database that you did in the `fly set secret` step above. No worries. Proceed!\n\nFly will take care of setting the `DATABASE_URL` secret for you.\n\nNow that every is set up you can commit and push your changes to your repo. Every commit to your `main` branch will trigger a deployment to your production environment, and every commit to your `dev` branch will trigger a deployment to your staging environment.\n\nIf you run into any issues deploying to Fly, make sure you've followed all of the steps above and if you have, then post as many details about your deployment (including your app name) to [the Fly support community](https://community.fly.io). They're normally pretty responsive over there and hopefully can help resolve any of your deployment issues and questions.\n\n### Multi-region deploys\n\nOnce you have your site and database running in a single region, you can add more regions by following [Fly's Scaling](https://fly.io/docs/reference/scaling/) and [Multi-region PostgreSQL](https://fly.io/docs/getting-started/multi-region-databases/) docs.\n\nMake certain to set a `PRIMARY_REGION` environment variable for your app. You can use `[env]` config in the `fly.toml` to set that to the region you want to use as the primary region for both your app and database.\n\n#### Testing your app in other regions\n\nInstall the [ModHeader](https://modheader.com/) browser extension (or something similar) and use it to load your app with the header `fly-prefer-region` set to the region name you would like to test.\n\nYou can check the `x-fly-region` header on the response to know which region your request was handled by.\n\n## GitHub Actions\n\nWe use GitHub Actions for continuous integration and deployment. Anything that gets into the `main` branch will be deployed to production after running tests/build/etc. Anything in the `dev` branch will be deployed to staging.\n\n## Testing\n\n### Cypress\n\nWe use Cypress for our End-to-End tests in this project. You'll find those in the `cypress` directory. As you make changes, add to an existing file or create a new file in the `cypress/e2e` directory to test your changes.\n\nWe use [`@testing-library/cypress`](https://testing-library.com/cypress) for selecting elements on the page semantically.\n\nTo run these tests in development, run `npm run test:e2e:dev` which will start the dev server for the app as well as the Cypress client. Make sure the database is running in docker as described above.\n\nWe have a utility for testing authenticated features without having to go through the login flow:\n\n```ts\ncy.login();\n// you are now logged in as a new user\n```\n\nWe also have a utility to auto-delete the user at the end of your test. Just make sure to add this in each test file:\n\n```ts\nafterEach(() =\u003e {\n  cy.cleanupUser();\n});\n```\n\nThat way, we can keep your local db clean and keep your tests isolated from one another.\n\n### Vitest\n\nFor lower level tests of utilities and individual components, we use `vitest`. We have DOM-specific assertion helpers via [`@testing-library/jest-dom`](https://testing-library.com/jest-dom).\n\n### Type Checking\n\nThis project uses TypeScript. It's recommended to get TypeScript set up for your editor to get a really great in-editor experience with type checking and auto-complete. To run type checking across the whole project, run `npm run typecheck`.\n\n### Linting\n\nThis project uses ESLint for linting. That is configured in `.eslintrc.js`.\n\n### Formatting\n\nWe use [Prettier](https://prettier.io/) for auto-formatting in this project. It's recommended to install an editor plugin (like the [VSCode Prettier plugin](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)) to get auto-formatting on save. There's also a `npm run format` script you can run to format all files in the project.\n","funding_links":[],"categories":["Starter"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnzambello%2Fpunk-stack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnzambello%2Fpunk-stack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnzambello%2Fpunk-stack/lists"}