diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index c7e0dbc..2ec7a43 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -141,21 +141,21 @@ jobs: - name: 🏗 Build run: npm run build - - name: 🛠 Install Arc - run: npm i -g @architect/architect - - - name: 🚀 Staging Deploy - if: github.ref == 'refs/heads/dev' - run: arc deploy --staging --prune - env: - CI: true - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - - - name: 🚀 Production Deploy - if: github.ref == 'refs/heads/main' - run: arc deploy --production --prune - env: - CI: true - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + # - name: 🛠 Install Arc + # run: npm i -g @architect/architect + + # - name: 🚀 Staging Deploy + # if: github.ref == 'refs/heads/dev' + # run: arc deploy --staging --prune + # env: + # CI: true + # AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + # AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + + # - name: 🚀 Production Deploy + # if: github.ref == 'refs/heads/main' + # run: arc deploy --production --prune + # env: + # CI: true + # AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + # AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} diff --git a/README.md b/README.md index 2dae025..514b9cd 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,16 @@ # Lofi Stack (Based on Remix Grunge Stack) - -![The Remix Grunge Stack](https://repository-images.githubusercontent.com/463325363/edae4f5b-1a13-47ea-b90c-c05badc2a700) +![Lofi Stack](lofi-stack.png) Learn more about [Remix Stacks](https://remix.run/stacks). ``` -npx create-remix@latest --template remix-run/grunge-stack +npx create-remix@latest --template majortom327/lofi-stack ``` ## What's in the stack -- [AWS deployment](https://aws.com) with [Architect](https://arc.codes/) -- Production-ready [DynamoDB Database](https://aws.amazon.com/dynamodb/) - [GitHub Actions](https://github.com/features/actions) for deploy on merge to production and staging environments -- Email/Password Authentication with [cookie-based sessions](https://remix.run/utils/sessions#createcookiesessionstorage) -- DynamoDB access via [`arc.tables`](https://arc.codes/docs/en/reference/runtime-helpers/node.js#arc.tables) +- Email/Password Authentication with [Remix Auth](https://github.com/sergiodxa/remix-auth) and [Auth0](https://auth0.com) - Styling with [Tailwind](https://tailwindcss.com/) - End-to-end testing with [Cypress](https://cypress.io) - Local third party request mocking with [MSW](https://mswjs.io) @@ -25,12 +21,6 @@ npx create-remix@latest --template remix-run/grunge-stack Not a fan of bits of the stack? Fork it, change it, and use `npx create-remix --template your/repo`! Make it your own. -## Quickstart - -Click this button to create a [Gitpod](https://gitpod.io) workspace with the project set up - -[![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://gitpod.io/from-referrer/) - ## Development - First run this stack's `remix.init` script and commit the changes it makes to your project. @@ -58,7 +48,6 @@ This starts your app in development mode, rebuilding assets on file changes. ### Relevant code: -This is a pretty simple note-taking app, but it's a good example of how you can build a full stack app with Architect and Remix. The main functionality is creating users, logging in and out, and creating and deleting notes. - creating users, and logging in and out [./app/models/user.server.ts](./app/models/user.server.ts) - user sessions, and verifying them [./app/session.server.ts](./app/session.server.ts) @@ -66,38 +55,7 @@ This is a pretty simple note-taking app, but it's a good example of how you can The database that comes with `arc sandbox` is an in memory database, so if you restart the server, you'll lose your data. The Staging and Production environments won't behave this way, instead they'll persist the data in DynamoDB between deployments and Lambda executions. -## Deployment - -This Remix Stack comes with two GitHub Actions that handle automatically deploying your app to production and staging environments. By default, Arc will deploy to the `us-west-2` region, if you wish to deploy to a different region, you'll need to change your [`app.arc`](https://arc.codes/docs/en/reference/project-manifest/aws) - -Prior to your first deployment, you'll need to do a few things: - -- Create a new [GitHub repo](https://repo.new) - -- [Sign up](https://portal.aws.amazon.com/billing/signup#/start) and login to your AWS account - -- Add `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` to [your GitHub repo's secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets). Go to your AWS [security credentials](https://console.aws.amazon.com/iam/home?region=us-west-2#/security_credentials) and click on the "Access keys" tab, and then click "Create New Access Key", then you can copy those and add them to your repo's secrets. - -- Install the [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html#getting-started-install-instructions). - -- Create an [AWS credentials file](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-quickstart.html#getting-started-quickstart-new). - -- Along with your AWS credentials, you'll also need to give your CloudFormation a `SESSION_SECRET` variable of its own for both staging and production environments, as well as an `ARC_APP_SECRET` for Arc itself. - - ```sh - npx arc env --add --env staging ARC_APP_SECRET $(openssl rand -hex 32) - npx arc env --add --env staging SESSION_SECRET $(openssl rand -hex 32) - npx arc env --add --env production ARC_APP_SECRET $(openssl rand -hex 32) - npx arc env --add --env production SESSION_SECRET $(openssl rand -hex 32) - ``` - - If you don't have openssl installed, you can also use [1password](https://1password.com/password-generator) to generate a random secret, just replace `$(openssl rand -hex 32)` with the generated secret. - -## Where do I find my CloudFormation? - -You can find the CloudFormation template that Architect generated for you in the sam.yaml file. -To find it on AWS, you can search for [CloudFormation](https://console.aws.amazon.com/cloudformation/home) (make sure you're looking at the correct region!) and find the name of your stack (the name is a PascalCased version of what you have in `app.arc`, so by default it's LofiStackStaging and LofiStackProduction) that matches what's in `app.arc`, you can find all of your app's resources under the "Resources" tab. ## GitHub Actions diff --git a/app.arc b/app.arc deleted file mode 100644 index f2b1aad..0000000 --- a/app.arc +++ /dev/null @@ -1,32 +0,0 @@ -@app -lofi-stack-template - -@aws -runtime nodejs18.x -# concurrency 1 -# memory 1152 -# profile default -# region us-west-1 -# timeout 30 - -@http -/* - method any - src server - -@plugins -plugin-remix - src plugin-remix.js - -@static - -@tables -user - pk *String - -password - pk *String # userId - -note - pk *String # userId - sk **String # noteId diff --git a/app/routes/_app._index/route.tsx b/app/routes/_app._index/route.tsx index da4045b..24b8807 100644 --- a/app/routes/_app._index/route.tsx +++ b/app/routes/_app._index/route.tsx @@ -75,7 +75,7 @@ export default function Index() {
-
+
{[ { src: "https://user-images.githubusercontent.com/1500684/157991167-651c8fc5-2f72-4afa-94d8-2520ecbc5ebc.svg", @@ -87,11 +87,6 @@ export default function Index() { alt: "DynamoDB", href: "https://aws.amazon.com/dynamodb/", }, - { - src: "https://user-images.githubusercontent.com/1500684/157990874-31f015c3-2af7-4669-9d61-519e5ecfdea6.svg", - alt: "Architect", - href: "https://arc.codes", - }, { src: "https://user-images.githubusercontent.com/1500684/157764276-a516a239-e377-4a20-b44a-0ac7b65c8c14.svg", alt: "Tailwind", diff --git a/lofi-stack.png b/lofi-stack.png new file mode 100644 index 0000000..9ddae2f Binary files /dev/null and b/lofi-stack.png differ diff --git a/package.json b/package.json index 4ec00c6..4785463 100644 --- a/package.json +++ b/package.json @@ -29,11 +29,7 @@ "/public/build" ], "dependencies": { - "@architect/architect": "^10.14.2", - "@architect/functions": "^7.0.0", - "@paralleldrive/cuid2": "^2.2.2", "@prisma/client": "^5.8.1", - "@remix-run/architect": "*", "@remix-run/css-bundle": "*", "@remix-run/node": "*", "@remix-run/react": "*", @@ -64,7 +60,6 @@ "@testing-library/cypress": "^10.0.1", "@testing-library/jest-dom": "^6.1.4", "@trivago/prettier-plugin-sort-imports": "^4.3.0", - "@types/architect__functions": "^3.13.10", "@types/bcryptjs": "2.4.5", "@types/eslint": "^8.44.6", "@types/luxon": "^3.4.1", diff --git a/prettier.config.cjs b/prettier.config.cjs index c6e0ec1..1e13836 100644 --- a/prettier.config.cjs +++ b/prettier.config.cjs @@ -11,4 +11,8 @@ module.exports = { ], importOrderSeparation: true, importOrderSortSpecifiers: true, + plugins: [ + "@trivago/prettier-plugin-sort-imports", + "prettier-plugin-tailwindcss", + ], }; diff --git a/remix.init/index.js b/remix.init/index.js index 4909018..b771e8c 100644 --- a/remix.init/index.js +++ b/remix.init/index.js @@ -3,7 +3,7 @@ const crypto = require("node:crypto"); const fs = require("node:fs/promises"); const path = require("node:path"); -const { toLogicalID } = require("@architect/utils"); + const PackageJson = require("@npmcli/package-json"); const inquirer = require("inquirer"); const semver = require("semver"); @@ -133,7 +133,7 @@ const main = async ({ packageManager, rootDirectory }) => { `; const newReadme = readme - .replace(new RegExp("LofiStack", "g"), toLogicalID(APP_NAME)) + .replace(new RegExp("LofiStack", "g"), APP_NAME) .replace(initInstructions, ""); updatePackageJson({ APP_NAME, packageJson }); diff --git a/server.ts b/server.ts index c0d04af..d425242 100644 --- a/server.ts +++ b/server.ts @@ -1,4 +1,3 @@ -import { createRequestHandler } from "@remix-run/architect"; import * as build from "@remix-run/dev/server-build"; if (process.env.NODE_ENV !== "production") {