Prerequisites
Before you begin, ensure you have the following installed:- Node.js (v18 or higher)
- pnpm (v10.11.0 or higher)
- Docker and Docker Compose (for local database)
- Git for cloning the repository
Setup Steps
Follow these steps to get TypeHero running locally:Create Environment File
Copy the example environment file and configure it:See the Environment Variables page for detailed configuration.
Start Database Services
Start the local MySQL database and Redis using Docker Compose:This will start:
- MySQL database on port 3306
- Redis on port 6379
Configure GitHub OAuth
Create a new GitHub OAuth application:
- Go to GitHub OAuth Apps
- Fill in the required details:
- Homepage URL:
http://localhost:3000 - Authorization callback URL:
http://localhost:3000/api/auth/callback/github
- Homepage URL:
- Click “Generate a new client secret”
- Copy the Client ID and Client Secret to your
.envfile:
Setup UploadThing
Configure file upload service:
- Visit uploadthing.com
- Create a new project
- Copy the legacy secrets (not SDK v7+) to your
.env:
Setup Algolia Search
Configure search functionality:
- Go to algolia.com
- Create a new application
- Copy your credentials to
.env:
Setup Database Schema
Push the Prisma schema and seed the database:This will:
- Create all database tables
- Seed initial data including challenges and tracks
Start Development Server
Login and Test
- Navigate to http://localhost:3000
- Login using your GitHub account
- Start exploring the application!
Make Yourself an Admin
To access admin features during development:Open Prisma Studio
Available Scripts
Here are the most commonly used development scripts:Troubleshooting
Database connection errors
Database connection errors
If you’re having trouble connecting to the database:
- Ensure Docker containers are running:
docker ps - Check the DATABASE_URL in your
.envmatches the docker-compose configuration - Try restarting the containers:
docker compose restart
Need to completely reset the database?
Need to completely reset the database?
To rebuild and reseed from scratch:If that doesn’t work, manually drop the database:
Port already in use
Port already in use
If port 3000, 3306, or 6379 is already in use:
- Find the process:
lsof -i :3000(replace with port number) - Kill it:
kill -9 <PID> - Or change the port in your configuration
pnpm install fails
pnpm install fails
Try these steps:
- Clear pnpm cache:
pnpm store prune - Delete node_modules and lock file:
rm -rf node_modules pnpm-lock.yaml - Reinstall:
pnpm install
Next Steps
Environment Variables
Learn about all available configuration options
Database Setup
Deep dive into database configuration and management
Contributing Guide
Ready to contribute? Check out our guidelines
Architecture
Understand the project structure
Join the Community
Need help or want to discuss development?- Join our Discord server
- Follow us on Twitter
- Check out the GitHub repository