Skip to content

Latest commit

Β 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

TanStack Start Template

A production-ready starter template built with the TanStack ecosystem and shadcn/ui, providing a solid foundation for modern full-stack applications.

Unlike minimal starters, this template already includes authentication, multi-tenancy, a complete application layout, theme management, validation, and a scalable project structure, allowing you to focus on your business logic instead of boilerplate.


Features

  • ⚑ TanStack Start
  • 🧭 TanStack Router (File-based Routing)
  • πŸ”„ TanStack Query
  • βœ… TanStack Form
  • πŸ“ Zod validation
  • 🎨 shadcn/ui
  • πŸŒ™ Light / Dark / System theme
  • πŸ’Ύ Persistent theme and sidebar state
  • πŸ“‚ Responsive collapsible sidebar
  • 🧩 Icon-only sidebar mode
  • πŸ‘€ User menu
  • 🍞 Dynamic breadcrumbs
  • πŸ”” Notifications popover
  • ✨ Framer Motion animations
  • 🍞 Sonner toast notifications
  • πŸ” Authentication using TanStack Server Functions
  • πŸͺ Secure session management
  • πŸ”‘ Argon2 password hashing
  • 🏒 Multi-tenant architecture
  • πŸ”€ Built-in tenant switcher
  • πŸ—„οΈ Kysely Query Builder
  • ☁️ Supabase integration example
  • πŸ“… Luxon utilities
  • 🎯 TypeScript-first architecture

Why this template?

This project is designed as a practical starting point for real-world applications such as:

  • SaaS platforms
  • Admin panels
  • Dashboards
  • CRM systems
  • Business applications
  • Internal tools

Instead of starting from an empty project, you'll already have:

  • Authentication
  • Multi-tenancy
  • Responsive layout
  • Theme management
  • Shared validation
  • Session handling
  • Production-ready project organization

Screenshots

Screenshots and GIFs coming soon.


Tech Stack

Frontend

  • React 19
  • TypeScript
  • TanStack Start
  • TanStack Router
  • TanStack Query
  • TanStack Form
  • Tailwind CSS v4
  • shadcn/ui
  • Radix UI
  • Framer Motion
  • Lucide React
  • Sonner

Backend

  • TanStack Server Functions
  • Kysely
  • Microsoft SQL Server (Tedious)
  • Argon2

Validation

Validation is powered by Zod across the entire application.

Schemas are reused whenever possible to provide end-to-end type safety.

Validation is already integrated with:

  • Route search parameters
  • TanStack Form schemas
  • Server Function input validation
  • Shared domain models

This ensures a consistent validation strategy across both client and server.


Included

Application Layout

The template already provides a complete application shell.

Included components:

  • Responsive sidebar
  • Collapsible sidebar
  • Icon-only sidebar mode
  • Dynamic breadcrumbs
  • User menu
  • Notification popover
  • Responsive toolbar
  • Mobile-friendly navigation

Theme Support

Three theme modes are supported:

  • Light
  • Dark
  • System

The selected theme is automatically persisted.


Sidebar State

The sidebar automatically remembers whether it is:

  • Expanded
  • Collapsed
  • Icon-only

Its state is persisted across sessions.


Authentication

Authentication is entirely server-driven using TanStack Start Server Functions.

Included:

  • Login
  • Logout
  • Session creation
  • Session validation
  • Protected routes
  • Secure password hashing (Argon2)

The implementation intentionally remains lightweight and framework-native.


Multi-Tenant Support

Multi-tenancy is already integrated.

Features include:

  • Tenant switcher
  • Active tenant selection
  • Tenant-aware architecture
  • Easy extension for custom permission systems

Database

The default implementation uses:

  • Microsoft SQL Server
  • Kysely Query Builder

The project has been structured to make replacing the database provider straightforward.

Kysely supports many SQL dialects.

For other providers, refer to the official documentation:

https://kysely.dev/


Supabase Integration

A complete Supabase integration example is included.

The repository already contains:

  • Client configuration
  • Server configuration
  • Authentication example
  • Server Functions
  • Project structure

Important

Supabase generates database types specific to your own project.

Before using the included integration, you must generate your own database types and replace the placeholder types.

After generating the types, update:

  • client.ts
  • server.ts

to use your generated Database type.


Getting Started

Requirements

  • Node.js 20+
  • npm

Clone the repository

git clone <repository-url>

cd tanstack-start-template

Install dependencies

npm install

Configure environment variables

Create your environment file.

cp .env.example .env

Configure the required values.

The project already contains the necessary configuration to support different database providers.


Configure the database

By default the template uses Microsoft SQL Server.

Update your connection string inside .env.

If you prefer another database provider, simply configure the appropriate Kysely dialect.

More information:

https://kysely.dev/


Start the development server

npm run dev

Build

npm run build

Run production

npm run start

Project Structure

src/
β”‚
β”œβ”€β”€ components/
β”œβ”€β”€ routes/
β”œβ”€β”€ server/
β”œβ”€β”€ providers/
β”œβ”€β”€ hooks/
β”œβ”€β”€ db/
β”œβ”€β”€ lib/
β”œβ”€β”€ utils/
β”œβ”€β”€ models/
└── styles/

The folder organization is intentionally modular to make future extensions simple.


Validation

Validation is one of the core concepts of the template.

Zod is used consistently across the application.

Current integrations include:

  • Route search validation
  • Form validation
  • Server Function parameter validation

This provides a fully typed experience from the browser to the server.


Authentication Flow

The default implementation includes:

  • Login
  • Logout
  • Password hashing
  • Session creation
  • Session validation
  • Protected routes

Not included:

  • ❌ User registration
  • ❌ Password reset
  • ❌ Email verification
  • ❌ OAuth providers

Those features are intentionally left out so they can be implemented according to each project's business requirements.


Customization

The project has been designed to be easily extensible.

You can replace or customize:

  • Database provider
  • Authentication provider
  • Session implementation
  • Tenant logic
  • UI components
  • Theme provider
  • Permission system

without changing the overall project architecture.


Roadmap

Current features:

  • βœ… Authentication
  • βœ… Session management
  • βœ… Multi-tenancy
  • βœ… Theme support
  • βœ… Responsive layout
  • βœ… Dynamic breadcrumbs
  • βœ… Notifications
  • βœ… Kysely integration
  • βœ… Supabase example
  • βœ… Shared Zod validation

Planned:

  • ⏳ Sign Up
  • ⏳ Password reset
  • ⏳ Email verification
  • ⏳ OAuth examples

Contributing

Contributions, ideas, bug reports and pull requests are welcome.

If you find this template useful, feel free to improve it or adapt it to your own projects.


License

Released under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages