This guide will help you set up and run the AutoWRX project in development mode on your local machine.
AutoWRX consists of two separate services that run in parallel during development:
- Backend: Node.js/Express API server (port 3200)
- Frontend: React/Vite development server (port 3210)
For Development:
- You run the backend and frontend directly on your machine (not in Docker)
- Each service uses its own
.envfile (backend/.envandfrontend/.env) - Only MongoDB runs in Docker (or you can use a remote MongoDB)
- This allows for hot-reload, debugging, and faster iteration
For Deployment:
- See the Instance Setup Guide in the
instance-setup/directory
- Node.js 18+ and npm (or yarn)
- Docker (optional, for running MongoDB locally)
- Git (to clone the repository)
git clone <repository-url>
cd autowrxYou have two options:
# Start MongoDB container
docker run --name autowrx-mongo -p 27017:27017 -d mongo:4.4.6-bionic
# To stop MongoDB later:
# docker stop autowrx-mongo
# To start it again:
# docker start autowrx-mongo
# To remove the container (data will be lost):
# docker rm -f autowrx-mongoIf you have a remote MongoDB instance, you can use it by setting the MONGODB_URL in your backend/.env file (see step 3 below).
cd backend
# Install dependencies
npm install
# Create .env file from example
cp .env.example .env
# Edit .env file with your settings
# At minimum, ensure MONGODB_URL is correct:
# - For local Docker: MONGODB_URL=mongodb://localhost:27017/autowrx
# - For remote MongoDB: MONGODB_URL=mongodb://your-remote-host:27017/autowrxcd ../frontend
# Install dependencies
npm install
# Create .env file from example
cp .env.example .env
# The default .env should work for local development
# VITE_SERVER_BASE_URL=http://localhost:3200
# VITE_SERVER_VERSION=v2You need two terminal windows:
Terminal 1 - Backend:
cd backend
npm run devTerminal 2 - Frontend:
cd frontend
npm run devThat's it! The application should now be running.
The backend uses backend/.env for configuration. Key variables:
# Environment
NODE_ENV=development
PORT=3200
# Database
MONGODB_URL=mongodb://localhost:27017/autowrx
# For remote MongoDB:
# MONGODB_URL=mongodb://your-remote-host:27017/autowrx?authSource=admin
# JWT Configuration
JWT_SECRET=dev_secret_change_me
JWT_COOKIE_NAME=token
# Admin User (optional - creates admin on first run)
ADMIN_EMAILS=admin@example.com
ADMIN_PASSWORD=your-password
# CORS (for development, default is usually fine)
CORS_ORIGINS=localhost:\\d+,127\\.0\\.0\\.1:\\d+Important Notes:
MONGODB_URLmust match your MongoDB setup (local Docker or remote)- Change
JWT_SECRETto a secure value (but not critical for local dev) - Authentication settings (self-registration, public viewing, etc.) can be configured via the Site Configuration in the admin panel
The frontend uses frontend/.env for configuration. Key variables:
# Backend API URL
VITE_SERVER_BASE_URL=http://localhost:3200
# API Version
VITE_SERVER_VERSION=v2Note: The frontend .env file is minimal. Most configuration is handled by the backend.
The MongoDB container will:
- Run on port
27017(standard MongoDB port) - Persist data in a Docker volume (data survives container restarts)
- Use the
mongo:4.4.6-bionicimage (matches production)
Useful Docker Commands:
# Check if MongoDB is running
docker ps | grep mongo
# View MongoDB logs
docker logs autowrx-mongo
# Connect to MongoDB shell
docker exec -it autowrx-mongo mongo
# Stop MongoDB
docker stop autowrx-mongo
# Start MongoDB
docker start autowrx-mongo
# Remove MongoDB (⚠️ deletes all data)
docker rm -f autowrx-mongoIf you're using a remote MongoDB (e.g., MongoDB Atlas, or a team server):
- Get the connection string from your MongoDB provider
- Update
backend/.env:MONGODB_URL=mongodb://username:password@host:port/database?authSource=admin - Ensure your network allows connections from your IP address
In development, the backend and frontend run as separate services with a proxy configuration:
┌─────────────────────────────────────────────────────────┐
│ Browser │
└─────────────────────────────────────────────────────────┘
│
│ http://localhost:3200
│
┌─────────────────┴─────────────────┐
│ │
▼ ▼
┌──────────────┐ ┌──────────────┐
│ Backend │ │ Frontend │
│ (Port 3200) │◄──────────────────►│ (Port 3210) │
└──────────────┘ └──────────────┘
│ │
│ │
▼ │
┌──────────────┐ │
│ MongoDB │ │
│ (Port 27017)│ │
└──────────────┘ │
│
┌──────────────────────────────────┘
│
│ Proxies /v2/*, /static/*, /imgs/*, /d/*
│ to Backend
│
│ Proxies all other requests to Frontend
│
▼
-
API Requests (
/v2/*,/static/*,/imgs/*,/d/*):- Frontend proxies these to Backend (port 3200)
- Backend handles the request and returns the response
-
Frontend Routes (everything else):
- Backend proxies these to Frontend (port 3210)
- Frontend serves the React application
-
Unified Access:
- You can access the full application at
http://localhost:3200 - The backend automatically proxies frontend requests
- You can access the full application at
- Hot Reload: Both services support hot-reload for fast development
- Independent Development: Frontend and backend can be developed separately
- Easy Debugging: You can debug each service independently
- Production-like: The unified access point (
localhost:3200) mimics production behavior
Once both services are running, you can access:
-
Unified Application: http://localhost:3200
- This is the main entry point
- Backend proxies frontend requests automatically
-
Frontend Only: http://localhost:3210
- Direct access to the Vite dev server
- Useful for frontend-only development
-
Backend API Only: http://localhost:3200/v2
- Direct API access
- Useful for testing API endpoints
-
API Documentation: http://localhost:3200/api-docs
- Swagger/OpenAPI documentation (if enabled)
Issue: Error: Cannot connect to MongoDB
Solutions:
- Check if MongoDB is running:
docker ps | grep mongo - Verify
MONGODB_URLinbackend/.envmatches your MongoDB setup - For Docker MongoDB, ensure the container is running:
docker start autowrx-mongo
- For remote MongoDB, check network connectivity and credentials
Issue: Port 3200 already in use
Solutions:
- Find what's using the port:
lsof -i :3200
- Stop the conflicting process, or change
PORTinbackend/.env
Issue: Port 3210 already in use
Solutions:
- Find what's using the port:
lsof -i :3210
- Stop the conflicting process, or change the port in
frontend/vite.config.ts
Issue: Cannot connect to backend API
Solutions:
- Ensure backend is running on port 3200
- Check
VITE_SERVER_BASE_URLinfrontend/.envishttp://localhost:3200 - Check browser console for CORS errors (may need to adjust
CORS_ORIGINSin backend)
Issue: MongoDB container won't start
Solutions:
- Check if port 27017 is already in use:
lsof -i :27017
- Remove the old container and create a new one:
docker rm -f autowrx-mongo docker run --name autowrx-mongo -p 27017:27017 -d mongo:4.4.6-bionic
Issue: Connection refused to MongoDB
Solutions:
- Ensure MongoDB container is running:
docker ps - Check MongoDB logs:
docker logs autowrx-mongo - Verify
MONGODB_URLinbackend/.envuseslocalhost(not127.0.0.1or container name)
Issue: npm install fails
Solutions:
- Clear npm cache:
npm cache clean --force - Delete
node_modulesandpackage-lock.json, then reinstall - Ensure you're using Node.js 18+
Issue: Changes not reflecting (hot reload not working)
Solutions:
- Check that you're running
npm run dev(notnpm start) - Restart the dev server
- Clear browser cache
Issue: CORS errors in browser console
Solutions:
- Check
CORS_ORIGINSinbackend/.envincludes your frontend URL - For development, use:
CORS_ORIGINS=localhost:\\d+,127\\.0\\.0\\.1:\\d+ - Restart the backend after changing
.env
- Read the Project Structure Documentation
- Explore the API Documentation
- Check out the Plugin Development Guide
- Review the Deployment Guide for production setup
- Check existing documentation in the
docs/directory - Review the Instance Setup Guide for deployment questions
- Check GitHub issues for known problems
- Review backend and frontend README files for service-specific information
Note: This guide is for development only. For production deployment, see the Instance Setup Guide in the instance-setup/ directory.