An open API service indexing awesome lists of open source software.

https://github.com/giacomorebonato/fastrat

Fullstack starter kit, using Fastify + React = FastRat
https://github.com/giacomorebonato/fastrat

fastify playwright pwa react typescript vite

Last synced: about 1 year ago
JSON representation

Fullstack starter kit, using Fastify + React = FastRat

Awesome Lists containing this project

README

          

# Fastify + React = FastRat!


A rat on a skateboard

## Quickstart

```bash
gh repo clone giacomorebonato/fastrat-test # clone the repository
pnpm install # install dependencies
node --run dev # start the project in dev mode
```

To enable authentication and a production database, rename `.env.example` to `.env` and fill the fields properly.
In a production environment, you should set those environment variables directly.

[Example with Fly.io](https://fly.io/docs/reference/secrets/)

- [Authentication](#authentication)
- [libSQL (SQLite fork) on Turso](#libsql-sqlite-fork-on-turso)
- [SSR and Routing](#ssr-and-routing)
- [tRPC](#trpc)
- [Server side data fetching](#server-side-data-fetching)
- [Testing](#testing)
- [Deploy](#deploy)
- [Credits](#credits)

## Based on these libraries

* [Fastify](https://fastify.dev): a fast well maintained web framework
* [Vite](https://vitejs.dev): for frontend tooling and bundling
* [tRPC](https://trpc.io/docs/server/adapters/fastify): for end points with E2E type safety
* [Tanstack Router](https://tanstack.com/router/latest): for filesystem based routes with type safety
* [Vavite](https://github.com/cyco130/vavite): use Vite to compile and bundle both client and server code
* [Fly.io](https://fly.io): for deployment

Thanks to Vavite, any change to frontend or backend code will be reflected immediately, without manually restarting the server.

## Authentication

Provide `GOOGLE_CLIENT_ID` and `GOOGLE_CLIENT_SECRET` into the `.env` file to allow Google authentication ([instructions](https://www.balbooa.com/help/gridbox-documentation/integrations/other/google-client-id)).
You can check how authentication is achieved in [src/features/auth/google-auth.ts](src/auth/google-auth.ts) by leveraging [fastify-oauth2](https://github.com/fastify/fastify-oauth2).
It should be easy for you to re-use this example to add other authentication providers.

## libSQL (SQLite fork) on Turso

1. install the [turso CLI](https://docs.turso.tech/cli/installation)
2. login and create a database `turso db create fastrat`
3. get an authentication token with `turso db tokens create fastrat`
4. [set Fly.io secrets accordingly](https://fly.io/docs/flyctl/secrets-set/)

## SSR and Routing

SSR is achieved by following [Tanstack router examples](https://github.com/TanStack/router/tree/main/examples/react/basic-ssr-streaming-file-based).
The page content is streamed and meta tags in `