Skip to main content
This guide walks you through setting up CharleOS for local development, from cloning the repository to signing in for the first time.

Prerequisites

Before you begin, ensure you have the following installed:

Node.js 18+

Check your version:
Install via nvm (recommended):

npm

Check your version:
npm comes with Node.js installation.

Git

Check if installed:
If not installed, download Git.

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:
This installs:
  • Next.js and React
  • Better Auth for authentication
  • Drizzle ORM for database access
  • shadcn/ui components
  • Testing frameworks (Vitest, Playwright)
  • All other dependencies
Expected time: 1-2 minutes

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.
You can verify the file exists:
You should see environment variables for Better Auth and the database.

4. Start the Development Server

Start the Next.js development server:
You should see:
Open http://localhost:3000 in your browser.

5. Sign In

  1. Click “Sign in with Google”
  2. Select your @charle.co.uk email
  3. Authorize the application
After first sign-in:
  • Your account is created with role = pending
  • You’ll see “Pending Approval” message
  • Contact an admin to update your role to developer, pm, csm, or admin
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:
Navigate to the dashboard. You should see:
  • Day rates chart
  • Client list
  • Task counts
  • Schedule preview
If data is missing, the database connection is working but you may not have access to client data yet.
Open Drizzle Studio to browse the database:
Opens at https://local.drizzle.studioYou should see all tables (users, clients, tasks, etc.).
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

Symptoms:
  • “Connection refused” errors
  • Blank dashboard
  • API routes returning 500 errors
Possible causes:
  1. DATABASE_URL not set: Check .env.local has DATABASE_URL
  2. VPN interference: Disconnect VPN and try again
  3. Incorrect credentials: Verify .env.local wasn’t accidentally modified
Debug steps:
Symptoms:
  • Import errors like “Cannot find module…”
  • TypeScript errors about missing types
Fix: Clear cache and reinstall:
Error: Port 3000 is already in useOptions:Option 1: Kill the process using port 3000:
Option 2: Use a different port:
Then open http://localhost:3001
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 database

Optional: Seed Development Data

If you want realistic data for local development:
This creates:
  • Sample clients
  • Demo tasks and quotes
  • Test time entries
  • Schedule blocks
Do NOT run this on production! The seed script is for local development only.

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

Commit messages follow Conventional Commits
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: See package.json for the complete list.

Next Steps

Now that you’re set up, explore the codebase:

Project Structure

Understand how the codebase is organized

Environment Variables

Learn about all configuration options

Database

Working with Drizzle ORM and PostgreSQL

Authentication

Better Auth setup and permissions