This directory contains scripts to automate local development setup for CCSync.
The setup.sh script starts all three services (backend, frontend, and sync server) in a single tmux session with separate panes for each service.
Note: The backend should ideally be run in a separate user environment (preferably root user) to avoid permission issues with Taskwarrior configuration files.
Git Hooks: Pre-commit hooks are automatically configured when you run
npm installin the frontend directory. These hooks will format your code before each commit.
Before running the setup script, ensure you have the following installed:
- Go (1.19 or higher) - Installation Guide
- Node.js (16 or higher) and npm - Installation Guide
- Docker and Docker Compose - Installation Guide
- tmux - Terminal multiplexer
- macOS:
brew install tmux - Ubuntu/Debian:
sudo apt-get install tmux - Fedora:
sudo dnf install tmux
- macOS:
The setup script requires environment files for both backend and frontend. Create these files before running the script.
Create a file at ./backend/.env (relative to project root) with the following content:
CLIENT_ID="your_google_client_id"
CLIENT_SEC="your_google_client_secret"
REDIRECT_URL_DEV="http://localhost:8000/auth/callback"
SESSION_KEY="your_random_session_key"
FRONTEND_ORIGIN_DEV="http://localhost:5173"
CONTAINER_ORIGIN="http://localhost:8080/"How to get Google OAuth credentials:
For detailed instructions, refer to the CCSync Documentation.
Quick steps:
- Go to Google Cloud Console
- Create a new project or select an existing one
- Navigate to "APIs & Services" > "Credentials"
- Click "Create Credentials" > "OAuth 2.0 Client ID"
- Configure the OAuth consent screen if prompted
- Select "Web application" as the application type
- Add authorized redirect URI:
http://localhost:8000/auth/callback - Copy the Client ID and Client Secret
Generate SESSION_KEY:
You can generate a random session key using:
openssl rand -base64 32Create a file at frontend/.env with the following content:
VITE_BACKEND_URL="http://localhost:8000/"
VITE_FRONTEND_URL="http://localhost:5173"
VITE_CONTAINER_ORIGIN="http://localhost:8080/"From the project root directory:
- Make the script executable (first time only):
chmod +x development/setup.sh- Run the setup script:
./development/setup.shThe script will:
- Verify all prerequisites are installed
- Check that environment files exist
- Install dependencies if needed (Go modules and npm packages)
- Start all three services in a tmux session
- Automatically attach you to the session
Once running, you can access:
- Frontend: http://localhost:5173
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/api/docs/index.html
- Sync Server: http://localhost:8080 (started via
docker-compose up syncserver)
- Detach from session (keep services running): Press
Ctrl+b, thend - Reattach to session:
tmux attach -t ccsync - Navigate between panes:
Ctrl+bthen arrow keys - Scroll in a pane:
Ctrl+bthen[, use arrow keys, pressqto exit
To stop all services and clean up:
- Make the stop script executable (first time only):
chmod +x development/stop.sh- Run the stop script:
./development/stop.shThis will kill the tmux session and stop all Docker containers.
If you see errors about ports already being in use:
# Check what's using the ports
lsof -i :8000 # Backend
lsof -i :5173 # Frontend
lsof -i :8080 # Sync Server
# Kill the process using the port
kill -9 <PID>Ensure Docker Desktop is running or start the Docker daemon:
# macOS/Linux
sudo systemctl start docker
# Or start Docker Desktop applicationIf you encounter permission errors with Taskwarrior:
# Ensure your user has write permissions
chmod 644 ~/.taskrcIf Go modules or npm packages fail to install:
# Backend
cd backend
go mod download
go mod tidy
# Frontend
cd frontend
npm installIf the tmux session already exists, the script will attach to it. To start fresh:
# Kill the existing session
tmux kill-session -t ccsync
# Run setup again
./development/setup.sh- The setup script automatically installs dependencies if they're not present
- All services run in development mode with hot-reloading enabled
- Logs from all services are visible in their respective tmux panes
- The script validates environment files before starting services