LogRocket Blog

An introduction to the TanStack Start framework

thumbnail

TanStack Start Framework Tutorial

Introduction

This tutorial introduces the TanStack Start framework, a full-stack React framework built on Vite, Nitro, and TanStack Router. It highlights key features and provides a step-by-step guide on how to build a simple developer portfolio using TanStack Start.

Features of TanStack Start

  • Full Stack Type Safety: Guarantees type safety on both client and server sides of an application.
  • Server Functions: Functions that can be invoked from either client or server, always running on the server.
  • Middleware Extension for Server Functions: Allows extending server functions with middleware.

Setting Up a TanStack Start Project

  1. Create a new folder for the project and initialize npm.
  2. Install TypeScript as a dev dependency.
  3. Create a TypeScript configuration file and install necessary npm packages (TanStack Start, TanStack Router, Vinxi).
  4. Set up server-side rendering (SSR) in the project.

Installing Tailwind CSS in TanStack Start

  1. Install Tailwind CSS and its Vite plugin.
  2. Configure the Vite plugin in the project's config file.
  3. Create a CSS file and import it into the project.
  4. Import the CSS file into the root route of the application.

Building the Developer Portfolio

  1. Create a header component to be present in every route.
  2. Create a card component for each project listed in the portfolio.
  3. Create a project route with a server function to send emails using Nodemailer.

This tutorial provides a comprehensive guide on using TanStack Start to build a full-stack React application, complete with type safety, server functions, and Tailwind CSS styling.