# Taskoro Server Installation

This guide installs Taskoro on a Linux server with Node.js 20 or newer and a
MySQL-compatible database.

## One-command setup

From the Taskoro project directory:

```bash
chmod +x setup.sh
./setup.sh
```

The English setup wizard will:

1. Ask for the public application URL and server port.
2. Ask for either a complete MySQL connection URL or separate MySQL fields.
3. Generate strong JWT and session secrets, or accept manually supplied values.
4. Configure SMTP, which is required for production account verification emails.
5. Optionally configure Slack, Zoom, Google Calendar, Stripe, and reCAPTCHA.
6. Save the result to `backend/.env` with permissions restricted to the current user.
7. Install locked backend and frontend dependencies.
8. Build the frontend and backend.
9. Offer to create and start a `taskoro.service` systemd service.

The script never prints passwords, API keys, or generated secrets.

## Requirements

- Linux server
- Node.js 20 or newer
- npm
- MySQL 8+, MariaDB, or a compatible hosted MySQL database
- A public HTTPS URL for production OAuth and email verification

The setup wizard does not install MySQL. Create the database and user with your
hosting provider first, then provide the connection details when prompted.

## Production layout

The production build is served as a single-origin application by the backend.
The backend serves `frontend/dist` and exposes the API under `/api`, so a
reverse proxy only needs to forward one port (the default is `4000`).

For Nginx, the proxy target is typically:

```nginx
location / {
    proxy_pass http://127.0.0.1:4000;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
}
```

## Service management

If the installer creates the systemd service:

```bash
sudo systemctl status taskoro
sudo systemctl restart taskoro
sudo journalctl -u taskoro -f
```

If systemd is not available, start the server manually:

```bash
NODE_ENV=production npm --prefix backend start
```

## OAuth callback URLs

Use the exact `APP_BASE_URL` entered in the wizard:

- Slack: `/api/integrations/slack/callback`
- Zoom: `/api/integrations/zoom/callback`
- Google Calendar: `/api/integrations/google_calendar/callback`

For production, use HTTPS and register the complete callback URL in each
provider's developer console.

## Re-running setup

Running `./setup.sh` again detects the existing `backend/.env`, creates a
timestamped backup, and asks for confirmation before replacing it.
