# Experience Change

A full-stack skill exchange platform where learners can share what they know, browse new skills, and contact skill owners. No authentication required.

## Tech Stack

- Frontend: React (Vite), Tailwind CSS, React Router, Axios
- Backend: Node.js, Express, PostgreSQL, pg

## Project Structure

```
client/
  src/
    pages/
      Home.jsx
      AddSkill.jsx
      SkillDetails.jsx
    services/api.js
    App.jsx
    main.jsx
server/
  index.js
  db.js
  routes/
    skills.js
    messages.js
    logs.js
    categories.js
```

## Database Setup (PostgreSQL)

1. Create the database:

```sql
CREATE DATABASE experience_change;
```

2. Run the schema:

```bash
psql -d experience_change -f server/schema.sql
```

## Environment Variables

Create `server/.env`:

```
DATABASE_URL=postgres://postgres:password@localhost:5432/experience_change
PORT=5001
```

Optional client environment variable in `client/.env`:

```
VITE_API_URL=http://localhost:5001
```

## Run the Backend

```bash
cd server
npm install
npm run dev
```

## Run the Frontend

```bash
cd client
npm install
npm run dev
```

The frontend runs on `http://localhost:5173` by default and connects to the API at `http://localhost:5001`.

## API Endpoints

### Skills
- `POST /skills` create a skill
- `GET /skills` list skills, optional `?search=` and `?category=` filters
- `GET /skills/:id` skill details
- `PUT /skills/:id` update a skill
- `DELETE /skills/:id` delete a skill

### Messages
- `POST /messages` send a message to the skill owner

### Logs
- `GET /logs` list logs, optional `?category_id=` filter
- `GET /logs/:id` log details
- `POST /logs` create a log
- `PUT /logs/:id` update a log
- `DELETE /logs/:id` delete a log

### Categories
- `GET /categories` list categories
- `POST /categories` create a category
- `PUT /categories/:id` update a category
- `DELETE /categories/:id` delete a category
