A modern, production-ready template for building full-stack React applications with TanStack Start and AWS Amplify Gen 2.
- AWS Cognito User Pools with email/password
- Amplify UI components for sign-in/sign-up
- Email confirmation and password reset
- Protected routes with automatic redirects
- Session management with JWT tokens
- AWS Amplify Gen 2 GraphQL API & Cognito Auth
- TanStack Start for full-stack React
- TanStack Router for type-safe routing
- TypeScript throughout the entire stack
- Tailwind CSS for styling
Click the "Use this template" button above or:
gh repo create my-awesome-app --template jayarerita/tanstack-start-amplify-template
cd my-awesome-appnpm installnpm run amplify:sandboxThis will:
- Deploy your backend to AWS
- Generate
amplify_outputs.jsonconfiguration - Set up Cognito User Pool and AppSync API
npm run devNavigate to http://localhost:3000 and start building! π
βββ amplify/ # AWS Amplify backend
β βββ auth/resource.ts # Cognito configuration
β βββ data/resource.ts # GraphQL schema & DynamoDB
β βββ backend.ts # Main backend setup
βββ src/
β βββ components/ # React components
β β βββ AuthenticatorWrapper.tsx
β β βββ Login.tsx
β βββ hooks/ # Custom React hooks
β β βββ useAuth.ts
β βββ lib/ # Utilities & configuration
β β βββ amplify.ts
β β βββ data.ts
β β βββ amplify-ui-theme.ts
β βββ routes/ # TanStack Router routes
β β βββ __root.tsx # Root layout
β β βββ index.tsx # Home page
β β βββ login.tsx # Authentication
β β βββ _authed/ # Protected routes
β βββ styles/
β βββ app.css # Global styles
βββ README.md
| Command | Description |
|---|---|
npm run dev |
Start development server |
npm run build |
Build for production |
npm run start |
Start production server |
npm run amplify:sandbox |
Deploy backend to sandbox |
npm run amplify:deploy |
Deploy backend to production |
Customize the authentication experience in src/components/AuthenticatorWrapper.tsx:
<Authenticator
signUpAttributes={['email']}
socialProviders={['google', 'facebook']} // Add social providers
components={{
Header() {
return <YourCustomHeader />
}
}}
>Add new data models in amplify/data/resource.ts:
const schema = a.schema({
Post: a.model({
title: a.string().required(),
content: a.string().required(),
// Add your fields here
}).authorization((allow) => [
allow.authenticated()
])
})- Global styles:
src/styles/app.css - Amplify UI theme:
src/lib/amplify-ui-theme.ts - Tailwind configuration:
tailwind.config.mjs
# Development
npm run amplify:sandbox
# Production
npm run amplify:deployDeploy to any static hosting service:
- AWS Amplify Hosting (recommended)
- Vercel
- Netlify
- AWS S3 + CloudFront
- π Detailed Setup Guide
- π Authentication Guide
- π€ Contributing Guidelines
- π Security Policy
- π Template Documentation
- TanStack Start Documentation
- AWS Amplify Gen 2 Documentation
- Amplify UI Documentation
- TanStack Router Documentation
We welcome contributions! Please see our Contributing Guidelines for details.
This project is licensed under the MIT License - see the LICENSE file for details.
- π Check the setup guide
- π Report bugs
- π‘ Request features
- π¬ Start a discussion
If this template helped you, please give it a star! β
Built with β€οΈ using TanStack Start and AWS Amplify