SKILL.md
Development Setup Skill
This skill guides you through setting up the complete development environment for the To-Do List WebApp project.
Prerequisites
- Node.js >= 20.19.0
- npm >= 9.0.0
- Docker Desktop installed and running
- Git installed
Setup Steps
1. Verify Prerequisites
First, verify that all required tools are installed:
node --version
npm --version
docker --version
git --version
2. Clone Repository (if needed)
If starting fresh:
git clone <repository-url>
cd To-DoList_WebApp
3. Install Dependencies
Install all dependencies for the monorepo (root, backend, and frontend):
npm run install:all
This command will:
- Install root dependencies
- Install backend dependencies
- Install frontend dependencies
4. Set Up Environment Variables
Backend Environment Variables
Create backend/.env from the example:
cp backend/.env.example backend/.env
Edit backend/.env and configure:
MONGODB_URI- MongoDB connection string (default: mongodb://mongodb:27017/todolist)JWT_SECRET- Secret key for JWT tokens (generate a secure random string)PORT- Backend port (default: 5000)FRONTEND_URL- Frontend URL for CORS (default: http://localhost:5173)
Frontend Environment Variables
Create frontend/.env from the example:
cp frontend/.env.example frontend/.env
Edit frontend/.env and configure:
VITEAPIURL- Backend API URL (default: http://localhost:5000/api)
5. Start Development Environment
Start all services using Docker Compose:
npm run dev
This will start:
- MongoDB on port 27017
- Backend on port 5000
- Frontend on port 5173
6. Verify Setup
Run the verification script to check that all services are running:
node .agent/skills/dev-setup/scripts/verify-setup.js
Or manually verify:
- Frontend: Open http://localhost:5173 in your browser
- Backend API: Check http://localhost:5000/api/health
- MongoDB: Check Docker containers with
docker ps
7. Alternative: Run Services Separately
If you prefer not to use Docker, you can run services separately:
# Terminal 1 - Start MongoDB (requires local MongoDB installation)
mongod
# Terminal 2 - Start Backend
npm run dev:backend
# Terminal 3 - Start Frontend
npm run dev:frontend
Common Issues and Solutions
Port Already in Use
If ports 5000 or 5173 are already in use:
- Stop the conflicting process
- Or change the port in the respective
.envfile
Docker Not Starting
- Ensure Docker Desktop is running
- Check Docker logs:
docker-compose logs - Restart Docker Desktop
- Try rebuilding:
docker-compose up --build
Dependencies Installation Fails
- Clear npm cache:
npm cache clean --force - Delete
node_modulesand lock files:npm run clean:modules - Reinstall:
npm run install:all
MongoDB Connection Issues
- Check Docker container status:
docker ps - Check MongoDB logs:
docker-compose logs mongodb - Verify MONGODB_URI in
backend/.env - Restart containers:
npm run restart
Next Steps
After setup is complete:
- Run Tests: Use the
run-testsskill to verify everything works - Check Code Quality: Use the
lint-fixskill to ensure code quality - Start Development: Begin working on features using
add-api-endpointoradd-react-componentskills
Useful Commands
# View all running containers
docker ps
# View logs from all services
npm run logs
# View logs from specific service
npm run logs:backend
npm run logs:frontend
# Stop all services
npm run stop
# Restart all services
npm run restart
# Clean everything (including volumes)
npm run clean
Development Workflow
- Make changes to code
- Backend auto-reloads on file changes (nodemon)
- Frontend auto-reloads on file changes (Vite HMR)
- MongoDB data persists in Docker volume
Testing the Setup
Create a test todo item to verify the full stack is working:
- Open http://localhost:5173
- Register a new account
- Create a new todo item
- Verify it appears in the list
- Check backend logs to see API requests
- Check MongoDB using:
docker exec -it <mongodb-container-id> mongosh