Skip to content

Commit d6d0b76

Browse files
authored
Refactor to tanstack (#26)
1 parent 3d5b223 commit d6d0b76

File tree

147 files changed

+11511
-29197
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

147 files changed

+11511
-29197
lines changed

.github/workflows/deploy.yml

Lines changed: 23 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
with:
3636
cache: npm
3737
cache-dependency-path: "**/package.json"
38-
node-version: 18
38+
node-version: 24
3939

4040
- name: 📥 Install deps
4141
run: npm install
@@ -58,7 +58,7 @@ jobs:
5858
with:
5959
cache: npm
6060
cache-dependency-path: "**/package.json"
61-
node-version: 18
61+
node-version: 24
6262

6363
- name: 📥 Install deps
6464
run: npm install
@@ -69,6 +69,9 @@ jobs:
6969
deploy:
7070
needs: [lint, typecheck]
7171
runs-on: ubuntu-latest
72+
permissions:
73+
contents: read
74+
id-token: write
7275
defaults:
7376
run:
7477
working-directory: web
@@ -77,43 +80,31 @@ jobs:
7780
- name: ⬇️ Checkout repo
7881
uses: actions/checkout@v4
7982

80-
- name: ⎔ Setup node
81-
uses: actions/setup-node@v4
83+
- name: 🔐 Google Auth
84+
id: auth
85+
uses: google-github-actions/auth@v2
8286
with:
83-
cache: npm
84-
cache-dependency-path: "**/package.json"
85-
node-version: 18
87+
workload_identity_provider: '${{ secrets.WIF_PROVIDER }}'
88+
service_account: '${{ secrets.WIF_SERVICE_ACCOUNT }}'
89+
90+
- name: ☁️ Set up Cloud SDK
91+
uses: google-github-actions/setup-gcloud@v2
92+
with:
93+
project_id: '${{ secrets.GCP_PROJECT_ID }}'
8694

8795
- name: 👀 Env
8896
run: |
8997
echo "Event name: ${{ github.event_name }}"
9098
echo "Git ref: ${{ github.ref }}"
9199
echo "GH actor: ${{ github.actor }}"
92100
echo "SHA: ${{ github.sha }}"
93-
VER=`node --version`; echo "Node ver: $VER"
94-
VER=`npm --version`; echo "npm ver: $VER"
95-
96-
- name: 📥 Install deps
97-
run: npm install
98-
99-
- name: 🏗 Build
100-
run: npm run build
101-
102-
- name: 🛠 Install Arc
103-
run: npm i -g @architect/architect
101+
echo "GCP Project: ${{ secrets.GCP_PROJECT_ID }}"
104102
105-
- name: 🚀 Staging Deploy
106-
if: github.ref == 'refs/heads/dev'
107-
run: arc deploy --staging --prune
103+
- name: 🚀 Deploy to Cloud Run
108104
env:
109-
CI: true
110-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
111-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
112-
113-
- name: 🚀 Production Deploy
114-
if: github.ref == 'refs/heads/main'
115-
run: arc deploy --production --prune
116-
env:
117-
CI: true
118-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
119-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
105+
GCP_PROJECT_ID: '${{ secrets.GCP_PROJECT_ID }}'
106+
VITE_API_URL: '${{ secrets.VITE_API_URL }}'
107+
VITE_GA_TRACKING_ID: '${{ secrets.VITE_GA_TRACKING_ID }}'
108+
run: |
109+
chmod +x deploy.sh
110+
./deploy.sh us-central1

.gitignore

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
.DS_Store
2+
dist
3+
dist-ssr
4+
*.local
5+
count.txt
6+
.env
7+
.nitro
8+
.tanstack
9+
.wrangler
10+
.output
11+
.vinxi
12+
todos.json
113
node_modules
214
**/__pycache__
315
api/.venv
@@ -8,9 +20,6 @@ web/build/*
820
preferences.arc
921
sam.json
1022
sam.yaml
11-
.env
1223

1324
/cypress/screenshots
1425
/cypress/videos
15-
16-
/app/styles/tailwind.css

.vscode/settings.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
{
2-
"files.exclude": {
3-
"**/*.css": true,
4-
"**/*.css.map": true
2+
"files.watcherExclude": {
3+
"**/routeTree.gen.ts": true
4+
},
5+
"search.exclude": {
6+
"**/routeTree.gen.ts": true
7+
},
8+
"files.readonlyInclude": {
9+
"**/routeTree.gen.ts": true
510
},
611
"ruff.importStrategy": "fromEnvironment",
712
"editor.tabSize": 2,
813
"editor.wordWrap": "on",
914
"ruff.fixAll": true,
1015
"ruff.enable": true,
11-
"ruff.lint.run": "onSave",
1216
"flake8.ignorePatterns": [
1317
"*"
1418
]

README.md

Lines changed: 29 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -1,128 +1,40 @@
1-
# Remix Grunge Stack
1+
# r2dliu.com - Personal Website
22

3-
![The Remix Grunge Stack](https://repository-images.githubusercontent.com/463325363/edae4f5b-1a13-47ea-b90c-c05badc2a700)
3+
A personal website showcasing projects, articles, and interactive experiences, built with modern web technologies and deployed on Google Cloud infrastructure.
44

5-
Learn more about [Remix Stacks](https://remix.run/stacks).
5+
## Architecture Overview
66

7-
```
8-
npx create-remix@latest --template remix-run/grunge-stack
9-
```
7+
This project has evolved quite a lot over the years. The progression looked something like this:
108

11-
## What's in the stack
9+
- **Raw HTML/CSS/JS****Create React App****Remix****TanStack Start**
1210

13-
- [AWS deployment](https://aws.com) with [Architect](https://arc.codes/)
14-
- Production-ready [DynamoDB Database](https://aws.amazon.com/dynamodb/)
15-
- [GitHub Actions](https://github.com/features/actions) for deploy on merge to production and staging environments
16-
- Email/Password Authentication with [cookie-based sessions](https://remix.run/docs/en/v1/api/remix#createcookiesessionstorage)
17-
- DynamoDB access via [`arc.tables`](https://arc.codes/docs/en/reference/runtime-helpers/node.js#arc.tables)
18-
- Styling with [Tailwind](https://tailwindcss.com/)
19-
- End-to-end testing with [Cypress](https://cypress.io)
20-
- Local third party request mocking with [MSW](https://mswjs.io)
21-
- Unit testing with [Vitest](https://vitest.dev) and [Testing Library](https://testing-library.com)
22-
- Code formatting with [Prettier](https://prettier.io)
23-
- Linting with [ESLint](https://eslint.org)
24-
- Static Types with [TypeScript](https://typescriptlang.org)
11+
The current stack represents a fully type-safe, server-side rendered, React application with scalable full-stack capabilities. It's nearly completely free to host, too; I only pay pennies a month to keep this thing afloat.
2512

26-
Not a fan of bits of the stack? Fork it, change it, and use `npx create-remix --template your/repo`! Make it your own.
13+
## Tech Stack
2714

28-
## Development
15+
### Frontend (React)
16+
- **[TanStack Start](https://tanstack.com/start)**: Full-stack React framework with SSR, file-based routing, and built-in data loading
17+
- **React Three Fiber**: 3D graphics and interactive experiences using Three.js
18+
- **TypeScript**: Full type safety across the entire application
19+
- **Vite**: Fast build tool and development server
20+
- **Tailwind CSS**: Utility-first styling
2921

30-
- This step only applies if you've opted out of having the CLI install dependencies for you:
22+
### Backend (Python)
23+
- **uv**: Blows everything else out of the water
24+
- **Django**: A tried and true classic
25+
- **Supabase**: The only "free" db hosting
26+
- **GraphQL**: Powered by Graphene
3127

32-
```sh
33-
npx remix init
34-
```
28+
### Infrastructure
29+
- **Google Cloud Run**: Serverless container deployment for both frontend and backend
30+
- **Google Cloud Build**: CI/CD pipeline for automatic deployments
31+
- **AWS Route53 / Cloudflare**: DNS and route management
32+
- **Docker**: Containerization for consistent deployments
3533

36-
- Validate the app has been set up properly (optional):
34+
## Features
3735

38-
```sh
39-
npm run validate
40-
```
41-
42-
- Start dev server:
43-
44-
```sh
45-
npm run dev
46-
```
47-
48-
This starts your app in development mode, rebuilding assets on file changes.
49-
50-
### Relevant code:
51-
52-
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.
53-
54-
- creating users, and logging in and out [./app/models/user.server.ts](./app/models/user.server.ts)
55-
- user sessions, and verifying them [./app/session.server.ts](./app/session.server.ts)
56-
- creating, and deleting notes [./app/models/note.server.ts](./app/models/note.server.ts)
57-
58-
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.
59-
60-
## Deployment
61-
62-
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)
63-
64-
Prior to your first deployment, you'll need to do a few things:
65-
66-
- Create a new [GitHub repo](https://repo.new)
67-
68-
- [Sign up](https://portal.aws.amazon.com/billing/signup#/start) and login to your AWS account
69-
70-
- 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.
71-
72-
- Install the [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html#getting-started-install-instructions).
73-
74-
- Create an [AWS credentials file](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-quickstart.html#getting-started-quickstart-new).
75-
76-
- 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.
77-
78-
```sh
79-
npx arc env --add --env staging ARC_APP_SECRET $(openssl rand -hex 32)
80-
npx arc env --add --env staging SESSION_SECRET $(openssl rand -hex 32)
81-
npx arc env --add --env production ARC_APP_SECRET $(openssl rand -hex 32)
82-
npx arc env --add --env production SESSION_SECRET $(openssl rand -hex 32)
83-
```
84-
85-
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.
86-
87-
## Where do I find my CloudFormation?
88-
89-
You can find the CloudFormation template that Architect generated for you in the sam.yaml file.
90-
91-
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 MyRemixAppC4a6Staging and MyRemixAppC4a6Production) that matches what's in `app.arc`, you can find all of your app's resources under the "Resources" tab.
92-
93-
## GitHub Actions
94-
95-
We 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.
96-
97-
## Testing
98-
99-
### Cypress
100-
101-
We 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.
102-
103-
We use [`@testing-library/cypress`](https://testing-library.com/cypress) for selecting elements on the page semantically.
104-
105-
To 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.
106-
107-
We have a utility for testing authenticated features without having to go through the login flow:
108-
109-
```ts
110-
cy.login();
111-
// you are now logged in as a new user
112-
```
113-
114-
### Vitest
115-
116-
For 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).
117-
118-
### Type Checking
119-
120-
This 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`.
121-
122-
### Linting
123-
124-
This project uses ESLint for linting. That is configured in `.eslintrc.js`.
125-
126-
### Formatting
127-
128-
We 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.
36+
- **Interactive 3D Experiences**: Wanted to learn Three.js so built a 3D game
37+
- **Articles & Blog**: Rolled my own CMS based off Markdown
38+
- **Responsive Design**: Mobile-first approach with Tailwind CSS
39+
- **Analytics**: Google Analytics integration (GA4)
40+
- **SEO Optimized**: Server-side rendering with TanStack Start. Probably my favorite framework of a framework thus far.

package-lock.json

Lines changed: 78 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"devDependencies": {
3+
"@types/react-lazy-load-image-component": "^1.6.4"
4+
},
5+
"dependencies": {
6+
"react-lazy-load-image-component": "^1.6.3"
7+
}
8+
}

web/.cta.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"projectName": "r2dliu-website",
3+
"mode": "file-router",
4+
"typescript": true,
5+
"tailwind": true,
6+
"packageManager": "npm",
7+
"addOnOptions": {},
8+
"git": true,
9+
"version": 1,
10+
"framework": "react-cra",
11+
"chosenAddOns": ["eslint", "start"]
12+
}

0 commit comments

Comments
 (0)