Skip to content

Commit

Permalink
feat: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
barclayd committed Dec 8, 2024
1 parent 515b95e commit bb56fa6
Show file tree
Hide file tree
Showing 33 changed files with 609 additions and 22 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
name: Build and Test
timeout-minutes: 15
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 2

- uses: oven-sh/setup-bun@v2

- name: Create Service Account file
run: |
echo "${{ secrets.FIRESTORE_SERVICE_ACCOUNT_BASE64 }}" | base64 -d > apps/server/service-account.json
- name: Cache bun dependencies
uses: actions/cache@v4
with:
path: |
~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}


- name: Install dependencies
run: bun install

- name: Install Playwright Browsers
run: bunx playwright install --with-deps chromium

- name: Lint
run: bun run lint

- name: Test
run: |
bun run dev & # Start in background
bunx wait-on http://localhost:5173
bun run test
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: apps/web/playwright-report
retention-days: 30
44 changes: 44 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
node_modules
.pnp
.pnp.js

# Local env files
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

# Testing
coverage

# Turbo
.turbo

# Vercel
.vercel

# Build Outputs
.next/
out/
build
dist


# Debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Misc
.DS_Store
*.pem

# IDE
.code
.idea

# React Router
.react-router/
.vite/
/build/
37 changes: 30 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,34 @@
To install dependencies:
```sh
# React Router + Hono Monorepo Template

### Setup

```shell
git clone https://github.com/barclayd/<repo-name>
cd repo-name
bun install
```

To run:
```sh
bun run dev
```
### Technologies

| Category | Technology | Version |
|-------------------|------------|---------|
| Monorepo | [<img src="https://user-images.githubusercontent.com/4060187/196936104-5797972c-ab10-4834-bd61-0d1e5f442c9c.png" width="40" alt="Turborepo">](https://turbo.build/repo) [Turborepo](https://turbo.build/repo) | 2.3.3 |
| Workspace/Runtime | [<img src="https://bun.sh/logo.svg" width="40" alt="Bun">](https://bun.sh) [Bun](https://bun.sh) | 1.1.38 |
| Linting | [<img src="https://avatars.githubusercontent.com/u/140182603?s=200&v=4" width="40" alt="Biome">](https://biomejs.dev/) [Biome](https://biomejs.dev/) | 1.9.4 |
| Language | [<img src="https://raw.githubusercontent.com/github/explore/80688e429a7d4ef2fca1e82350fe8e3517d3494d/topics/typescript/typescript.png" width="40" alt="TypeScript">](https://www.typescriptlang.org/) [TypeScript](https://www.typescriptlang.org/) | 5.5.4 |
| Server | [<img src="https://raw.githubusercontent.com/honojs/hono/main/docs/images/hono-logo.png" width="40" alt="Hono">](https://hono.dev) [Hono](https://hono.dev) | 4.6.13 |
| API | [<img src="https://trpc.io/img/logo.svg" width="40" alt="tRPC">](https://trpc.io) [tRPC](https://trpc.io) | 11.0.0-rc.660 |
| Schema Validation | [<img src="https://zod.dev/logo.svg" width="40" alt="Zod">](https://zod.dev) [Zod](https://zod.dev) | 3.23.8 |
| UI Framework | [<img src="https://reactrouter.com/splash/hero-3d-logo.dark.webp" width="40" alt="React Router">](https://reactrouter.com) [React Router](https://reactrouter.com) | 7.0.2 |
| UI Library | [<img src="https://reactjs.org/favicon.ico" width="40" alt="React">](https://react.dev) [React](https://react.dev) | 19.0.0 |
| Styling | [<img src="https://tailwindcss.com/_next/static/media/tailwindcss-mark.3c5441fc7a190fb1800d4a5c7f07ba4b1345a9c8.svg" width="40" alt="Tailwind CSS">](https://tailwindcss.com) [Tailwind CSS](https://tailwindcss.com) | 4.0.0-beta.6 |
| E2E Testing | [<img src="https://playwright.dev/img/playwright-logo.svg" width="40" alt="Playwright">](https://playwright.dev) [Playwright](https://playwright.dev) | 1.49.0 |
| Bundler | [<img src="https://vitejs.dev/logo.svg" width="40" alt="Vite">](https://vitejs.dev) [Vite](https://vitejs.dev) | 6.0.3 |
| CI | [<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/9/91/Octicons-mark-github.svg/1200px-Octicons-mark-github.svg.png" width="40" alt="GitHub Actions">](https://github.com/features/actions) [GitHub Actions](https://github.com/features/actions) | N/A |

### Still to come

open http://localhost:3000
* Database connectivity - SQL and NoSQL
* Vitest + Vitest Browser Mode
* Docker
* Deployment via CD, powered by Github Actions
11 changes: 11 additions & 0 deletions apps/server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
To install dependencies:
```sh
bun install
```

To run:
```sh
bun run dev
```

open http://localhost:3000
File renamed without changes.
20 changes: 20 additions & 0 deletions apps/server/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "server",
"scripts": {
"dev": "bun run --hot src/index.ts",
"lint": "bunx biome check --write .",
"test": "bun test",
"types": "tsc --noEmit"
},
"dependencies": {
"@trpc/server": "^11.0.0-rc.660",
"hono": "^4.6.13",
"uuid": "^11.0.3",
"zod": "^3.23.8"
},
"devDependencies": {
"@biomejs/biome": "^1.9.4",
"@hono/trpc-server": "0.3.4",
"@types/bun": "latest"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions apps/web/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.react-router
build
node_modules
README.md
5 changes: 5 additions & 0 deletions apps/web/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules/
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
25 changes: 25 additions & 0 deletions apps/web/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM oven/bun:1 AS dependencies-env
COPY . /app

FROM dependencies-env AS development-dependencies-env
COPY ./package.json bun.lockb /app/
WORKDIR /app
RUN bun i --frozen-lockfile

FROM dependencies-env AS production-dependencies-env
COPY ./package.json bun.lockb /app/
WORKDIR /app
RUN bun i --production

FROM dependencies-env AS build-env
COPY ./package.json bun.lockb /app/
COPY --from=development-dependencies-env /app/node_modules /app/node_modules
WORKDIR /app
RUN bun run build

FROM dependencies-env
COPY ./package.json bun.lockb /app/
COPY --from=production-dependencies-env /app/node_modules /app/node_modules
COPY --from=build-env /app/build /app/build
WORKDIR /app
CMD ["bun", "run", "start"]
100 changes: 100 additions & 0 deletions apps/web/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# Welcome to React Router!

A modern, production-ready template for building full-stack React applications using React Router.

[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/remix-run/react-router-templates/tree/main/default)

## Features

- 🚀 Server-side rendering
- ⚡️ Hot Module Replacement (HMR)
- 📦 Asset bundling and optimization
- 🔄 Data loading and mutations
- 🔒 TypeScript by default
- 🎉 TailwindCSS for styling
- 📖 [React Router docs](https://reactrouter.com/)

## Getting Started

### Installation

Install the dependencies:

```bash
npm install
```

### Development

Start the development server with HMR:

```bash
npm run dev
```

Your application will be available at `http://localhost:5173`.

## Building for Production

Create a production build:

```bash
npm run build
```

## Deployment

### Docker Deployment

This template includes three Dockerfiles optimized for different package managers:

- `Dockerfile` - for npm
- `Dockerfile.pnpm` - for pnpm
- `Dockerfile.bun` - for bun

To build and run using Docker:

```bash
# For npm
docker build -t my-app .

# For pnpm
docker build -f Dockerfile.pnpm -t my-app .

# For bun
docker build -f Dockerfile -t my-app .

# Run the container
docker run -p 3000:3000 my-app
```

The containerized application can be deployed to any platform that supports Docker, including:

- AWS ECS
- Google Cloud Run
- Azure Container Apps
- Digital Ocean App Platform
- Fly.io
- Railway

### DIY Deployment

If you're familiar with deploying Node applications, the built-in app server is production-ready.

Make sure to deploy the output of `npm run build`

```
├── package.json
├── package-lock.json (or pnpm-lock.yaml, or bun.lockb)
├── build/
│ ├── client/ # Static assets
│ └── server/ # Server-side code
```

## Styling

This template comes with [Tailwind CSS](https://tailwindcss.com/) already configured for a simple default starting experience. You can use whatever CSS framework you prefer.

---

Built with ❤️ using React Router.
9 changes: 9 additions & 0 deletions apps/web/app/app.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@import "tailwindcss";

@layer theme, base, components, utilities;

@layer theme {
:root {
--font-sans: '"Inter"', ui-sans-serif, system-ui, sans-serif;
}
}
Loading

0 comments on commit bb56fa6

Please sign in to comment.