Local Development Setup
This guide will help you set up a complete local development environment for the Ever Works.
Prerequisites
Ensure you have the following installed:
- Node.js 20.x or higher - Download
- Git - Download
- PostgreSQL (optional) - Download
- Docker (optional) - Download
Development Environment Setup
1. Clone and Install
# Clone the repository
git clone https://github.com/ever-co/ever-works-website-template.git
cd ever-works-website-template
# Install dependencies
npm install
# Or using yarn/pnpm
yarn install
pnpm install
2. Environment Configuration
Copy the example environment file:
cp .env.example .env.local
Configure your .env.local file:
# Basic Development Configuration
NODE_ENV=development
NEXT_PUBLIC_API_BASE_URL="http://localhost:3000/api"
NEXT_PUBLIC_APP_URL="http://localhost:3000"
# Authentication
AUTH_SECRET="generate-a-secure-secret-key"
NEXTAUTH_URL="http://localhost:3000"
# GitHub Integration (Required)
GH_TOKEN="your-github-personal-access-token"
DATA_REPOSITORY="https://github.com/your-username/awesome-data"
# Database (Optional)
DATABASE_URL="postgresql://username:password@localhost:5432/database_name"
# OAuth Providers (Optional)
GOOGLE_CLIENT_ID="your-google-client-id"
GOOGLE_CLIENT_SECRET="your-google-client-secret"
3. Database Setup (Optional)
Option A: Local PostgreSQL
# Create database
createdb everworks_dev
# Run migrations
npm run db:generate
npm run db:migrate
# Seed with sample data
npm run db:seed
Option B: Docker PostgreSQL
# Start PostgreSQL container
docker run --name everworks-postgres \
-e POSTGRES_PASSWORD=your-secure-password \
-e POSTGRES_DB=your_database_name \
-p 5432:5432 \
-d postgres:15
# Run migrations
npm run db:migrate
npm run db:seed
Option C: Supabase
- Create project at Supabase
- Get connection string from Settings → Database
- Update
DATABASE_URLin.env.local - Run migrations:
npm run db:migrate
4. Content Repository Setup
Fork the Data Repository
- Visit awesome-data
- Click "Fork" to create your copy
- Update
DATA_REPOSITORYin.env.local
Generate GitHub Token
- Go to GitHub Settings → Developer settings → Personal access tokens
- Generate new token (classic)
- Select scopes:
repo,read:user,user:email - Copy the generated token and add it to
GH_TOKENin.env.local - Important: Never commit your token to version control
5. Start Development Server
npm run dev
Your application will be available at http://localhost:3000.
Development Scripts
Core Scripts
# Start development server
npm run dev
# Build for production
npm run build
# Start production server
npm start
# Type checking
npm run type-check
# Linting
npm run lint
npm run lint:fix
# Code formatting
npm run format
npm run format:check
Database Scripts
# Generate database schema
npm run db:generate
# Run migrations
npm run db:migrate
# Reset database
npm run db:reset
# Seed database
npm run db:seed
# Open database studio
npm run db:studio
Content Scripts
# Sync content from Git
npm run content:sync
# Validate content files
npm run content:validate
# Generate content types
npm run content:types
Development Tools
VS Code Setup
Install recommended extensions:
{
"recommendations": [
"bradlc.vscode-tailwindcss",
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint",
"ms-vscode.vscode-typescript-next",
"formulahendry.auto-rename-tag",
"christian-kohler.path-intellisense"
]
}
Configure VS Code settings (.vscode/settings.json):
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"typescript.preferences.importModuleSpecifier": "relative",
"tailwindCSS.experimental.classRegex": [
["cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"],
["cx\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"]
]
}
Browser DevTools
React Developer Tools
- Install React DevTools
- Inspect component tree and props
- Profile component performance
Redux DevTools (for Zustand)
- Install Redux DevTools
- Monitor state changes
- Time-travel debugging
Database Tools
Drizzle Studio
npm run db:studio
- Visual database browser
- Query builder interface
- Schema visualization
pgAdmin (for PostgreSQL)
- Install pgAdmin
- Connect to local database
- Advanced query tools
Hot Reloading
The development server supports hot reloading for:
- React components - Instant updates
- API routes - Automatic restart
- Tailwind CSS - Live style updates
- TypeScript - Real-time type checking
Troubleshooting Hot Reload
If hot reload stops working:
# Clear Next.js cache
rm -rf .next
# Restart development server
npm run dev
Environment Variables
Development vs Production
Create different environment files:
.env.local # Local development
.env.development # Development environment
.env.staging # Staging environment
.env.production # Production environment
Environment Validation
The app validates environment variables on startup:
// lib/env.ts
import { z } from 'zod';
const envSchema = z.object({
NODE_ENV: z.enum(['development', 'production', 'test']),
AUTH_SECRET: z.string().min(32),
GH_TOKEN: z.string().startsWith('ghp_'),
DATABASE_URL: z.string().url().optional(),
});
export const env = envSchema.parse(process.env);
Testing Setup
Unit Testing
# Install testing dependencies
npm install -D jest @testing-library/react @testing-library/jest-dom
# Run tests
npm test
# Run tests in watch mode
npm run test:watch
# Generate coverage report
npm run test:coverage
E2E Testing
# Install Playwright
npm install -D @playwright/test
# Run E2E tests
npm run test:e2e
# Run tests in UI mode
npm run test:e2e:ui