https://github.com/alan345/ai-fullstack-saas-boilerplate
Fullstack SaaS Boilerplate built with tRPC, Fastify and React
https://github.com/alan345/ai-fullstack-saas-boilerplate
ai better-auth chat drizzle-orm fastify openai postgres react server-sent-events tailwind trpc typescipt zustand
Last synced: 3 days ago
JSON representation
Fullstack SaaS Boilerplate built with tRPC, Fastify and React
- Host: GitHub
- URL: https://github.com/alan345/ai-fullstack-saas-boilerplate
- Owner: alan345
- License: mit
- Created: 2018-02-27T22:35:39.000Z (about 8 years ago)
- Default Branch: main
- Last Pushed: 2026-02-19T02:03:15.000Z (21 days ago)
- Last Synced: 2026-02-19T02:04:28.432Z (21 days ago)
- Topics: ai, better-auth, chat, drizzle-orm, fastify, openai, postgres, react, server-sent-events, tailwind, trpc, typescipt, zustand
- Language: TypeScript
- Homepage: https://alan345.github.io/Fullstack-SaaS-Boilerplate/
- Size: 4.28 MB
- Stars: 1,325
- Watchers: 27
- Forks: 207
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-ChatGPT-repositories - AI-Fullstack-SaaS-Boilerplate - Fullstack SaaS Boilerplate built with tRPC, Fastify and React (The latest additions π)
README
Fullstack SaaS Boilerplate with AI
Built with Fastify, tRPC, and React.
## Project
[](https://github.com/alan345/Fullstack-SaaS-Boilerplate/stargazers)
[](https://github.com/alan345/Fullstack-SaaS-Boilerplate/network)
[](https://github.com/alan345/Fullstack-SaaS-Boilerplate/blob/master/LICENSE)
[](https://github.com/alan345/Fullstack-SaaS-Boilerplate/issues)
[](https://github.com/sponsors/alan345)
## Demo
Hosted by [render.com](http://render.com/) for free
As it is a free tier, this Demo will spin down with inactivity, which can delay requests by 50 seconds or more. Be patient!
## Preview
[fsb-chat.webm](https://github.com/user-attachments/assets/3238e01d-4463-4d46-b99f-29b14015dd3f)
## Main Stack
| Technology | Description | Stars |
| ------------------------------------------------- | --------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Drizzle | A TypeScript-first ORM for Node.js |
|
| Fastify | Fast, unopinionated, minimalist web framework for Node.js |
|
| Postgres | The world's most advanced open source database |
|
| React 19 | A JavaScript library for building user interfaces |
|
| Tailwind v4 | A utility-first CSS framework for rapid UI development |
|
| tRPC | End-to-end typesafe APIs made easy |
|
## Other dependencies
| Technology | Description | Stars |
| -------------------------------------------------------- | ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Better Auth | Authentication library for Node.js |
|
| OpenAI | API for GPT models, embeddings, and more |
|
| Phosphor Icons | Beautifully simple & consistent icons |
|
| pnpm Workspaces | Fast, disk space efficient package manager for monorepos |
|
| Playwright | Test your web apps headlessly with a single API |
|
| React Router v7 | Declarative routing for React |
|
| TypeScript | TypeScript is a typed superset of JavaScript |
|
| Vite | Next generation frontend tooling. It's fast! |
|
| Zod | TypeScript-first schema validation with static type inference |
|
## Star History
[](https://www.star-history.com/#alan345/Fullstack-SaaS-Boilerplate&Date)
## Features
- [Games from fanapis.com](https://docs.zelda.fanapis.com/) Example of pulling data from externals REST API
- Health Check for the server (http://localhost:2022/health.trpc) and (http://localhost:2022)
- Search with Debounce Using a Custom Hook
- Chat with Server-Sent Events (SSE). SSE is easier to setup and don't require setting up a WebSocket server.
## Installation
- Install [pnpm](https://pnpm.io/installation) if you haven't already: `npm install -g pnpm`
- Rename the `example.env` files to `.env` with your own credentials: [server](https://github.com/alan345/Fullstack-SaaS-Boilerplate/blob/main/example.env), [client](https://github.com/alan345/Fullstack-SaaS-Boilerplate/blob/main/client/example.env)
- Make sure Postgres is running and create a new database called `fsb`
```bash
psql -U user // replace user by your postgres user
CREATE DATABASE fsb;
```
- Run in the terminal in the root directory:
```bash
# Install the dependencies
pnpm install
# Setup the database
pnpm run push
# Seed the database
pnpm run seed
# Run the app (it will run the client and the server automatically)
pnpm run dev
```
## Building for production
```bash
pnpm run build
pnpm run start
```
## Printscreens
[Impersonate User](https://github.com/user-attachments/assets/4b12f604-a31b-46a4-9930-0cebb17f2525)
[Login - Signup](https://github.com/user-attachments/assets/73d90df0-cb43-4cf2-a4cf-6584a9e6a0a4)

## Motivation
Focusing on developer experience: simple, efficient, and fast. This modern stack uses top-tier libraries to build a full-stack web application. Unlike the T3 app (https://create.t3.gg), we opted not to use Next.js, allowing the frontend to remain as static files, easily stored in cloud object storage like AWS S3. Consequently, this stack is designed for building web apps rather than traditional websites, as it is not SEO-friendly.
## End-to-end typesafe with tRPC

Video from https://trpc.io
## E2E Testing
The tests should be executed while the application is running.
#### Running the tests in the Terminal
```
pnpm run test
```
## Other recommendations
- Need a component library? Check out [Chakra UI](https://v2.chakra-ui.com/)
- This project uses [pnpm](https://pnpm.io/workspaces) workspaces for fast, disk-efficient installs
## Who is using FSB?
- [Nachonacho.com](https://Nachonacho.com) - The world's largest marketplace for Software & Services
Create a PR if you want to add your project here.
## How can you help?
This project is free and open source. If you found it useful, consider giving it a star β or sponsoring me π β it really helps!
I'm always open to feedback, so feel free to share suggestions to improve the stack.
Youβre also welcome to contribute by opening a pull request π.
[](https://github.com/sponsors/alan345)