Prerequisites
Before you begin, ensure you have the following installed:Node.js 18+
Check your version:npm
Check your version:Git
Check if installed:Required Access
- @charle.co.uk Email - Required for Google OAuth sign-in
- GitHub Repository Access - Request access from an admin
Setup Steps
1. Clone the Repository
If you don’t have repository access, request it from the team lead.
2. Install Dependencies
Install all required packages:- Next.js and React
- Better Auth for authentication
- Drizzle ORM for database access
- shadcn/ui components
- Testing frameworks (Vitest, Playwright)
- All other dependencies
3. Verify Environment Variables
The repository already includes a.env.local file with all necessary configuration:
- Database credentials (development database)
- Auth secrets and OAuth credentials
- API keys for integrations
- Feature flags
The
.env.local file is checked into the repository and configured for local development. Do NOT pull from Vercel as that would overwrite with production credentials.4. Start the Development Server
Start the Next.js development server:5. Sign In
- Click “Sign in with Google”
- Select your @charle.co.uk email
- Authorize the application
- Your account is created with role =
pending - You’ll see “Pending Approval” message
- Contact an admin to update your role to
developer,pm,csm, oradmin
Only @charle.co.uk email addresses are allowed. Other domains will be rejected.
Verify Your Setup
Once signed in (and approved by admin), verify everything works:Dashboard Loads
Dashboard Loads
Navigate to the dashboard. You should see:
- Day rates chart
- Client list
- Task counts
- Schedule preview
Database Connection
Database Connection
Open Drizzle Studio to browse the database:Opens at https://local.drizzle.studioYou should see all tables (users, clients, tasks, etc.).
Hot Reload Works
Hot Reload Works
Make a small change to any file (e.g., add a comment). The browser should automatically reload with your changes.If it doesn’t, check the terminal for build errors.
Common Issues
Database Connection Error
Database Connection Error
Symptoms:
- “Connection refused” errors
- Blank dashboard
- API routes returning 500 errors
- DATABASE_URL not set: Check
.env.localhasDATABASE_URL - VPN interference: Disconnect VPN and try again
- Incorrect credentials: Verify
.env.localwasn’t accidentally modified
Module Not Found or Type Errors
Module Not Found or Type Errors
Symptoms:
- Import errors like “Cannot find module…”
- TypeScript errors about missing types
Port 3000 Already in Use
Port 3000 Already in Use
Error: Option 2: Use a different port:Then open http://localhost:3001
Port 3000 is already in useOptions:Option 1: Kill the process using port 3000:Pending Role - Can't Access App
Pending Role - Can't Access App
Symptom: After signing in, you see “Pending Approval” and can’t access the appCause: New accounts start with
role = pending until approvedFix: Ask an admin to update your role in the databaseOptional: Seed Development Data
If you want realistic data for local development:- Sample clients
- Demo tasks and quotes
- Test time entries
- Schedule blocks
Development Workflow
Now that you’re set up, here’s the typical development workflow:1
Pull Latest Changes
Start each day by pulling the latest code:
2
Create Feature Branch
Create a branch for your work:Use prefixes like
feature/, fix/, chore/3
Make Changes
- Edit files in your code editor
- Save, and hot reload will update the browser
- Check terminal for any errors
4
Test Locally
- Manually test your changes in the browser
- Run unit tests:
npm run test - Run E2E tests if needed:
npm run test:e2e
5
Commit and Push
6
Create Pull Request
- Go to GitHub
- Create PR from your branch to
main - Vercel will automatically deploy a preview
- Request reviews from teammates
Available Commands
Common commands for local development:| Command | Description |
|---|---|
npm run dev | Start development server |
npm run build | Build for production (test build locally) |
npm run lint | Run ESLint to catch code issues |
npm run format | Format code with Prettier |
npm run type-check | Check TypeScript types without building |
npm run test | Run unit tests |
npm run test:watch | Run tests in watch mode |
npm run test:e2e | Run E2E tests |
npm run db:push | Push schema changes to database (local dev) |
npm run db:generate | Generate migration file (for production) |
npm run db:studio | Open Drizzle Studio (database browser) |
npm run db:seed | Seed development data |
package.json for the complete list.