Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

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: 2 days 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
pnpm 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)
- [sqlite on LiteFS](#sqlite-on-litefs)
- [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.

## sqlite on LiteFS

Follow the official steps for configuring LiteFS

1. create a volume `fly volumes create litefs --size 10`
3. create a Consul URL `fly consul attach`

## 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 `