Complete guide to set up and run TSStarter locally with all features configured
Welcome to TSStarter! This guide will help you get up and running with your new full-stack TypeScript application in just a few minutes.
Before you begin, make sure you have the following installed:
If you don't have Bun installed, you can install it with:
curl -fsSL https://bun.sh/install | bash
## Quick Start
### 1. Access Your Repository
After purchasing TSStarter, you'll receive a GitHub invitation email. Accept the invitation to access your private repository.
```bash
git clone https://github.com/tsstarter/tsstarter your-project-name
cd your-project-name
bun install
Copy the example environment file and configure it:
cp env.example .env
Edit .env
and configure the following variables:
# Required - Generate a secure random string (32+ characters)
BETTER_AUTH_SECRET=your-secret-key-here
# Database - Use SQLite for local development
DATABASE_URL=file:./local.db
# Development
BASE_URL=http://localhost:3000
VITE_BASE_URL=http://localhost:3000
TSStarter supports multiple authentication methods. Choose the ones that work best for your setup:
# Email Service (Required for email verification)
PLUNK_API_KEY=your-plunk-api-key
# GitHub OAuth
GITHUB_CLIENT_ID=your-github-client-id
GITHUB_CLIENT_SECRET=your-github-client-secret
# Google OAuth
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret
# Leave authentication variables empty for development
# Users can still access the app without authentication
### 4. Configure Local Database
For local development, the database is already configured to use SQLite. The `drizzle.config.ts` file should look like this:
```typescript
import { config } from "dotenv";
import { defineConfig } from "drizzle-kit";
config({ path: ".env" });
export default defineConfig({
schema: "./src/db/schema.ts",
out: "./drizzle/migrations",
dialect: "sqlite",
dbCredentials: {
url: process.env.DATABASE_URL!,
},
verbose: true,
strict: true,
});
Generate and run the database migrations:
# Generate migration files
bun run db:generate
# Push schema to database
bun run db:push
bun run dev
Your application will be available at http://localhost:3000.
Note: These features are optional and can be configured later. You can get started without them.
For AI chat functionality, add your API keys:
# AI Providers
OPENAI_API_KEY=your-openai-api-key
ANTHROPIC_API_KEY=your-anthropic-api-key
Note: This is only needed if you want to implement payment processing. You can skip this for initial setup.
For payment processing:
# Polar Payments
VITE_POLAR_PUBLIC_CHECKOUT_URL=https://sandbox.polar.sh/checkout/your-checkout-link
VITE_POLAR_SUCCESS_URL=http://localhost:3000/payment/success
POLAR_WEBHOOK_SECRET=your-polar-webhook-secret
Command | Description |
---|---|
bun run dev | Start development server |
bun run build | Build for production |
bun run start | Start production server |
bun run lint | Run ESLint |
bun run format | Format code with Prettier |
bun run check-types | Type check with TypeScript |
bun run test | Run tests |
bun run db:studio | Open Drizzle Studio for database management |
bun run db:generate | Generate database migrations |
bun run db:push | Push schema changes to database |
bun run db:migrate | Run database migrations |
tsstarter/
โโโ ๐ src/
โ โโโ ๐งฉ components/ # React components
โ โ โโโ ui/ # Reusable UI components (shadcn/ui)
โ โ โโโ app/ # Application-specific components
โ โโโ ๐๏ธ db/ # Database layer
โ โ โโโ schema.ts # Drizzle schema definitions
โ โ โโโ migrate.ts # Database migrations
โ โโโ ๐ง lib/ # Shared utilities
โ โ โโโ auth/ # Authentication logic
โ โ โโโ hooks/ # Custom React hooks
โ โ โโโ orpc.ts # oRPC client configuration
โ โ โโโ utils.ts # Helper functions
โ โโโ ๐ฃ๏ธ routes/ # Application routes
โ โ โโโ _authed/ # Protected routes
โ โ โโโ api/ # API endpoints
โ โ โโโ __root.tsx # Root layout
โ โโโ ๐ฅ๏ธ server/ # Server-side code
โ โ โโโ routes/ # oRPC procedures
โ โ โโโ handler.ts # Request handler
โ โ โโโ orpc.ts # oRPC server setup
โ โโโ ๐จ styles.css # Global styles
โโโ ๐ content/ # MDX content
โ โโโ blog/ # Blog posts
โ โโโ docs/ # Documentation
โโโ ๐ drizzle/ # Database migrations
โโโ ๐ public/ # Static assets
โโโ ๐ Configuration files
bun run dev
# View database in browser
bun run db:studio
# Generate new migrations
bun run db:generate
# Apply migrations
bun run db:push
# Run tests
bun run test
# Type checking
bun run check-types
# Linting
bun run lint
src/components/ui/
content/blog/
Port already in use:
# Kill processes on ports 3000, 3001, 3002
lsof -ti:3000,3001,3002 | xargs kill -9
Database connection issues:
# Reset database
rm local.db
bun run db:push
Dependencies issues:
# Clear cache and reinstall
rm -rf node_modules bun.lockb
bun install
Happy coding! ๐