Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/flyck/trpc-prisma-cdk-example
https://github.com/flyck/trpc-prisma-cdk-example
Last synced: 9 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/flyck/trpc-prisma-cdk-example
- Owner: flyck
- Created: 2023-08-06T15:16:51.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-09-21T17:39:45.000Z (over 1 year ago)
- Last Synced: 2024-12-15T14:49:18.484Z (13 days ago)
- Language: TypeScript
- Size: 257 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
# Prisma + tRPC + AWS CDK
The awesome trpc + prisma starter combo but with the AWS CDK infrastructure ontop.
## Features
- 🧙♂️ E2E typesafety with [tRPC](https://trpc.io)
- ⚡ Full-stack React with Next.js
- ⚡ Database with Prisma
- ☁ AWS CDK Stack
- ⚙️ VSCode extensions
- 🎨 ESLint + Prettier
- 💚 CI setup using GitHub Actions:
- ✅ E2E testing with [Playwright](https://playwright.dev/)
- ✅ Linting
- 🔐 Validates your env vars on build and start## Setup
- Clone this repo
- Start the local Dockerfile for local development
```bash
docker build -t my-postgres-image .
docker run -p 5432:5432 my-postgres-image
```
- Install and run
```bash
pnpm
pnpm dx
```
- Deploy to AWS
- move into the stack directory
- fill out the cdk.json according to your AWS account
- Deploy the infrastructure (you might want to limit network access)
```bash
yarn install
AWS_PROFILE=personal yarn deploy:infra
# push your schema to the fresh database
cd ..
DATABASE_URL="postgres://postgres:[email protected]/main" npx prisma db push
cd stack
AWS_PROFILE=personal yarn deploy:frontend
```
- Browse to your url and enjoy!### Requirements
- Node18
- Postgres## Development
### Commands
```bash
pnpm build # runs `prisma generate` + `prisma migrate` + `next build`
pnpm db-reset # resets local db
pnpm dev # starts next.js
pnpm dx # starts postgres db + runs migrations + seeds + starts next.js
pnpm test-dev # runs e2e tests on dev
pnpm test-start # runs e2e tests on `next start` - build required before
pnpm test:unit # runs normal Vitest unit tests
pnpm test:e2e # runs e2e tests
```## Deployment
### Using [Render](https://render.com/)
The project contains a [`render.yaml`](./render.yaml) [_"Blueprint"_](https://render.com/docs/blueprint-spec) which makes the project easily deployable on [Render](https://render.com/).
Go to [dashboard.render.com/blueprints](https://dashboard.render.com/blueprints) and connect to this Blueprint and see how the app and database automatically gets deployed.
## Files of note
Path
Description
./prisma/schema.prisma
Prisma schema
./src/pages/api/trpc/[trpc].ts
tRPC response handler
./src/server/routers
Your app's different tRPC-routers
---
Created by [@alexdotjs](https://twitter.com/alexdotjs).