This guide explains how to initialize a new project from the React Router Gospel Stack template.
After cloning or downloading the template:
pnpm install
pnpm run setupThe setup script runs an interactive setup that customizes the stack for your project.
The setup script (scripts/setup.mjs) performs several important tasks:
Prompts you for your organization name (e.g., @my-company or @acme-corp).
This name is used throughout the monorepo:
- Package names:
@my-company/webapp,@my-company/ui, etc. - Import statements
- Configuration files
- Documentation
Asks which database you want to use:
PostgreSQL
- Traditional relational database
- Full Prisma migration support
- Docker setup for local development
- Fly.io PostgreSQL for production
Turso (SQLite with libSQL)
- Edge-optimized distributed SQLite
- Embedded replicas for local-first architecture
- Manual migration application (Prisma limitations)
- Lower operational overhead
The script automatically updates:
- All
package.jsonfiles with your organization name - Import statements across the codebase
fly.tomlwith your app nameREADME.mdfiles- Configuration files (ESLint, TypeScript, etc.)
- GitHub Actions workflows
Creates .env and .env.docker files from .env.example:
- Generates a secure random
SESSION_SECRET - Copies all other environment variables
- Ready for you to customize
Runs Prettier to format all updated files consistently.
Updates pnpm-lock.yaml to ensure all dependencies are properly resolved.
# Download the template without git history
pnpm dlx degit PhilDL/react-router-gospel-stack my-app
cd my-app
# Install and initialize
pnpm install
pnpm run setup# Clone with full git history
git clone https://github.com/PhilDL/react-router-gospel-stack.git my-app
cd my-app
# Install and initialize
pnpm install
pnpm run setupOnce the init script completes, follow these steps to get your app running:
# 1. Start PostgreSQL container
pnpm run docker:db
# 2. Apply initial migrations
pnpm run db:migrate:apply
# 3. Build packages
pnpm run build --filter=@your-org/webapp...
# 4. Start dev server
pnpm run dev --filter=@your-org/webappYour app should now be running at http://localhost:5173
💡 For more info: See the Database Guide for advanced PostgreSQL configuration and Development Guide for detailed workflow information.
# 1. Start PostgreSQL container
pnpm run docker:db
# 2. Generate Prisma client
pnpm run db:generate
# 3. Apply initial migrations
pnpm run db:migrate:apply
# 4. Build packages
pnpm run build --filter=@your-org/webapp...
# 5. Start dev server
pnpm run dev --filter=@your-org/webappYour app should now be running at http://localhost:5173
💡 For more info: See the Database Guide for advanced PostgreSQL configuration and Development Guide for detailed workflow information.
# 1. No setup needed - local SQLite file will be created automatically
# 2. Apply initial migrations
pnpm run db:migrate:apply
# 3. Build packages
pnpm run build --filter=@your-org/webapp...
# 4. Start dev server
pnpm run dev --filter=@your-org/webappYour app should now be running at http://localhost:5173
💡 For more info: See the Database Guide for Turso production setup with embedded replicas and Development Guide for detailed workflow information.
# 1. No setup needed - local SQLite file will be created automatically
# 2. Generate Prisma client
pnpm run db:generate
# 3. Apply initial migrations
pnpm run db:migrate:apply
# 4. Build packages
pnpm run build --filter=@your-org/webapp...
# 5. Start dev server
pnpm run dev --filter=@your-org/webappYour app should now be running at http://localhost:5173
💡 For more info: See the Database Guide for Turso production setup with embedded replicas and Development Guide for detailed workflow information.
If you prefer to set up manually:
-
Replace organization name:
find . -type f \( -name "*.json" -o -name "*.ts" -o -name "*.tsx" \) \ -exec sed -i '' 's/@react-router-gospel-stack/@your-org/g' {} +
-
Replace app name:
find . -type f -name "fly.toml" \ -exec sed -i '' 's/react-router-gospel-stack/your-app-name/g' {} +
-
Copy environment files:
cp .env.example .env cp .env.example .env.docker
-
Generate SESSION_SECRET:
# Add to .env: SESSION_SECRET="$(openssl rand -hex 16)"
-
Choose database: Follow the Database Guide to set up your chosen database.
Install Node.js v22 or higher:
# Using nvm
nvm install 22
nvm use 22
# Or download from nodejs.orgFollow the official pnpm installation guide: https://pnpm.io/installation
If the init script fails:
- Check you're in the project root directory
- Ensure you've run
pnpm installfirst - Check Node.js version:
node --version(should be v22+) - Try running manually:
node scripts/setup.mjs - Check the error message for specific issues
Make the script executable:
chmod +x scripts/setup.mjsYou can re-run the setup script if needed, but be aware:
- It will overwrite your customizations
- Backup your changes first
- Consider manual edits for small changes
To re-run:
pnpm run setupIf you're:
- Forking the repository for contributions
- Creating a stack variant
- Just exploring the code
You can skip initialization and use the default names:
pnpm install
pnpm run build
pnpm run dev --filter=@react-router-gospel-stack/webappThis stack previously used Remix's automatic initialization system (pnpm create remix@latest). Since React Router v7+ doesn't support that system, we now use a standalone setup script that provides the similar functionalities to what was running in the remix.init folder.
🎉 You're all set! Your app should be running.
Optional reading to learn more:
- Development Guide - Learn about the development workflow, monorepo tools, and best practices
- Database Guide - Deep dive into database operations, migrations, and switching ORMs
- Architecture - Understand the monorepo structure and how packages work together
- Deployment - When you're ready to deploy to production on Fly.io
- Testing Guide - Set up unit tests and E2E tests
- UI Package - Work with shadcn/ui components
Start building! 🚀