50 lines
1021 B
Markdown
50 lines
1021 B
Markdown
## Docker Setup
|
|
|
|
Run the full stack with:
|
|
|
|
```bash
|
|
docker compose up --build
|
|
```
|
|
|
|
Services:
|
|
|
|
- Frontend: `http://localhost:5173`
|
|
- Backend: `http://localhost:4000`
|
|
- MongoDB: `mongodb://localhost:27017/chatapp`
|
|
|
|
The Compose file starts all required services together:
|
|
|
|
- `frontend` as a Vite container
|
|
- `backend` as a Node/Express container
|
|
- `mongo` with a persistent `mongo-data` volume
|
|
|
|
Stop everything with:
|
|
|
|
```bash
|
|
docker compose down
|
|
```
|
|
|
|
Remove containers and database volume with:
|
|
|
|
```bash
|
|
docker compose down -v
|
|
```
|
|
|
|
## Local Development Without Docker
|
|
|
|
1. Copy the backend environment file:
|
|
|
|
```bash
|
|
cp Backend/.env.example Backend/.env
|
|
```
|
|
|
|
2. Start MongoDB locally or with Docker.
|
|
|
|
3. Start the backend:
|
|
|
|
```bash
|
|
cd Backend && npm run dev
|
|
```
|
|
|
|
The backend tries MongoDB at `mongodb://127.0.0.1:27017/chatapp` first and falls back to `Backend/data/db.json` only if MongoDB is unavailable. Use `DATA_STORE=mongo` to fail fast on MongoDB errors, or `DATA_STORE=json` to force the JSON store.
|